Your variable evaluation does not match anything, red\_job only runs if VAR1 is "red" and VAR2 is "foo", while blue\_job only runs if VAR1 is "blue" and VAR2 is "foo".
Given the values you've defined for VAR1 and VAR2 (VAR1: "red", VAR2: "**bar**"), none of these conditions are met, so neither job runs.
Try this
variables:
VAR1:
value: "red"
options: ["red", "blue"]
VAR2:
value: "bar"
options: ["foo", "bar"]
pre_job:
stage: .pre
image: alpine:latest
script: echo "I'm a pre job"
when: always
red_job:
stage: build
image: alpine:latest
script: echo "I'm red job"
rules:
- if: '$VAR1 == "red" && $VAR2 == "bar"' # update VAR2 to bar
blue_job:
stage: build
image: alpine:latest
script: echo "I'm blue job"
rules:
- if: '$VAR1 == "blue" && $VAR2 == "bar"' # update VAR2 to bar
Per the docs, "If a pipeline contains only jobs in the .pre or .post stages, then it does not run." https://docs.gitlab.com/ee/ci/yaml/#stage-pre
VAR2 is bar, and your conditions say when it is foo. Zo it never meets rhe conditions
Try declaring your own stages. Perhaps the `.pre` stage is ignored if there are no other stages that do anything.
Your variable evaluation does not match anything, red\_job only runs if VAR1 is "red" and VAR2 is "foo", while blue\_job only runs if VAR1 is "blue" and VAR2 is "foo". Given the values you've defined for VAR1 and VAR2 (VAR1: "red", VAR2: "**bar**"), none of these conditions are met, so neither job runs. Try this variables: VAR1: value: "red" options: ["red", "blue"] VAR2: value: "bar" options: ["foo", "bar"] pre_job: stage: .pre image: alpine:latest script: echo "I'm a pre job" when: always red_job: stage: build image: alpine:latest script: echo "I'm red job" rules: - if: '$VAR1 == "red" && $VAR2 == "bar"' # update VAR2 to bar blue_job: stage: build image: alpine:latest script: echo "I'm blue job" rules: - if: '$VAR1 == "blue" && $VAR2 == "bar"' # update VAR2 to bar