Build behaviour on non-default branch

Hi everyone,
the builds are triggered as expected when a change is pushed on a given branch.
What I cannot understand is how the gitlab-ci.yml is picked up.
I have a gitlab-ci.yml on the default branch (development) and another gitlab-ci.yml in a test branch.

I cannot find an explanation of this in the official documentation but it seems to me that only the gitlab-ci.yml on the default branch is considered, is it right? Is this the expected behaviour?
Do i have to delete the gitlab-ci.yml on the non-default branch?

Thanks in advance.
Cheers.

Hi,

you don’t need to delete gitlab-c.yml.
Without seeing your current YAML configuration, it is difficult to answer your question, why no pipeline was triggered.

General speaking, you want to have your gitlab-c.yml on all your branches. The only difference is that on some branches, different jobs are started.

Here is an example:

my-release-test:
   script:
      - exit 0
   rules:
      - if: $CI_COMMIT_BRANCH == "dev"

my-release-prod:
   script:
      - exit 0
   rules:
      - if: $CI_COMMIT_BRANCH == "main"

We have 2 jobs, but only one would be executed in main or dev.
This is nice to have because the test or build configuration will be the same, but the deployment may change.


You can find more examples here.