Incorrect variables priority for child pipeline
Summary
Global level YAML-defined variables have higher priority over job-level YAML-defined variables in child pipelines
For the child pipeline variables, priority described here doesn't work - https://docs.gitlab.com/ee/ci/variables/README.html#priority-of-environment-variables
Steps to reproduce
GitLab Enterprise Edition 13.4.3-ee
- Create .gitlab-ci.yml
variables:
VARIABLE: "rewrite me"
stages:
- test
- generate
test:
stage: test
variables:
VARIABLE: "new value"
script:
- echo $VARIABLE
child:
stage: generate
trigger:
include:
- local: child-pipeline.yml
strategy: depend
- Create a child pipeline with the following content: child-pipeline.yml
variables:
VARIABLE: "rewrite me"
test:
variables:
VARIABLE: "new value"
script:
- echo $VARIABLE
What is the current bug behavior?
Parent and child pipelines have different behavior.
For the child pipeline variables, priority described here doesn't work - https://docs.gitlab.com/ee/ci/variables/README.html#priority-of-environment-variables
What is the expected correct behavior?
Child pipeline job-level variables should have higher priority than global-level variables https://docs.gitlab.com/ee/ci/variables/README.html#priority-of-environment-variables
We should see for child pipeline in log
$ echo $VARIABLE
new value
instead of
$ echo $VARIABLE
rewrite me
Relevant logs and/or screenshots
Parent
Running on runner-sygnzh1a-project-10947-concurrent-0 via runner-sygnzh1a-main-h1c2-1603900200-3d5bb3be...
Getting source from Git repository
00:01
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/ce/publication-services/nds/poc/gitlab-test/.git/
Created fresh repository.
Checking out 49db4740 as vitalii-test...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:00
$ echo $VARIABLE
new value
Child
Running on runner-g9sqy6oz-project-10947-concurrent-0 via runner-g9sqy6oz-main-h1b2-1603899270-61189446...
Getting source from Git repository
00:01
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/ce/publication-services/nds/poc/gitlab-test/.git/
Created fresh repository.
Checking out 49db4740 as vitalii-test...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:00
$ echo $VARIABLE
rewrite me