GitLab CI/CD is replacing file variable content
Summary
When I create a file variable on a project's CI/CD settings,
GitLab is replacing any $foo
string inside the file with the value of foo
variable.
Steps to reproduce
Open a project's CI/CD settings page and create the following variable:
- Name:
my_php_file
- Type:
File
Variable value:
<?php
trait FooConfig
{
protected static $foo;
}
Create the .gitlab-ci.yml
file on the project repository:
test:
script: cat $my_php_file
Example Project
https://gitlab.com/adarlan/file-variable-bug
What is the current bug behavior?
GitLab-CI is replacing the $foo
string inside the file with the value of foo
variable.
So the cat
output is:
<?php
trait FooConfig
{
protected static ;
}
What is the expected correct behavior?
GitLab-CI should not replace anything inside the file. The file content is supposed to be static.
So the cat
output should be:
<?php
trait FooConfig
{
protected static $foo;
}
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:env:info
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)