I would like to build docker image on master branch only when release tag is set. This is my .gitlab.ci
:
build:
rules:
- if: '$CI_COMMIT_TAG != null && $CI_COMMIT_REF_NAME == "master"'
script:
- echo "Building $IMAGE:${CI_COMMIT_TAG}"
This does not work, I merged to master and release tag, but the build job did not even start.
I also tried with only
section:
build:
only:
- master
- tags
script:
- echo "Building $IMAGE:${CI_COMMIT_TAG}"
This run everytime, even when CI_COMMIT_TAG
does not exists. Is there a way, how to force to run job only if CI_COMMIT_TAG
exists on master
branch?