Rules no longer expand variables inside quotes
Summary
Prior to GitLab 18.5, pipeline rules would expand variable references inside quotes, but now they don't.
Steps to reproduce
- Define a job like:
example-job: variables: FOO: some value BAR: some value rules: - if: $FOO == "$BAR" script: - echo "Hello world" - When the pipeline runs, it should include the job but doesn't.
- Change the condition to
$FOO == $BAR(no quotes). - When the pipeline runs, now it does include the job.
Here's another example, where the quotes are actually required:
example-job:
variables:
FILE_NAME: example.txt
FILE_PATH: path/to/$FILE_NAME
rules:
# This doesn't work
- if: $FILE_PATH == "path/to/$FILE_NAME"
# But this does
# - if: $FILE_PATH == "path/to/example.txt"
script:
- echo "Hello world"What is the current bug behavior?
When a rule references an unescaped variable inside quotes, the variable is not expanded.
What is the expected correct behavior?
The variable should be expanded.
Additional Context
This seems possibly related to !204549 (merged) in the 18.5 milestone.
Edited by 🤖 GitLab Bot 🤖