What is the purpose of gitlab-runner run?

What is the difference between gitlab-runner start and gitlab-runner run?

The documentation is not very clear on this:

gitlab-runner run

This is main command that is executed when GitLab Runner is started as
a service. It reads all defined runners from config.toml and tries to
run all of them.

The command is executed and works until it receives a signal.

gitlab-runner start

This command starts the GitLab Runner service.

Furthermore, I’ve found that installing and registering a runner and then starting it as a service is sufficient to get it working. What, then is the purpose of the run command?

Thanks

Your quoted text answers the question:

So, to be more clear, typing gitlab-runner start, is pretty much the same as doing systemctl start gitlab-runner. Also, if you were to look at the file /etc/systemd/system/multi-user.target.wants/gitlab-runner.service you would see inside that it uses the run command.

All the runner configuration you have in /etc/gitlab-runner/config.toml is ran by using the run command. From the systemd service file:

ExecStart=/usr/bin/gitlab-runner "run" "--working-directory" "/home/gitlab-runner" "--config" "/etc/gitlab-runner/config.toml" "--service" "gitlab-runner" "--user" "gitlab-runner"

So, start is used to start the gitlab-runner service. The run command is what parses the configuration file to run the runners.

I see, thanks. So when I do gitlab-runner start I’m effectively also doing gitlab-runner run under the hood? I’m on a windows machine by the way, so I’m not sure if that changes anything in your explanation.

For Windows, gitlab-runner start would be pretty much the same as starting the Windows service for Gitlab Runner. So similar like it being started by systemd in Linux. The Windows service would be using the run command to read the config.toml file to start the runners (or run the runners perhaps I should say).

I think I understand. Thank you for your help.

1 Like