when trying to use a secret variable with a value containing dollar sign on gitlab-ci secret variables it's not got variable value correctly.
-
This is discussed in depth over here: https://gitlab.com/gitlab-org/gitlab-foss/-/issues/27436 – MOnsDaR Oct 19 '22 at 08:16
2 Answers
the solution is to set the dollar sign twice, for example, if your variable value is 123$567
put it like this: 123$$567

- 1,126
- 13
- 18
While escaping $
(with $$
) is one way, but GitLab 15.7 (December 2022) adds another option:
Support the
$
character in CI/CD variablesSupport the
$
character in CI/CD variablesPreviously, using the
$
character in a CI/CD variable always indicated the start of a reference another variable, which GitLab then tried to expand.
As a result, you could not have a value with a$
as part of the string unless it was escaped, which can be confusing.In this release, we are introducing a new setting for project, group, and instance CI/CD variables.
You can now toggle whether or not GitLab interprets the CI/CD variable as a raw string, or treats a
$
as the start of another variable that should be expanded.See Documentation and Issue.

- 1,262,500
- 529
- 4,410
- 5,250