eb671037fb
We rely on config.toml to be created manually during first boot as setup stage. Even with an empty config.toml file, the gitlab-runner needs gitlab registration token to register to a gitlab server. Use the 14.5.1 release since 14.5.2 and 14.6.0 triggers a build error [1] due a patch for GO < 1.17. (helpers/patches/issue_28732/syscall.go:11:2: undefined: syscall.Issue28732Fix) Tested: https://gitlab.com/kubu93/buildroot/-/pipelines/442604876 [1] https://gitlab.com/gitlab-org/gitlab-runner/-/issues/28766 Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Romain Naour <romain.naour@smile.fr> Cc: Jérémy Rosen <jeremy.rosen@smile.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
65 lines
1.1 KiB
Bash
65 lines
1.1 KiB
Bash
#!/bin/sh
|
|
|
|
DAEMON="gitlab-runner"
|
|
PIDFILE="/var/run/$DAEMON.pid"
|
|
|
|
GITLAB_RUNNER_ARGS="run"
|
|
|
|
# shellcheck source=/dev/null
|
|
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
|
|
|
start() {
|
|
printf 'Starting %s: ' "$DAEMON"
|
|
# shellcheck disable=SC2086 # we need the word splitting
|
|
start-stop-daemon -S -q -m -b -p "$PIDFILE" -c "$DAEMON:$DAEMON" -x "/usr/bin/$DAEMON" \
|
|
-- $GITLAB_RUNNER_ARGS
|
|
status=$?
|
|
if [ "$status" -eq 0 ]; then
|
|
echo "OK"
|
|
else
|
|
echo "FAIL"
|
|
fi
|
|
return "$status"
|
|
}
|
|
|
|
stop() {
|
|
printf 'Stopping %s: ' "$DAEMON"
|
|
start-stop-daemon -K -q -p "$PIDFILE" -u "$DAEMON"
|
|
status=$?
|
|
if [ "$status" -eq 0 ]; then
|
|
echo "OK"
|
|
else
|
|
echo "FAIL"
|
|
fi
|
|
return "$status"
|
|
}
|
|
|
|
restart() {
|
|
stop
|
|
sleep 1
|
|
start
|
|
}
|
|
|
|
reload() {
|
|
printf 'Reloading %s: ' "$DAEMON"
|
|
start-stop-daemon -K -s HUP -q -p "$PIDFILE" -u "$DAEMON"
|
|
status=$?
|
|
if [ "$status" -eq 0 ]; then
|
|
echo "OK"
|
|
else
|
|
echo "FAIL"
|
|
fi
|
|
return "$status"
|
|
}
|
|
|
|
case "$1" in
|
|
start|stop|restart)
|
|
"$1";;
|
|
reload)
|
|
# Restart, since there is no true "reload" feature.
|
|
restart;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|reload}"
|
|
exit 1
|
|
esac
|