gitlabhq/gitlab-ci-runner — pull request #66 by gucki (2014-01-15 10:30:41+00:00)
Title: Make sure runners_registered is valid when no pid file exists

Fixes `service gitlab-ci-runner restart` falure due to missing reset of `RUNNERS_REGISTERED` in case no PID file exists.

buggy

root@xyz:~# service gitlab-ci-runner restart
Number of registered runners in PID file=1
Number of running runners=1
Trying to stop registered runners...OK
No ghost runners have been found.This is good.
Number of registered runners in PID file=1
Number of running runners=1
Error! GitLab CI runner(s) (gitlab-ci-runner) appear to be running already! Try stopping them first. Exiting.

root@xyz:~# service gitlab-ci-runner restart
Number of registered runners in PID file=0
Number of running runners=0
No runners have been found. Exiting.
Trying to stop registered runners...FAILED!
Couldn't stop registered runners as there is no record of such in /home/gitlab_ci_runner/gitlab-runners/gitlab-ci-runner/tmp/pids/runners.pid file.
No ghost runners have been found.This is good.
Number of registered runners in PID file=0
Number of running runners=0
Starting runner #1
SUCCESS: Started 1 GitLab CI runner(s).

fixed

root@xyz:/etc/init.d# service gitlab-ci-runner restart
Number of registered runners in PID file=1
Number of running runners=1
Trying to stop registered runners...OK
No ghost runners have been found.This is good.
Number of registered runners in PID file=0
Number of running runners=0
Starting runner #1
SUCCESS: Started 1 GitLab CI runner(s).