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
0974cee2
Commit
0974cee2
authored
Jan 12, 2021
by
Paul McCarthy
🚵
Browse files
RF: Explicitly set git username/email on git interactions
parent
8a77d05d
Changes
4
Show whitespace changes
Inline
Side-by-side
scripts/update_conda_recipe.py
View file @
0974cee2
...
...
@@ -13,7 +13,11 @@ import os
import
re
import
sys
from
fsl_ci_utils
import
tempdir
,
sprun
,
is_valid_project_version
from
fsl_ci_utils
import
(
USERNAME
,
EMAIL
,
tempdir
,
sprun
,
is_valid_project_version
)
from
fsl_ci_utils.conda
import
get_recipe_url
from
fsl_ci_utils.gitlab_api
import
(
http_request
,
lookup_project_id
,
...
...
@@ -120,6 +124,8 @@ def checkout_and_patch_recipe(url, branch, project_version):
with
tempdir
():
sprun
(
f
'git clone
{
url
}
recipe'
)
os
.
chdir
(
'recipe'
)
sprun
(
f
'git config user.name
{
USERNAME
}
'
)
sprun
(
f
'git config user.email
{
EMAIL
}
'
)
sprun
(
f
'git checkout -b
{
branch
}
master'
)
patch_recipe
(
'meta.yaml'
,
project_version
)
sprun
(
'git add meta.yaml'
)
...
...
utils/create_conda_recipe.py
View file @
0974cee2
...
...
@@ -17,7 +17,9 @@ from unittest import mock
import
jinja2
as
j2
from
fsl_ci_utils
import
(
indir
,
from
fsl_ci_utils
import
(
USERNAME
,
EMAIL
,
indir
,
tempdir
,
sprun
)
from
fsl_ci_utils.gitlab_api
import
(
project_exists
,
...
...
@@ -151,6 +153,8 @@ def commit_and_push_recipe_repository(recipe_dir,
else
:
msg
=
f
'MNT: Re-generated conda recipe for
{
project_path
}
'
sprun
(
f
'git config user.name
{
USERNAME
}
'
)
sprun
(
f
'git config user.email
{
EMAIL
}
'
)
sprun
(
f
'git checkout -B
{
branch
}
'
)
sprun
(
'git add *'
)
sprun
(
f
'git commit -m "
{
msg
}
"'
)
...
...
utils/fsl_ci_utils/__init__.py
View file @
0974cee2
...
...
@@ -14,6 +14,14 @@ import contextlib as ctxlib
import
subprocess
as
sp
USERNAME
=
'fsl-ci-rules'
"""Username to be used for all git interactions which require one. """
EMAIL
=
'fsl-ci-rules@git.fmrib.ox.ac.uk'
"""Password to be used for all git interactions which require one. """
def
fprint
(
*
args
,
**
kwargs
):
"""Print with flush=True. """
print
(
*
args
,
**
kwargs
,
flush
=
True
)
...
...
utils/fsl_ci_utils/gitlab_api.py
View file @
0974cee2
...
...
@@ -13,7 +13,9 @@ import functools as ft
import
urllib.parse
as
urlparse
import
urllib.request
as
urlrequest
from
fsl_ci_utils
import
is_valid_project_version
from
fsl_ci_utils
import
(
is_valid_project_version
,
USERNAME
,
EMAIL
)
VERBOSE
=
True
...
...
@@ -319,10 +321,12 @@ def update_file(project_path,
filename
=
urlparse
.
quote_plus
(
filename
)
url
=
f
'
{
server
}
/api/v4/projects/
{
pid
}
/repository/files/
{
filename
}
'
data
=
{
'file
name'
:
urlparse
.
quote_plus
(
filename
),
'file
_path'
:
urlparse
.
quote_plus
(
filename
),
'content'
:
contents
,
'branch'
:
branch
,
'commit_message'
:
message
'commit_message'
:
message
,
'author_name'
:
USERNAME
,
'author_email'
:
EMAIL
,
}
http_request
(
url
,
token
,
data
=
data
,
method
=
'PUT'
)
...
...
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