In Gitlab, need to pass a variable containing special character “$” to another stage via artifacts.
What I tried:
build:
stage: build
script:
- my_var='Admini$trator'
- echo "pass=$my_var" >> build.env
artifacts:
reports:
dotenv: build.env
test:
stage: test
needs:
- job: build
artifacts: true
script:
- echo $pass
The output is “Admini” instead of “Admini$trator”.
I also tried escaping with backslash “Admini$trator” but I get “Admini”.
What is the correct way to escape artifact variables?