Skip to content

CI variables silently expanding variables

When using the CI Variables feature, dollar signs ($) appeared to get dropped, but they need double-dollar escaping.

Example:

TOKEN = 'A$B/C'

Expected value in CI runner:

echo $TOKEN
A$B/C

Actual value in CI runner:

echo $TOKEN
A/C

When testing some more, it appears that we can use TOKEN = 'A$CI_BUILD_ID/C' to get A807/C when CI_BUILD_ID is 807. And TOKEN = 'A$$B/C' will produce the expected A$B/C.

It would be nice if this feature is documented on the "Secret Variables" (<namespace>/<project>/variables) page.

In my case I pasted in a long token with apparently one or more dollar sign, and it appeared to work, except the authentication failed. It wasn't immediately obvious that a $v in there got expanded to (blank).

P.S. Nice work with the CI runners!