From 20234f18c759f5eda264e1761ac727c0e76538a1 Mon Sep 17 00:00:00 2001 From: Erik Martin-Dorel Date: Fri, 2 May 2025 19:39:57 +0200 Subject: [PATCH 1/2] Squashed 'external/docker-keeper/' changes from f0373f2..910ad33 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 910ad33 fix: Make flake8 happy (vs. E501 line too long) 202e83e feat: Interpolate `{vars[…]}, {matrix[…]}` in `context:, dockerfile:` git-subtree-dir: external/docker-keeper git-subtree-split: 910ad33f962faeb9e00122c52c6cc95e7aca7908 --- VERSION | 2 +- keeper.py | 26 ++++++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index c70613a..af88ba8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.10.14 +0.11.1 diff --git a/keeper.py b/keeper.py index 60664f5..baae31e 100755 --- a/keeper.py +++ b/keeper.py @@ -253,6 +253,11 @@ def get_commit(commit_api): % (naive_url_encode(repo), naive_url_encode(branch))) headers = None lambda_query = gitlab_lambda_query_sha1 + elif fetcher == 'gitlab.inria.fr': + url = ('https://%s/api/v4/projects/%s/repository/branches/%s' + % (fetcher, naive_url_encode(repo), naive_url_encode(branch))) + headers = None + lambda_query = gitlab_lambda_query_sha1 else: error("Error: do not support 'fetcher: %s'" % fetcher) return get_url(url, headers, None, lambda_query) @@ -363,6 +368,7 @@ def get_list_dict_dockerfile_matrix_tags_args(json, debug): args1 = json['args'] if 'args' in json else {} gvars = json['vars'] if 'vars' in json else {} # = global vars, interpolated in: + # - dockerfile # - args # - build.args # - build.tags @@ -370,11 +376,10 @@ def get_list_dict_dockerfile_matrix_tags_args(json, debug): for item in images: list_matrix = product_build_matrix(item['matrix']) if 'dockerfile' in item['build']: - dfile = check_trim_relative_path(item['build']['dockerfile']) + dfile_templ = check_trim_relative_path(item['build']['dockerfile']) else: - dfile = 'Dockerfile' - context = check_trim_relative_path(item['build']['context']) - path = '%s/%s' % (context, dfile) + dfile_templ = 'Dockerfile' + context_templ = check_trim_relative_path(item['build']['context']) raw_tags = item['build']['tags'] args2 = item['build']['args'] if 'args' in item['build'] else {} raw_args = merge_dict(args1, args2) @@ -454,6 +459,9 @@ def get_list_dict_dockerfile_matrix_tags_args(json, debug): if eval_if(script_cond, matrix, gvars): # otherwise skip the script item after_deploy_script.append(script_item) + dfile = eval_bashlike(dfile_templ, matrix, gvars) # NOT defaults + context = eval_bashlike(context_templ, matrix, gvars) # idem + path = '%s/%s' % (context, dfile) newitem = {"context": context, "dockerfile": dfile, "path": path, "matrix": matrix, "tags": tags, "args": args, @@ -1524,12 +1532,14 @@ def main(argv): # $ py.test bash_formatter.py def test_get_commit(): - github = {"fetcher": "github", "repo": "coq/coq", "branch": "v8.0"} - github_expected = "f7777da84893a182f566667426d13dd43f2ee45a" + github = {"fetcher": "github", "repo": "rocq-prover/rocq", + "branch": "v8.1"} + github_expected = "f7cdf553d983a79fe0fbb08403f6a55230016074" github_actual = get_commit(github) assert github_actual == github_expected - gitlab = {"fetcher": "gitlab", "repo": "coq/coq", "branch": "v8.0"} - gitlab_expected = "f7777da84893a182f566667426d13dd43f2ee45a" + gitlab = {"fetcher": "gitlab.inria.fr", "repo": "coq/coq", + "branch": "v8.1"} + gitlab_expected = "f7cdf553d983a79fe0fbb08403f6a55230016074" gitlab_actual = get_commit(gitlab) assert gitlab_actual == gitlab_expected From 59f232d6927ff47caed790f2685972fedfe9dfd7 Mon Sep 17 00:00:00 2001 From: Erik Martin-Dorel Date: Fri, 2 May 2025 19:40:29 +0200 Subject: [PATCH 2/2] fix: Also pin {rocq-core, rocq-runtime} This patch happens to be necessary for rocq/opam projects that depend on rocq-core (for example), and not on rocq-prover directly. See-also: https://github.com/rocq-community/gaia/pull/27#issuecomment-2847635130 --- rocq/stable/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rocq/stable/Dockerfile b/rocq/stable/Dockerfile index 88670c7..749328a 100644 --- a/rocq/stable/Dockerfile +++ b/rocq/stable/Dockerfile @@ -16,9 +16,8 @@ RUN set -x \ && opam update -y -u \ && opam pin add -n -k version rocq-stdlib ${ROCQ_VERSION} \ && opam pin add -n -k version rocq-prover ${ROCQ_VERSION} \ - # We need not pin rocq-core nor rocq-runtime - # as rocq-prover => "rocq-core" {= version} - # and rocq-core => "rocq-runtime" {= version} + && opam pin add -n -k version rocq-core ${ROCQ_VERSION} \ + && opam pin add -n -k version rocq-runtime ${ROCQ_VERSION} \ && opam pin add -n -k version coqide-server ${ROCQ_VERSION} \ # We don't install coq-core nor coq as they're transitional pkgs whose install time is negligible && opam install -y -v -j "${NJOBS}" rocq-prover coqide-server ${ROCQ_EXTRA_OPAM} \