Gitlab-CI keyword `rules:changes` cannot evaluate nested variables
Summary
Gitlab-CI does not seem to evaluate nested variables with depth > 1 in the rules:changes
keyword.
Steps to reproduce
- Declare a CI with a job
- Add one CI/CD variable based on other CI/CD variables
- add
rules:changes
conditions based on the indirect CI/CD variable - The condition is not met when the file is modified
Example Project
I've shown the bug in this project
In here, we can observe that job_explicit
and job_implicit_level_1
were triggered:
# job_explicit
# [...]
rules:
- changes:
- "foo"
# job_implicit_level_1
# [...]
rules:
- changes:
- "$DIRECT_VARIABLE"
Where DIRECT_VARIABLE
is a variable assigned to a string directly (foo
), but job_implicit_level_2
is not triggered, although its value should also be foo
# job_implicit_level_2
# [...]
rules:
- changes:
- "$INDIRECT_VARIABLE"
(The only difference is that INDIRECT_VARIABLE
is assigned to DIRECT_VARIABLE
, which is thena assigned to foo
.
If I run the CI manually (and all 3 jobs run), we can see that all 3 jobs can output both of the variables in their script
What is the current bug behavior?
rules:changes
does not evaluate correctly variables that contain other variables.
What is the expected correct behavior?
rules:changes
should evaluate variables even if they are defined based on other variables.
Output of checks
This happens on gitlab.com. and hosted instances
Results of GitLab environment info
This result also happens on hosted instances (I'm using 13.9.3 (ea359c58edb))