Skip to content

Disable syslogging by default for systemd systems

What does this MR do?

Disable syslogging by default for systemd systems

Why was this MR needed?

Otherwise we would get duplicate log entries in journald.

What's the best way to test this MR?

make runner-bin-linux

#
# Docker images don't have a init system preinstalled.
#

# The following command verifies the default (true)
$ docker run -it -v $PWD/out/binaries/:/opt/ ubuntu:18.04 bash -c '/opt/gitlab-runner-linux-amd64 install --user=root && grep syslog /etc/init.d/gitlab-runner'
Runtime platform                                    arch=amd64 os=linux pid=9 revision=04d11637 version=13.3.0~beta.276.g04d11637
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
    --exec /opt/gitlab-runner-linux-amd64 --  "run" "--working-directory" "/" "--config" "/etc/gitlab-runner/config.toml" "--service" "gitlab-runner" "--syslog" "--user" "root"

# Verify that a systemd system wouldn't have `--syslog` in the config
# https://github.com/ayufan/golang-kardianos-service/blob/master/service_systemd_linux.go#L17
$ docker run -it -v $PWD/out/binaries/:/opt/ ubuntu:18.04 bash -c 'mkdir /run/systemd/system; /opt/gitlab-runner-linux-amd64 install --user=root; grep syslog /etc/systemd/system/gitlab-runner.service'
Runtime platform                                    arch=amd64 os=linux pid=9 revision=04d11637 version=13.3.0~beta.276.g04d11637
FATAL: Failed to install gitlab-runner: "systemctl" failed: exec: "systemctl": executable file not found in $PATH,
After=syslog.target network.target

What are the relevant issue numbers?

Fixes #3351 (closed).

Merge request reports