Matrix variable value is overridden by project CI var
Issue
The default value for an environment variable is obtaining precedence over the env variable passed through matrix definition.
Explanation
Assuming the default value for APP via project CI variables is prod_app
Consider the following sample gitlab-ci.yaml file
stages:
- build
- deploy
build:
stage: build
script:
- bash script.sh build $APP
parallel:
matrix:
- APP: base_app
- APP: prod_app
when: manual
deploy:
stage: deploy
script:
- bash script.sh deploy $APP
when: manual
While the deploy job is expected to use the prod_app (the default), I expect two build jobs such that each of them receive corresponding value for APP variable. However, what I see is:
- two jobs are created with
APPvalue reflecting in the job name - However, upon execution the value
APPvar contains is the same for both jobs (and the value isprod_app, the project wide default value for defined as a CI var).
PS:
- The scenario described looks very simple because I wanted to show as simple an example as possible to reproduce. Our actual need is quite complex and we want the var precedence to be accurate because we rely on it heavily to pass vars around in CI jobs (and manual pipelines, etc).
- I have a suspicion that this has something to do with manual jobs only, but I have not actually tested what happens in the regular CI jobs.
Edited by Rahul Katragadda