0

to be continuous is a set of advanced ready-to use templates for GitLab CI.

By default, every to be continuous template is considering master as the default production branch, and develop the default integration branch.

Can this default behavior be changed ? For instance, use main instead of master as the production branch ?

pismy
  • 733
  • 5
  • 12
  • Description changed. Does it sound clearer to you ? (anyway it's maybe tough to understand as long as you don't know [to be continuous](https://gitlab.com/Orange-OpenSource/tbc)) – pismy Jun 05 '21 at 11:32

1 Answers1

1

Sure you can.

Production and integration branches are variabilized using regular expressions:

variables:
  # default production ref name (pattern)
  PROD_REF: '/^master$/'
  # default integration ref name (pattern)
  INTEG_REF: '/^develop$/'

Simply overriding them shall change the behavior.

Example in your .gitlab-ci.yml file:

variables:
  # my production branch
  PROD_REF: '/^main$/'

You could even decide that every branch with format prod-xxx should be considered as production. Using a regex here helps:

variables:
  # my production branch(es)
  PROD_REF: '/^prod-.*$/'

/!\ $PROD_REF and $INTEG_REF are used to implement pattern matching in GitLab CI rules, so beware of this GitLab bug.

If you have a close look at the issue, the conclusion is that only 3 regex patterns are working:

pattern1: '/^abcde$/'
pattern5: '/^abcde.*/'
pattern6: '/^abcde/'

So make sure you're using one of those.

pismy
  • 733
  • 5
  • 12