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
c2ac5316
Commit
c2ac5316
authored
Oct 04, 2021
by
Paul McCarthy
🚵
Browse files
MNT: Very confused. Add username/password to internal channel URL
parent
3e047d50
Changes
3
Hide whitespace changes
Inline
Side-by-side
fsl_ci/__init__.py
View file @
c2ac5316
...
...
@@ -6,20 +6,21 @@
#
import
os.path
as
op
import
os
import
sys
import
errno
import
shlex
import
time
import
tempfile
import
contextlib
as
ctxlib
import
subprocess
as
sp
import
os.path
as
op
import
os
import
sys
import
errno
import
shlex
import
time
import
tempfile
import
urllib.parse
as
urlparse
import
contextlib
as
ctxlib
import
subprocess
as
sp
import
yaml
__version__
=
'0.1
6.9
'
__version__
=
'0.1
7.0
'
"""Current version of the fsl-ci-rules."""
...
...
@@ -133,6 +134,14 @@ def dumpyaml(o):
return
yaml
.
dump
(
o
,
sort_keys
=
False
)
def
add_credentials
(
url
,
username
,
password
):
"""Returns a URL with the username/password added."""
username
=
urlparse
.
quote_plus
(
username
)
password
=
urlparse
.
quote_plus
(
password
)
scheme
,
path
=
url
.
split
(
'://'
)
return
f
'
{
scheme
}
://
{
username
}
:
{
password
}
@
{
path
}
'
class
CaptureStdout
:
"""Context manager which captures stdout and stderr. """
...
...
fsl_ci/scripts/build_conda_package.py
View file @
c2ac5316
...
...
@@ -13,7 +13,8 @@ import urllib.parse as urlparse
from
fsl_ci
import
(
sprun
,
indir
,
fprint
)
fprint
,
add_credentials
)
from
fsl_ci.versioning
import
generate_staging_version
from
fsl_ci.platform
import
get_platform_shortcut_if_not_applicable
from
fsl_ci.conda
import
load_meta_yaml
...
...
@@ -119,6 +120,8 @@ def main():
token
=
os
.
environ
[
'FSL_CI_API_TOKEN'
]
staging
=
os
.
environ
[
'STAGING'
].
lower
()
==
'true'
internal
=
'FSLCONDA_INTERNAL'
in
os
.
environ
username
=
os
.
environ
.
get
(
'FSLCONDA_INTERNAL_CHANNEL_USERNAME'
,
None
)
password
=
os
.
environ
.
get
(
'FSLCONDA_INTERNAL_CHANNEL_PASSWORD'
,
None
)
skip_platforms
=
os
.
environ
.
get
(
'FSLCONDA_SKIP_PLATFORM'
,
''
)
skip_platforms
=
skip_platforms
.
split
()
...
...
@@ -145,11 +148,12 @@ def main():
# we output to _platform_, rather thah platform.
output_dir
=
op
.
join
(
os
.
getcwd
(),
'conda_build'
,
f
'_
{
platform
}
_'
)
if
internal
:
channel_urls
=
[
os
.
environ
[
'FSLCONDA_INTERNAL_CHANNEL_URL'
],
os
.
environ
[
'FSLCONDA_PUBLIC_CHANNEL_URL'
]]
else
:
channel_urls
=
[
os
.
environ
[
'FSLCONDA_PUBLIC_CHANNEL_URL'
]]
pubchan
=
os
.
environ
[
'FSLCONDA_PUBLIC_CHANNEL_URL'
]
intchan
=
os
.
environ
[
'FSLCONDA_INTERNAL_CHANNEL_URL'
]
if
username
is
not
None
:
intchan
=
add_credentials
(
intchan
,
username
,
password
)
if
internal
:
channel_urls
=
[
intchan
,
pubchan
]
else
:
channel_urls
=
[
pubchan
]
os
.
makedirs
(
output_dir
)
...
...
fsl_ci/scripts/run_unit_tests.py
View file @
c2ac5316
...
...
@@ -12,7 +12,7 @@ import os
import
sys
import
glob
from
fsl_ci
import
sprun
from
fsl_ci
import
sprun
,
add_credentials
from
fsl_ci.platform
import
get_platform_shortcut_if_not_applicable
from
fsl_ci.conda
import
(
load_meta_yaml
,
get_project_repository_and_revision
)
...
...
@@ -55,6 +55,11 @@ def create_test_env(env_dir, build_dir):
internal
=
'FSLCONDA_INTERNAL'
in
os
.
environ
intchannel
=
os
.
environ
[
'FSLCONDA_INTERNAL_CHANNEL_URL'
]
pubchannel
=
os
.
environ
[
'FSLCONDA_PUBLIC_CHANNEL_URL'
]
username
=
os
.
environ
.
get
(
'FSLCONDA_INTERNAL_CHANNEL_USERNAME'
,
None
)
password
=
os
.
environ
.
get
(
'FSLCONDA_INTERNAL_CHANNEL_PASSWORD'
,
None
)
if
username
is
not
None
:
intchannel
=
add_credentials
(
intchannel
,
username
,
password
)
if
internal
:
pkgchannels
=
[
intchannel
,
pubchannel
]
else
:
pkgchannels
=
[
pubchannel
]
...
...
Write
Preview
Markdown
is supported
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