Commit 679a7222 authored by Emanuele Aina's avatar Emanuele Aina

gitlab-ci: Tag the Docker image as `latest` when running on master branch

Currently using the generated Docker images requires spelling out their full commit id.

The Docker tools default at looking for the `latest` tag when not specifying
one, and that's what we need to provide a stable pointer to the most current
image to be deployed.
Signed-off-by: Emanuele Aina's avatarEmanuele Aina <emanuele.aina@collabora.com>
parent 065e16ab
Pipeline #121606 failed with stages
in 4 minutes and 1 second
stages:
- build
- test
- deploy
- tag
unit-tests:
image: debian:buster
stage: test
......@@ -32,3 +38,18 @@ build-docker-image:
--push $CI_REGISTRY
--registry-config="{\"$CI_REGISTRY\":{\".*\":{\"security\":{\"basic\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}}}"
"${CI_PROJECT_DIR}"
tag-latest-docker-image:
stage: tag
image: buildah/buildah
variables:
AUTH: $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
IMAGE: ${CI_REGISTRY_IMAGE}/runtime
TAG_OLD: ${CI_COMMIT_SHA}
TAG_NEW: latest
script:
- echo Tagging ${IMAGE}:${TAG_OLD}"
- skopeo copy --src-creds "$AUTH" --dest-creds "$AUTH" docker://"${IMAGE}:${TAG_OLD}" docker://"${IMAGE}:${TAG_NEW}"
- echo Tagged ${IMAGE}:${TAG_NEW}"
only:
- master
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment