Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
conda
fsl-ci-rules
Commits
fee022a8
Commit
fee022a8
authored
Jul 21, 2021
by
Paul McCarthy
🚵
Browse files
MNT: package_status accepts username/password for accessing internal channel
parent
75a29ec5
Changes
1
Hide whitespace changes
Inline
Side-by-side
fsl_ci/utils/package_status.py
View file @
fee022a8
...
...
@@ -17,10 +17,11 @@ recipe in the gitlab fsl/conda/ space. The table contains columns for:
"""
import
sys
import
argparse
import
itertools
as
it
import
urllib.parse
as
urlparse
import
sys
import
argparse
import
itertools
as
it
import
urllib.parse
as
urlparse
import
urllib.request
as
urlrequest
from
fsl_ci.gitlab
import
(
get_projects_in_namespace
,
download_file
,
...
...
@@ -192,6 +193,9 @@ def parseArgs():
'token'
:
'Gitlab API access token with read+write access'
,
'username'
:
'Username to access internal conda channel'
,
'password'
:
'Password to access internal conda channel'
,
'server'
:
f
'Gitlab server (default:
{
SERVER_URL
}
)'
,
...
...
@@ -219,6 +223,8 @@ def parseArgs():
help
=
helps
[
'server'
])
parser
.
add_argument
(
'-t'
,
'--token'
,
required
=
True
,
help
=
helps
[
'token'
])
parser
.
add_argument
(
'-u'
,
'--username'
,
help
=
helps
[
'username'
])
parser
.
add_argument
(
'-p'
,
'--password'
,
help
=
helps
[
'password'
])
parser
.
add_argument
(
'-n'
,
'--namespace'
,
help
=
helps
[
'namespace'
],
default
=
RECIPE_NAMESPACE
)
...
...
@@ -232,7 +238,7 @@ def parseArgs():
help
=
helps
[
'output'
])
parser
.
add_argument
(
'-e'
,
'--exclude'
,
help
=
helps
[
'exclude'
],
action
=
'append'
)
parser
.
add_argument
(
'-p'
,
'--platform'
,
parser
.
add_argument
(
'-p
l
'
,
'--platform'
,
help
=
helps
[
'platform'
],
default
=
PLATFORMS
,
action
=
'append'
)
...
...
@@ -244,6 +250,21 @@ def parseArgs():
args
.
exclude
.
extend
(
EXCLUDE
)
if
(
args
.
username
is
not
None
)
and
(
args
.
password
is
None
)
or
\
(
args
.
username
is
None
)
and
(
args
.
password
is
not
None
):
parser
.
error
(
'Both --username and --password must be specified'
)
# install auth handler to
# access internal channel
if
args
.
username
is
not
None
:
pwdmgr
=
urlrequest
.
HTTPPasswordMgrWithDefaultRealm
()
pwdmgr
.
add_password
(
None
,
args
.
internal_url
,
args
.
username
,
args
.
password
)
handler
=
urlrequest
.
HTTPBasicAuthHandler
(
pwdmgr
)
opener
=
urlrequest
.
build_opener
(
handler
)
opener
.
open
(
args
.
internal_url
)
urlrequest
.
install_opener
(
opener
)
return
args
...
...
@@ -333,14 +354,14 @@ def get_mnt_conda_divergence(project, server, token):
def
main
():
args
=
parseArgs
()
internal
=
get_channel_packages
(
args
.
internal_url
)
public
=
get_channel_packages
(
args
.
public_url
)
projects
=
get_projects_in_namespace
(
args
.
namespace
,
args
.
server
,
args
.
token
)
projects
=
filter_projects
(
projects
,
args
.
exclude
)
projects
=
sort_projects
(
projects
,
args
.
server
,
args
.
token
)
projects
=
filter_projects
(
projects
,
args
.
exclude
)
projects
=
sort_projects
(
projects
,
args
.
server
,
args
.
token
)
internal
=
get_channel_packages
(
args
.
internal_url
)
public
=
get_channel_packages
(
args
.
public_url
)
# Print a table containing the following columns
# package name, recipe version, project repo <- get_recipe_info
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment