I am aware of the fact that one can run a GitLab pipeline only when a certain condition is satisfied, eg. only when the branch is master
or only when a Git Tag is created.
For example:
stages:
- greet
greet_job:
stage: greet
only:
- master
script:
- echo "Hello!"
This runs the greet_job
job only when the branch is called master
.
I would like to combine two conditions with a logical and, ie. I would like to run a pipeline, say, only when the branch is called master
and a new Git Tag has been created. Is that possible?
ADDED
Here I found a possible solution:
- greet
greet_job:
stage: greet
only:
refs:
- master
- tags
variables:
- $CI_COMMIT_BRANCH == "master"
script:
- echo "Hello!"