Nested variable not interpreted in rules:changes gitlab-ci.yml
Summary
Assign a variable to another variable as shown below and use that variable in the rules:changes section in gitlab-ci.yml. I would expect that both job1 and job2 would run in this scenario but it seems that job2 doesn't
Steps to reproduce
Perform any change in the src directory and job2 will not run
Example Project
stages:
- build
job1:
image: alpine
stage: build
script:
- echo "job1"
rules:
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- "${project_path}/**/*"
job2:
image: alpine
stage: build
script:
- echo "job2"
rules:
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- "${project_path_nested}/**/*"
variables:
project_path: src
project_path_nested: $project_path
What is the current bug behavior?
job2 is not executed
What is the expected correct behavior?
Both job1 and job2 should be executed
Relevant logs and/or screenshots
Results of GitLab environment info
This issue occurs on GitLab.com (SaaS)
Possible fixes
Edited by Harsh Chouraria