Skip to content

Commit

Permalink
containers: publish to 'latest' tag instead of 'master'
Browse files Browse the repository at this point in the history
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 7a7402d
  Author: Daniel P. Berrangé <[email protected]>
  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é <[email protected]>
  • Loading branch information
berrange committed Feb 22, 2023
1 parent fd0b464 commit 6e3c5cc
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion containers/black/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion containers/cargo-fmt/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion containers/clang-format/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion containers/flake8/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion containers/go-fmt/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions lcitool/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/data/manifest/out/ci/gitlab/build-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/data/manifest/out/ci/gitlab/sanity-checks.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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:
Expand Down

0 comments on commit 6e3c5cc

Please sign in to comment.