瀏覽代碼

package/gitlab-runner: fix inconsistency of systemd and sysv daemons

Copy default $DAEMON_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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Marek Metelski 2 年之前
父節點
當前提交
ef6c9da9d2
共有 2 個文件被更改,包括 4 次插入5 次删除
  1. 3 3
      package/gitlab-runner/S95gitlab-runner
  2. 1 2
      package/gitlab-runner/gitlab-runner.mk

+ 3 - 3
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"

+ 1 - 2
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