I have created a scheduled pipeline and I’m injecting the following variable
<code>foo=bar
CANARY_DEPLOY=true
</code>
<code>foo=bar
CANARY_DEPLOY=true
</code>
foo=bar
CANARY_DEPLOY=true
I have a gitlab-ci.yaml
that includes gitlab-ci-common.yaml
<code># ...
include:
- project: 'path/devops/gitlab-pipeline'
ref: master
file: '/modules/deploy/no-canary.yml'
rules:
- if: '$CANARY_DEPLOY == "false"'
- project: 'path/devops/gitlab-pipeline'
ref: master
file: '/modules/deploy/gitlab-ci-common.yml'
rules:
- if: '$CANARY_DEPLOY == "true"'
</code>
<code># ...
include:
- project: 'path/devops/gitlab-pipeline'
ref: master
file: '/modules/deploy/no-canary.yml'
rules:
- if: '$CANARY_DEPLOY == "false"'
- project: 'path/devops/gitlab-pipeline'
ref: master
file: '/modules/deploy/gitlab-ci-common.yml'
rules:
- if: '$CANARY_DEPLOY == "true"'
</code>
# ...
include:
- project: 'path/devops/gitlab-pipeline'
ref: master
file: '/modules/deploy/no-canary.yml'
rules:
- if: '$CANARY_DEPLOY == "false"'
- project: 'path/devops/gitlab-pipeline'
ref: master
file: '/modules/deploy/gitlab-ci-common.yml'
rules:
- if: '$CANARY_DEPLOY == "true"'
Here’s my gitlab-ci-common.yaml
:
<code>deploy_production:
stage: test
environment: test
script:
- mvn test -Dfoo=$foo
</code>
<code>deploy_production:
stage: test
environment: test
script:
- mvn test -Dfoo=$foo
</code>
deploy_production:
stage: test
environment: test
script:
- mvn test -Dfoo=$foo
But $foo is not resolving to the passed value, i.e ‘bar’, and instead it is passed as a literal string ‘$foo’. I tried injecting it as -Dfoo=${foo} but no dice.
What could be causing this?