I'd like to trigger a pipeline depending on the branch being pushed. The code at present:
gitlab-ci.yml
variables:
myvariables....
stages:
- pp
credentials:
stage: pp
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
variables:
VAR1: ${V_A}
VAR2: ${VB_A}
- if: '$CI_COMMIT_BRANCH == "develop"'
variables:
VAR1: ${V_B}
VAR2: ${VB_B}
The flint parsing seems fine (so syntactically seems fine), however the correct pipeline is not triggered depending on the branch (so develop/master). Is this the correct usage of rules?
Use this syntax to apply rules to your whole pipeline (in your .gitlab-ci.yml
file):
workflow:
rules:
- if: $CI_COMMIT_BRANCH == "master"
variables:
VAR1: ${V_A}
VAR2: ${VB_A}
- if: $CI_COMMIT_BRANCH == "develop"
variables:
VAR1: ${V_B}
VAR2: ${VB_B}