[Buildroot] [PATCH 1/1] package/gitlab-runner: fix inconsistency of systemd and sysv daemons
Marcin Niestrój
m.niestroj at grinn-global.com
Mon Nov 7 16:58:37 UTC 2022
Marek Metelski <marek.metelski at grinn-global.com> writes:
> Copy default $DEAMON_ARGS from systemd service to sysv init script.
>
> Make GITLAB_RUNNER_USER home directory the same as default
> --work-directory (-d) flag.
>
> Run sysv daemon process using root user (remove -c option)
> This is needed to correctly access config files as specified.
> System access can still be limited with gitlab-runner `--user` flag.
>
> Use same $DAEMON_ARGS variable name so it can be overwritten in
> /etc/default/gitlab-runner environment file in both cases.
>
> Signed-off-by: Marek Metelski <marek.metelski at grinn-global.com>
Reviewed-by: Marcin Niestroj <m.niestroj at grinn-global.com>
> ---
> package/gitlab-runner/S95gitlab-runner | 6 +++---
> package/gitlab-runner/gitlab-runner.mk | 3 +--
> 2 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/package/gitlab-runner/S95gitlab-runner b/package/gitlab-runner/S95gitlab-runner
> index 2a50e7151a..739adf1783 100644
> --- a/package/gitlab-runner/S95gitlab-runner
> +++ b/package/gitlab-runner/S95gitlab-runner
> @@ -3,7 +3,7 @@
> DAEMON="gitlab-runner"
> PIDFILE="/var/run/$DAEMON.pid"
>
> -GITLAB_RUNNER_ARGS="run"
> +DAEMON_ARGS="run --syslog --user gitlab-runner -d /var/lib/gitlab-runner -c /etc/gitlab-runner/config.toml"
>
> # shellcheck source=/dev/null
> [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
> @@ -11,8 +11,8 @@ GITLAB_RUNNER_ARGS="run"
> 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
> + start-stop-daemon -S -q -m -b -p "$PIDFILE" -x "/usr/bin/$DAEMON" \
> + -- $DAEMON_ARGS
> status=$?
> if [ "$status" -eq 0 ]; then
> echo "OK"
> diff --git a/package/gitlab-runner/gitlab-runner.mk b/package/gitlab-runner/gitlab-runner.mk
> index fde776e631..9542275135 100644
> --- a/package/gitlab-runner/gitlab-runner.mk
> +++ b/package/gitlab-runner/gitlab-runner.mk
> @@ -12,9 +12,8 @@ GITLAB_RUNNER_LICENSE_FILES = LICENSE
> GITLAB_RUNNER_LDFLAGS = \
> -X gitlab.com/gitlab-org/gitlab-runner/common.VERSION=$(GITLAB_RUNNER_VERSION)
>
> -# Don't run gitlab runner as root.
> define GITLAB_RUNNER_USERS
> - gitlab-runner -1 gitlab-runner -1 * /var/run/dbus /bin/false - Gitlab Runner
> + gitlab-runner -1 gitlab-runner -1 * /var/lib/gitlab-runner /bin/false - Gitlab Runner
> endef
>
> define GITLAB_RUNNER_INSTALL_INIT_SYSV
--
Marcin Niestrój
More information about the buildroot
mailing list