Public
Authored by Dan Thomson

Print Gitlab Project Variables as Environment Variables

Downloading and running this script locally can be done with either of the following commands:

$ curl -o gitlab-project-env.sh https://gitlab.triumf.ca/snippets/57/raw
$ chmod 755 ./gitlab-project-env.sh
$ ./gitlab-project-env.sh

or by piping the script directly into bash:

$ curl https://gitlab.triumf.ca/snippets/57/raw | bash -s myproject

You can use this script to pull your CI/CD variables out of a Gitlab project and print them as they would be printed to set the value in your bash shell (this probably only works with bash and zsh). If you eval the output from this script, you can automatically have those values exported into your environment. Eg:

$ eval $(gitlab-project-env.sh myproject)
Edited
gitlab-project-env.sh 2.89 KB
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment