Skip to content

Commit 35e285a

Browse files
committed
Merge commit '92a1c3796f69c560bc2e348dde7fdb5ac0ca4420'
* commit '92a1c3796f69c560bc2e348dde7fdb5ac0ca4420': Squashed 'external/docker-keeper/' changes from 3c2782c..910ad33
2 parents f368898 + 92a1c37 commit 35e285a

File tree

3 files changed

+36
-13
lines changed

3 files changed

+36
-13
lines changed

external/docker-keeper/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ options:
4747
subcommands:
4848
{generate-config,write-artifacts}
4949
generate-config Print a GitLab CI YAML config to standard output. This
50-
requires files: {generated/build_data_chosen.json,
51-
generated/remote_tags_to_rm.json}
50+
requires files: - generated/build_data_chosen.json -
51+
generated/remote_tags_to_rm.json -
52+
generated/propagate.json
5253
write-artifacts Generate artifacts in the 'generated' directory. This
5354
requires having file 'images.yml' in the current
5455
working directory.
@@ -106,8 +107,11 @@ options:
106107
```
107108
usage: keeper.py generate-config [-h]
108109
109-
Print a GitLab CI YAML config to standard output. This requires files:
110-
{generated/build_data_chosen.json, generated/remote_tags_to_rm.json}
110+
Print a GitLab CI YAML config to standard output.
111+
This requires files:
112+
- generated/build_data_chosen.json
113+
- generated/remote_tags_to_rm.json
114+
- generated/propagate.json
111115
112116
options:
113117
-h, --help show this help message and exit

external/docker-keeper/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.10.14
1+
0.11.1

external/docker-keeper/keeper.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,11 @@ def get_commit(commit_api):
253253
% (naive_url_encode(repo), naive_url_encode(branch)))
254254
headers = None
255255
lambda_query = gitlab_lambda_query_sha1
256+
elif fetcher == 'gitlab.inria.fr':
257+
url = ('https://%s/api/v4/projects/%s/repository/branches/%s'
258+
% (fetcher, naive_url_encode(repo), naive_url_encode(branch)))
259+
headers = None
260+
lambda_query = gitlab_lambda_query_sha1
256261
else:
257262
error("Error: do not support 'fetcher: %s'" % fetcher)
258263
return get_url(url, headers, None, lambda_query)
@@ -363,18 +368,18 @@ def get_list_dict_dockerfile_matrix_tags_args(json, debug):
363368
args1 = json['args'] if 'args' in json else {}
364369
gvars = json['vars'] if 'vars' in json else {}
365370
# = global vars, interpolated in:
371+
# - dockerfile
366372
# - args
367373
# - build.args
368374
# - build.tags
369375
# - build.after_deploy_export
370376
for item in images:
371377
list_matrix = product_build_matrix(item['matrix'])
372378
if 'dockerfile' in item['build']:
373-
dfile = check_trim_relative_path(item['build']['dockerfile'])
379+
dfile_templ = check_trim_relative_path(item['build']['dockerfile'])
374380
else:
375-
dfile = 'Dockerfile'
376-
context = check_trim_relative_path(item['build']['context'])
377-
path = '%s/%s' % (context, dfile)
381+
dfile_templ = 'Dockerfile'
382+
context_templ = check_trim_relative_path(item['build']['context'])
378383
raw_tags = item['build']['tags']
379384
args2 = item['build']['args'] if 'args' in item['build'] else {}
380385
raw_args = merge_dict(args1, args2)
@@ -454,6 +459,9 @@ def get_list_dict_dockerfile_matrix_tags_args(json, debug):
454459
if eval_if(script_cond, matrix, gvars):
455460
# otherwise skip the script item
456461
after_deploy_script.append(script_item)
462+
dfile = eval_bashlike(dfile_templ, matrix, gvars) # NOT defaults
463+
context = eval_bashlike(context_templ, matrix, gvars) # idem
464+
path = '%s/%s' % (context, dfile)
457465
newitem = {"context": context, "dockerfile": dfile,
458466
"path": path,
459467
"matrix": matrix, "tags": tags, "args": args,
@@ -1524,12 +1532,14 @@ def main(argv):
15241532
# $ py.test bash_formatter.py
15251533

15261534
def test_get_commit():
1527-
github = {"fetcher": "github", "repo": "coq/coq", "branch": "v8.0"}
1528-
github_expected = "f7777da84893a182f566667426d13dd43f2ee45a"
1535+
github = {"fetcher": "github", "repo": "rocq-prover/rocq",
1536+
"branch": "v8.1"}
1537+
github_expected = "f7cdf553d983a79fe0fbb08403f6a55230016074"
15291538
github_actual = get_commit(github)
15301539
assert github_actual == github_expected
1531-
gitlab = {"fetcher": "gitlab", "repo": "coq/coq", "branch": "v8.0"}
1532-
gitlab_expected = "f7777da84893a182f566667426d13dd43f2ee45a"
1540+
gitlab = {"fetcher": "gitlab.inria.fr", "repo": "coq/coq",
1541+
"branch": "v8.1"}
1542+
gitlab_expected = "f7cdf553d983a79fe0fbb08403f6a55230016074"
15331543
gitlab_actual = get_commit(gitlab)
15341544
assert gitlab_actual == gitlab_expected
15351545

@@ -1621,6 +1631,15 @@ def test_subset_list():
16211631
assert not subset_list(l2, l0)
16221632

16231633

1634+
def test_subset_comma_list():
1635+
s1 = '8.19'
1636+
s2 = '8.18,8.19,8.20,dev'
1637+
s3 = '8.4'
1638+
s4 = '8.40,dev'
1639+
assert subset_comma_list(s1, s2)
1640+
assert not subset_comma_list(s3, s4)
1641+
1642+
16241643
def test_equalize_args():
16251644
assert (equalize_args({"VAR1": "value1", "VAR2": "value2"}) ==
16261645
['VAR1=value1', 'VAR2=value2'])

0 commit comments

Comments
 (0)