GitLab CI - run jobs only on master and tags
Today I wanted to create a CI job that runs only on master branch or tags. The following did not work:
job1: #defining -tags before the refs-section
...
only:
- tags
refs:
- master
job2: #the other way around
...
only:
refs:
- master
- tags
job3: #multiple only statements overwrite themselves
...
only:
refs:
- master
only:
- tags
In the end I found a workaround in replicating the job and switching out the only section:
job1:
...
only:
refs:
- master
job1_tags:
...
only:
- tags
Obviously this is not the most maintainable solution, especially for bigger job configurations.
Before creating a fully-fledged feature proposal: Is this possible and I did not get the syntax right?