* [Buildroot] [PATCH 1/1] package/gitlab-runner: fix inconsistency of systemd and sysv daemons
@ 2022-11-07 9:16 Marek Metelski
2022-11-07 16:58 ` Marcin Niestrój
2022-11-22 21:50 ` Thomas Petazzoni via buildroot
0 siblings, 2 replies; 3+ messages in thread
From: Marek Metelski @ 2022-11-07 9:16 UTC (permalink / raw)
To: buildroot; +Cc: Marek Metelski, Romain Naour, Marcin Niestroj
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@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
--
2.20.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Buildroot] [PATCH 1/1] package/gitlab-runner: fix inconsistency of systemd and sysv daemons
2022-11-07 9:16 [Buildroot] [PATCH 1/1] package/gitlab-runner: fix inconsistency of systemd and sysv daemons Marek Metelski
@ 2022-11-07 16:58 ` Marcin Niestrój
2022-11-22 21:50 ` Thomas Petazzoni via buildroot
1 sibling, 0 replies; 3+ messages in thread
From: Marcin Niestrój @ 2022-11-07 16:58 UTC (permalink / raw)
To: Marek Metelski; +Cc: Romain Naour, buildroot
Marek Metelski <marek.metelski@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@grinn-global.com>
Reviewed-by: Marcin Niestroj <m.niestroj@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
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Buildroot] [PATCH 1/1] package/gitlab-runner: fix inconsistency of systemd and sysv daemons
2022-11-07 9:16 [Buildroot] [PATCH 1/1] package/gitlab-runner: fix inconsistency of systemd and sysv daemons Marek Metelski
2022-11-07 16:58 ` Marcin Niestrój
@ 2022-11-22 21:50 ` Thomas Petazzoni via buildroot
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-11-22 21:50 UTC (permalink / raw)
To: Marek Metelski; +Cc: Romain Naour, Marcin Niestroj, buildroot
On Mon, 7 Nov 2022 10:16:58 +0100
Marek Metelski <marek.metelski@grinn-global.com> wrote:
> 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@grinn-global.com>
> ---
> package/gitlab-runner/S95gitlab-runner | 6 +++---
> package/gitlab-runner/gitlab-runner.mk | 3 +--
> 2 files changed, 4 insertions(+), 5 deletions(-)
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-22 21:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-07 9:16 [Buildroot] [PATCH 1/1] package/gitlab-runner: fix inconsistency of systemd and sysv daemons Marek Metelski
2022-11-07 16:58 ` Marcin Niestrój
2022-11-22 21:50 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox