Passing through non-defined CI variables assigns them a literal value instead of remaining empty
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
GitLab CI Variable with the same key and value is retained, so URL: $URL will have the value of $URL instead of it being empty.
Steps to reproduce
stages:
- test
test-with-vars:
stage: test
variables:
URL: $URL #same output
NOTHING_TO_EXPAND: $VARIABLE_DOES_NOT_EXIST
script:
- echo $URL
- echo $NOTHING_TO_EXPAND
Example Project
Pipeline output: - https://gitlab.com/gitlab-gold/faleksic-tests/public-group/ci-testing/-/jobs/1997281173
What is the current bug behavior?
Instead of the value being empty because $URL is empty, the value of URL becomes $URL.
What is the expected correct behavior?
If key and value name are the same and the value is empty it should remain empty.
Relevant logs and/or screenshots
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)
