Global environment variables for gitlab CI runner

TristanV picture TristanV · May 24, 2017 · Viewed 7.1k times · Source

I am working to set up a gitlab runner for multiple projects, and we want to be able to set up environment variables for all of the projects. I tried to set global variables in the .bashrc for both the gitlab-runner and root users but it did not recognize them during the CI script. What is the correct location to declare global environment variables?

Answer

DarkDust picture DarkDust · Nov 9, 2018

You can define environment variables to inject in the runner's config.toml file. See the advanced runner configuration documentation in the [[runners]] section.

There doesn't seem to be a way to specify environment variables in the GitLab UI just for a specific runner.