mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
registry: Change the way in which images are tagged
Previously we tried using the git commit ref as a UID for the images. This does not work though cause multiple jobs that rebuild the image can be triggered and override the same image tag. Instead use the CI_JOB_ID to provide better semantics wrt naming conflicts. Additionally add the date as part of the tag to better indicate the age of the image. Gitlab WEBGUI doens't indicate the age in a good way nor makes it easy to short the images.
This commit is contained in:
parent
bc2bd98a75
commit
5fe97b9f1c
1 changed files with 4 additions and 3 deletions
|
@ -32,8 +32,9 @@ test manifest:
|
|||
DOCKER_DRIVER: "overlay2"
|
||||
GIT_STRATEGY: fetch
|
||||
script:
|
||||
- export DATE=$(date +"%Y-%m-%d")
|
||||
- export IMAGE="${CI_REGISTRY_IMAGE}/${ARCH}/${TAG}"
|
||||
- export REF="${IMAGE}:${CI_COMMIT_SHA}"
|
||||
- export UID="${IMAGE}:${DATE}-${CI_JOB_ID}"
|
||||
- export LATEST="${IMAGE}:latest"
|
||||
|
||||
- docker build --pull -f ${DOCKERFILE} -t ${LATEST} ${CONTEXT_DIR}
|
||||
|
@ -49,10 +50,10 @@ test manifest:
|
|||
- |
|
||||
if [ "$CI_COMMIT_REF_NAME" = "master" -a "$CI_PROJECT_NAMESPACE" = "gstreamer" ]; then
|
||||
# Tag the image with the git ref
|
||||
docker image tag ${LATEST} ${REF}
|
||||
docker image tag ${LATEST} ${UID}
|
||||
# Push the tags
|
||||
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||
docker push ${REF}
|
||||
docker push ${UID}
|
||||
docker push ${LATEST}
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue