I just created a new repository, with the exactly the same settings as a number of older ones.
Commits to this new repository did not trigger the pipeline …
After about an hour of fruitlessly trying to figure out the reason I just noticed the following in the .gitlab-ci.yml file:
only:
- master
For recent repositories that must read:
only:
- main
Hope this saves you some time!
1 Like
snim2
July 1, 2021, 9:43am
2
If main
or master
is your default branch, you can just use $CI_DEFAULT_BRANCH
, which is a bit more descriptive. The full list of predefined variables can be found here
2 Likes
@snim2 thanks, using that variable all .gitlab-ci.yml files are identical in all these repositories regardless of their age and usage of main or master
1 Like
Just reverted all .gitlab-ci.yml files appearantly $CI_DEFAULT_BRANCH does not work in “only:”.
snim2
July 1, 2021, 3:28pm
5
Really? It certainly works with rules
Yes really. When i put:
only:
in my .gitlab-ci.yml files no pipelinese were triggered. Once i reverted them to either:
only:
or:
only:
Depending on the repository being more recent (main) or older (master) the pipelines triggered on the commit once more.
snim2
July 2, 2021, 5:55pm
7
So, if you check your repository settings, is main
your default branch?
Depending on the age of the repository the default branch is set correctly on all of them.
For the older ones it is: master
For the more recent ones it is: main
snim2
July 5, 2021, 1:22pm
9
Is this on GitLab SASS? The CI_DEFAULT_BRANCH
variable has been available since 12.4, so if you are seeing that on SASS I’d suggest that it’s a bug…
Here’s a test repo with a:
This does look odd. Have you raised an issue ?
Yes, this is on GitLab SASS.
snim2
July 5, 2021, 2:38pm
11
Sounds like a good time for you to raise an issue!