CI: Change the push policy of the docker images

If we are in a fork of the project, we would like to be able
to overwrite the `:latest` tag if the registry from any branch
so we won't have to manually overwrite the image tag in the
build/test jobs in the .gitlab-ci.yml file
This commit is contained in:
Jordan Petridis 2018-11-12 15:22:18 +02:00
parent 345afee677
commit 8fbce56d69
No known key found for this signature in database
GPG key ID: 902CC06D159744F5

View file

@ -40,9 +40,17 @@ test manifest:
- docker build --pull -f ${DOCKERFILE} -t ${REF} ${CONTEXT_DIR}
- docker image tag ${REF} ${LATEST}
# Push the images
# If we are in a fork, push the image to the reigstry regardless the branch
- |
if [ "$CI_COMMIT_REF_NAME" = "master" ]; then
if [ "$CI_PROJECT_NAMESPACE" != "gstreamer" ]; then
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
docker push ${REF}
docker push ${LATEST}
fi
# Push the images to the upstream registry
- |
if [ "$CI_COMMIT_REF_NAME" = "master" && "$CI_PROJECT_NAMESPACE" = "gstreamer" ]; then
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
docker push ${REF}
docker push ${LATEST}