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
a5352654
Commit
a5352654
authored
Feb 04, 2021
by
Paul McCarthy
🚵
Browse files
RF: Update recipe script can be called programmatically
parent
9e3b466d
Changes
3
Hide whitespace changes
Inline
Side-by-side
fsl_ci/scripts/update_conda_recipe.py
View file @
a5352654
...
...
@@ -206,45 +206,59 @@ def checkout_and_rerender_recipe(recipe,
sprun
(
f
'git push origin
{
branch
}
'
)
def
main
():
def
main
(
server
=
None
,
token
=
None
,
project_path
=
None
,
project_name
=
None
,
project_ver
=
None
):
"""Re-generates the conda recipe(s) associated with a FSL project. In
normal execution, all of the arguments are read from the environment.
:arg server: GitLab server url
:arg token: GitLab API access token
:arg project_path: GitLab project path
:arg project_name: Project name
:arg project_ver: New project tag
"""
if
server
is
None
:
server
=
os
.
environ
[
'CI_SERVER_URL'
]
if
token
is
None
:
token
=
os
.
environ
[
'FSL_CI_API_TOKEN'
]
if
project_path
is
None
:
project_path
=
os
.
environ
[
'CI_PROJECT_PATH'
]
if
project_name
is
None
:
project_name
=
os
.
environ
[
'CI_PROJECT_NAME'
]
if
project_ver
is
None
:
project_ver
=
os
.
environ
[
'CI_COMMIT_REF_NAME'
]
server
=
os
.
environ
[
'CI_SERVER_URL'
]
token
=
os
.
environ
[
'FSL_CI_API_TOKEN'
]
projpath
=
os
.
environ
[
'CI_PROJECT_PATH'
]
projname
=
os
.
environ
[
'CI_PROJECT_NAME'
]
projver
=
os
.
environ
[
'CI_COMMIT_REF_NAME'
]
skip
=
os
.
environ
.
get
(
'FSLCONDA_SKIP_RECIPE_UPDATE'
,
None
)
skip
=
os
.
environ
.
get
(
'FSLCONDA_SKIP_RECIPE_UPDATE'
,
None
)
mrmsg
=
tw
.
dedent
(
f
"""
This merge request was triggered by a new tag being added to
the
{
projpath
}
project.
the
{
proj
ect_
path
}
project.
Accepting this merge request will cause the conda recipe for
{
projpath
}
to be updated to version
{
projver
}
.
{
proj
ect_
path
}
to be updated to version
{
proj
ect_
ver
}
.
If all goes well, a new conda package will built for
{
projpath
}
(
{
projver
}
), and will be uploaded to
{
proj
ect_
path
}
(
{
proj
ect_
ver
}
), and will be uploaded to
the FSL production conda channel.
(MR automatically generated by fsl-ci-rules running on the
{
projpath
}
repository).
{
proj
ect_
path
}
repository).
"""
).
strip
()
recipes
=
get_recipe_urls
(
projname
,
server
)
recipes
=
get_recipe_urls
(
proj
ect_
name
,
server
)
if
skip
is
not
None
:
print
(
'FSLCONDA_SKIP_RECIPE_UPDATE is set - aborting recipe update.'
)
sys
.
exit
(
0
)
if
not
is_valid_project_version
(
projver
):
print
(
f
'
{
projver
}
is not a valid FSL version - aborting!'
)
if
not
is_valid_project_version
(
proj
ect_
ver
):
print
(
f
'
{
proj
ect_
ver
}
is not a valid FSL version - aborting!'
)
sys
.
exit
(
1
)
for
recipe
in
recipes
:
recipe
[
'id'
]
=
lookup_project_id
(
recipe
[
'path'
],
server
,
token
)
branch
=
gen_branch_name
(
f
'rel/
{
projver
}
'
,
branch
=
gen_branch_name
(
f
'rel/
{
proj
ect_
ver
}
'
,
recipe
[
'path'
],
server
,
token
)
...
...
@@ -257,8 +271,8 @@ def main():
checkout_and_rerender_recipe
(
recipe
,
branch
,
projpath
,
projver
,
proj
ect_
path
,
proj
ect_
ver
,
server
,
token
)
...
...
fsl_ci/templates/meta.yaml.cuda.template
View file @
a5352654
...
...
@@ -22,7 +22,7 @@ requirements:
- fsl-base >={{ fslbaseversion }}
{%- if dependencies -%}
{%- for dep, depver in dependencies %}
- {{ dep }}
>=
{{ depver }}
- {{ dep }} {{ depver }}
{%- endfor -%}
{%- endif %}
build:
...
...
fsl_ci/templates/meta.yaml.other.template
View file @
a5352654
...
...
@@ -13,7 +13,7 @@ requirements:
{%- if dependencies %}
run:
{%- for dep, depver in dependencies %}
- {{ dep }}
>=
{{ depver }}
- {{ dep }} {{ depver }}
{%- endfor -%}
{%- endif %}
build:
...
...
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