Do not fail install if gitlab-runner service commands not available

What does this MR do?

gitlab-runner status uses https://github.com/kardianos/service and attempts to find the right command to manage the GitLab Runner service. On Linux systems, it falls back to running service from initscripts if systemctl or other service managers are not detected. However, in some environments, such as Fedora 43 containers, initscripts are not installed by default. As a result, the installation of the Runner fails in the post-install script.

To avoid this install failure, just skip the service management part of the post-install and pre-remove scripts if gitlab-runner status fails with executable file not found.

Why was this MR needed?

What's the best way to test this MR?

Attempt to install the RPMs inside the registry.fedoraproject.org/fedora-minimal:43 container.

You should see:

bash-5.3# rpm -i out/rpm/gitlab-runner-helper-images.rpm out/rpm/gitlab-runner_amd64.rpm
GitLab Runner: creating gitlab-runner...
Home directory skeleton not used
GitLab Runner: WARNING - Service management is not available on this system.
GitLab Runner: Neither 'systemctl' nor 'service' command found.
GitLab Runner: The runner binary has been installed, but automatic service setup is skipped.
GitLab Runner: You may need to manually configure the runner or install a service manager.
GitLab Runner: For systemd systems, install 'systemd'. For SysV init systems, install 'initscripts' or 'sysvinit-utils'.
INFO: Docker installation not found, skipping clear-docker-cache

What are the relevant issue numbers?

Relates to #39006 (closed)

Edited by Stan Hu

Merge request reports

Loading