Skip to content

Secret variables with a dollar sign are not correctly set

Summary

When a secret variable contains a dollar sign $, the secret variable is not set correctly. It seems the content after the dollar sign is expended as it was a variable.

I did not see documentation stating that this is the expected behavior.

Steps to reproduce

  • Create a new repo
  • Setup the repo with a new secret variable: `TEST=hello$world``
  • Create a new .gitlab-ci.yml that contains
test:
  stage: test
    - env
  • Push random code to run the CI step
  • The content of the job will be TEST=hello

Example Project

None

What is the current bug behavior?

The content of the job will be TEST=hello

What is the expected correct behavior?

The content of the job sould be TEST=hello$world

Workaround

In the variable value, use a double dollar sign instead of a single: TEST=hello$$world instead of TEST=hello$world

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
Sorry, I don't have access to the Gitlab instance

Results of GitLab application Check

Expand for output related to the GitLab application check
Sorry, I don't have access to the Gitlab instance

Possible fixes

Edited by Elliot Rushton