Skip to content

Instantly share code, notes, and snippets.

@ustun
Last active March 29, 2022 17:29
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ustun/65a31adcb66a11cd1cbc5006fdb54681 to your computer and use it in GitHub Desktop.
Save ustun/65a31adcb66a11cd1cbc5006fdb54681 to your computer and use it in GitHub Desktop.
Running multiple GitLab CI runners

Running multiple GitLab CI runners as normal users

Option 1: Using system level service

  1. Install gitlab multi runner systemwide: https://docs.gitlab.com/runner/install/
  2. Register the runner as an unpriviledged user (paste the secret key in your repo's runners page). This should create your configuration config (toml) file. gitlab-runner register
  3. Register the service as root user by passing the path to the toml file and the user flag and the service name (needs to be unique per user or runner).

gitlab-runner install --config /home/myuser/.gitlab-runner/config.toml --user myuser --working-directory /home/myuser --service myuser_gitlabrunner

  1. As root, run service myuser_gitlabrunner start. The process should also start on boot (it should be in /etc/init/ folder or similar, depending on your distro.)

Option 2: Using a supervisor process like supervisord

  1. Install gitlab multi runner systemwide.
  2. Register the runner as unpriviledged user. This should create your configuration toml file. gitlab-runner register
  3. Run the process as normal user. No need to pass toml file or service name. Example supervisord script:
[program:myuser_runner]
command=gitlab-runner run
directory=/home/foo
user=foo
numprocs=1
  1. As root or as a user who can manage supervisord, run supervisorctl myuser_runner start. The process should also start on boot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment