gitlab-runner service not starting
gitlab-runner service not starting with gitlab-runner start
- macOS 10.12.6
-
gitlab-runner10.8.0
$ which gitlab-runner
/usr/local/bin/gitlab-runner
$ gitlab-runner -v
Version: 10.8.0
Git revision: 079aad9e
Git branch:
GO version: go1.8.7
Built: 2018-05-22T03:23:18+00:00
OS/Arch: darwin/amd64
$ gitlab-runner --debug status
Runtime platform arch=amd64 os=darwin revision=079aad9e version=10.8.0
gitlab-runner: Service is not running.
$ gitlab-runner --debug start
Runtime platform arch=amd64 os=darwin revision=079aad9e version=10.8.0
$ gitlab-runner --debug status
Runtime platform arch=amd64 os=darwin revision=079aad9e version=10.8.0
gitlab-runner: Service is not running.
gitlab-runner run seems to work fine.
Solution
Looking at the service, the exit code is 78 which doesn't give us much info besides knowing it is encountering an error and it isn't running,
$ launchctl list | grep gitlab-runner
- 78 gitlab-runner
We can find the error by going opening the Console app -> system.log -> search gitlab-runner
Jun 8 03:26:34 eric-macbook com.apple.xpc.launchd[1] (gitlab-runner[89470]): Service setup event to handle failure and will not launch until it fires.
Jun 8 03:29:29 eric-macbook com.apple.xpc.launchd[1] (gitlab-runner): This service is defined to be constantly running and is inherently inefficient.
Jun 8 03:29:29 eric-macbook com.apple.xpc.launchd[1] (gitlab-runner[89850]): Could not find and/or execute program specified by service: 2: No such file or directory: /usr/local/bin/gitlab-ci-multi-runner
Jun 8 03:29:29 eric-macbook com.apple.xpc.launchd[1] (gitlab-runner[89850]): Service setup event to handle failure and will not launch until it fires.
Jun 8 03:31:50 eric-macbook com.apple.xpc.launchd[1] (com.apple.xpc.launchd.domain.system): Could not read path: path = /Library/LaunchDaemons/gitlab-runner.plist, error = 2: No such file or directory
It looks like the problem is that the registered service is trying to start /usr/local/bin/gitlab-ci-multi-runner (old runner executable) instead of /usr/local/bin/gitlab-runner.
Completely remove the outdated service,
$ launchctl remove gitlab-runner
$ launchctl list | grep gitlab-runner
# Found plist via https://stackoverflow.com/a/28907800/796832
$ rm /Users/eric/Library/LaunchAgents/gitlab-runner.plist
Install and run the new service,
$ gitlab-runner install
$ gitlab-runner start
$ gitlab-runner status
gitlab-runner: Service is running!!
Cause
My guess is that I got into this situation because the update docs don't take into account the breaking change upgrade from gitlab-ci-multi-runner to gitlab-runner gitlab-runner upgrade in place of gitlab-ci-multi-runner and then switching to gitlab-runner later on to standardize on the new way.