Verified Commit 8fbce56d authored by Jordan Petridіs's avatar Jordan Petridіs 🌱
Browse files

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
parent 345afee6
...@@ -40,9 +40,17 @@ test manifest: ...@@ -40,9 +40,17 @@ test manifest:
- docker build --pull -f ${DOCKERFILE} -t ${REF} ${CONTEXT_DIR} - docker build --pull -f ${DOCKERFILE} -t ${REF} ${CONTEXT_DIR}
- docker image tag ${REF} ${LATEST} - 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 login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
docker push ${REF} docker push ${REF}
docker push ${LATEST} docker push ${LATEST}
......
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