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:

  1. two jobs are created with APP value reflecting in the job name
  2. However, upon execution the value APP var contains is the same for both jobs (and the value is prod_app, the project wide default value for defined as a CI var).

PS:

  1. 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).
  2. 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