Build on one branch and manual build on branches with particular mask

Hi all!
Need you help…
Have branches like:

  • BBB
  • a
  • b
  • sister/R1
  • sister/R2

Need to start pipeline on the BBB branch and manula start for the branches like ‘sister/R%’

How to implement it

Thanks in advance for your help

Hi @arooff
please see Keyword reference for the .gitlab-ci.yml file | GitLab especially the rules keyword. You can define conditions based on branch name using Predefined variables reference | GitLab CI_COMMIT_BRANCH variable

thanks for the awesome information.

Hi @balonik
Thanks a lot for your information…I’ve made what I wanted…but there are another requirements…
Say…for the BBB branch pipeline should start each time commit executed - it is ok
If I made a new branch from BBB with required mask say sister/R5 the pipeline should start…but after that each next commit does not execute pipeline and requires manual action…

Hope explanation is clear

Question: how to implement it? What the approach to have??
Thanks in advance for any help or solution provided

You can use regex as well. Something like this will apply to all branches starting with sister

- if: $CI_COMMIT_BRANCH =~ /^sister.*/

more about expressions can he found here

That is clear…but I need pipeline start automatically only when branch (syster/R…) is created. Each next commit to a new branch (sister/R…) should not lead to automatic pipeline execution …only manual

How to do it???

There is no event for creating a branch and any pipeline won’t start if you just create a branch.

If you mean something like “on a first commit to a branch”, there is no built-in functionality and you have to figure out if it is first commit via API calls.

Hi again!

Try to explain …for example I have in GITLAB branch sister/R41…and there is a .gitlab-ci.yml file with the following:

stage: build
- echo “Building process has started at :” $(date ‘+%d/%m/%Y %T’)
#- bash scripts/
- echo “Building process has finished at :” $(date ‘+%d/%m/%Y %T’)
- if: ‘$CI_COMMIT_BRANCH =~ /^sister/R[0-9]+$/’
when: manual
allow_failure: true

So…if I made a new branch sister/R42 in GITLAB from sister/R41 branch I’ve got such situation:

So pipeline was initiated after new branch creation but according to the rules it went to manual action…
It is a little bit different that you mentioned in your last comment

What I need…I need say after branch creation that pipeline starts and does its job…Next commits should lead to manual confirmation

Hope my explanation is clear