Disable expansion of file type variables when referenced in child pipelines
Summary
Since 15.7, file type variables should expand to the filename instead of the file content. However, in child pipelines, the file content is still expanded
Steps to reproduce
Triggering project
Setup
- Configure a
filetype variable$MAVEN_SETTINGSwith random string content (here<settings>test</settings>)
.gitlab-ci.yml
variables:
MAVEN_CLI_OPTS: >-
-s $MAVEN_SETTINGS
--batch-mode
-Pgitlab-cicd
build-job:
stage: build
script:
- echo "$MAVEN_SETTINGS"
- cat "$MAVEN_SETTINGS"
release:
stage: deploy
trigger:
project: triggered-project
The build job produces the expected output, expanding the file name
Triggered project
.gitlab-ci.yml
build-job:
stage: build
script:
- echo "$MAVEN_CLI_OPTS"
- cat "$MAVEN_CLI_OPTS"
Job log
$ echo "$MAVEN_CLI_OPTS"
-s <settings>test</settings> --batch-mode -Pgitlab-cicd
$ cat "$MAVEN_CLI_OPTS"
cat: invalid option -- ' '
What is the current bug behavior?
file type variable expands file content in child pipeline
What is the expected correct behavior?
file type variable expands file path in child pipeline
Output of checks
This bug happens on GitLab.com
Proposal
Look into Ci::Bridge#calculate_downstream_variables and you may see that we call ExpandVariables.expand in the sub-methods.
Here is the original MR that introduced this feature.
Edited by Furkan Ayhan