From 6e3c5ccac77714be70c0dc52c5210c7cda8fe40f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 21 Feb 2023 17:48:50 +0000 Subject: [PATCH] containers: publish to 'latest' tag instead of 'master' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Historically we use the CI_COMMIT_REF_SLUG for the docker tag, which is the branch name. This meant that when testing container builds from non-default tags/branches we didn't pollute the primary published content. When we switched to use merge requests for triggering CI in: commit 7a7402d259db6e75b2a6fbb1523b42a2d18fabfa Author: Daniel P. Berrangé Date: Thu Feb 10 17:43:56 2022 +0000 gitlab: switch to trigger jobs against the merge request by default we stopped publishing containers for anything except a push to the default branch. As such there's no reason to use CI_COMMIT_REF_SLUG, we can just use a fixed tag name. The docker default is to use ':latest', so adopt that instead of ':master'. Signed-off-by: Daniel P. Berrangé --- .gitlab-ci.yml | 4 ++-- containers/black/README.rst | 2 +- containers/cargo-fmt/README.rst | 2 +- containers/clang-format/README.rst | 2 +- containers/flake8/README.rst | 2 +- containers/go-fmt/README.rst | 2 +- lcitool/gitlab.py | 6 +++--- tests/data/manifest/out/ci/gitlab/build-templates.yml | 2 +- tests/data/manifest/out/ci/gitlab/sanity-checks.yml | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 619dcd5f..86cc68b9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,11 +42,11 @@ stages: - docker info - docker login registry.gitlab.com -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} script: - - docker build --tag ${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_REF_SLUG} containers/${NAME} + - docker build --tag ${CI_REGISTRY_IMAGE}/${NAME}:latest containers/${NAME} - if test "${CI_PIPELINE_SOURCE}" = "push" && test "${CI_COMMIT_REF_NAME}" = "${CI_DEFAULT_BRANCH}"; then - docker push ${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_REF_SLUG}; + docker push ${CI_REGISTRY_IMAGE}/${NAME}:latest; fi after_script: - docker logout diff --git a/containers/black/README.rst b/containers/black/README.rst index 2de2d0d6..61d6d20d 100644 --- a/containers/black/README.rst +++ b/containers/black/README.rst @@ -18,7 +18,7 @@ or adding the following snippet to ``.gitlab-ci.yml`` black: stage: sanity_checks - image: registry.gitlab.com/libvirt/libvirt-ci/black:master + image: registry.gitlab.com/libvirt/libvirt-ci/black:latest needs: [] script: - /black diff --git a/containers/cargo-fmt/README.rst b/containers/cargo-fmt/README.rst index 9bffeb16..c2ca8020 100644 --- a/containers/cargo-fmt/README.rst +++ b/containers/cargo-fmt/README.rst @@ -18,7 +18,7 @@ or adding the following snippet to ``.gitlab-ci.yml`` cargo-fmt: stage: sanity_checks - image: registry.gitlab.com/libvirt/libvirt-ci/cargo-fmt:master + image: registry.gitlab.com/libvirt/libvirt-ci/cargo-fmt:latest needs: [] script: - /cargo-fmt diff --git a/containers/clang-format/README.rst b/containers/clang-format/README.rst index 8f20ddb9..88daf17b 100644 --- a/containers/clang-format/README.rst +++ b/containers/clang-format/README.rst @@ -18,7 +18,7 @@ or adding the following snippet to ``.gitlab-ci.yml`` clang-format: stage: sanity_checks - image: registry.gitlab.com/libvirt/libvirt-ci/clang-format:master + image: registry.gitlab.com/libvirt/libvirt-ci/clang-format:latest needs: [] script: - /clang-format diff --git a/containers/flake8/README.rst b/containers/flake8/README.rst index d4b4461c..22a62567 100644 --- a/containers/flake8/README.rst +++ b/containers/flake8/README.rst @@ -18,7 +18,7 @@ or adding the following snippet to ``.gitlab-ci.yml`` flake8: stage: sanity_checks - image: registry.gitlab.com/libvirt/libvirt-ci/flake8:master + image: registry.gitlab.com/libvirt/libvirt-ci/flake8:latest needs: [] script: - /flake8 diff --git a/containers/go-fmt/README.rst b/containers/go-fmt/README.rst index 0af69981..132c776b 100644 --- a/containers/go-fmt/README.rst +++ b/containers/go-fmt/README.rst @@ -10,7 +10,7 @@ the following snippet to ``.gitlab-ci.yml`` go-fmt: stage: prebuild - image: registry.gitlab.com/libvirt/libvirt-ci/go-fmt:master + image: registry.gitlab.com/libvirt/libvirt-ci/go-fmt:latest script: - /go-fmt artifacts: diff --git a/lcitool/gitlab.py b/lcitool/gitlab.py index ccc0b540..1b34572b 100644 --- a/lcitool/gitlab.py +++ b/lcitool/gitlab.py @@ -306,7 +306,7 @@ def cirrus_template(cidir): f""" .cirrus_build_job: stage: builds - image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:master + image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:latest interruptible: true needs: [] script: @@ -371,7 +371,7 @@ def check_dco_job(): check-dco: stage: sanity_checks needs: [] - image: registry.gitlab.com/libvirt/libvirt-ci/check-dco:master + image: registry.gitlab.com/libvirt/libvirt-ci/check-dco:latest interruptible: true script: - /check-dco "$RUN_UPSTREAM_NAMESPACE" @@ -394,7 +394,7 @@ def code_fmt_template(): """ .code_format: stage: sanity_checks - image: registry.gitlab.com/libvirt/libvirt-ci/$NAME:master + image: registry.gitlab.com/libvirt/libvirt-ci/$NAME:latest interruptible: true needs: [] script: diff --git a/tests/data/manifest/out/ci/gitlab/build-templates.yml b/tests/data/manifest/out/ci/gitlab/build-templates.yml index 5d6d0088..377c0559 100644 --- a/tests/data/manifest/out/ci/gitlab/build-templates.yml +++ b/tests/data/manifest/out/ci/gitlab/build-templates.yml @@ -228,7 +228,7 @@ .cirrus_build_job: stage: builds - image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:master + image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:latest interruptible: true needs: [] script: diff --git a/tests/data/manifest/out/ci/gitlab/sanity-checks.yml b/tests/data/manifest/out/ci/gitlab/sanity-checks.yml index 00edbce0..b26d4b12 100644 --- a/tests/data/manifest/out/ci/gitlab/sanity-checks.yml +++ b/tests/data/manifest/out/ci/gitlab/sanity-checks.yml @@ -1,7 +1,7 @@ check-dco: stage: sanity_checks needs: [] - image: registry.gitlab.com/libvirt/libvirt-ci/check-dco:master + image: registry.gitlab.com/libvirt/libvirt-ci/check-dco:latest interruptible: true script: - /check-dco "$RUN_UPSTREAM_NAMESPACE" @@ -22,7 +22,7 @@ check-dco: .code_format: stage: sanity_checks - image: registry.gitlab.com/libvirt/libvirt-ci/$NAME:master + image: registry.gitlab.com/libvirt/libvirt-ci/$NAME:latest interruptible: true needs: [] script: