fix: Ensure OpenRC is installed on Alpine Linux systems
What does this MR do?
Implements Alpine Linux packaging support by automatically installing OpenRC as a dependency when gitlab-runner is installed on Alpine Linux systems. This resolves the rc-service: executable file not found in $PATH error that occurs when the kardianos/service library attempts to manage the gitlab-runner service.
Why was this MR needed?
Fixes #39210 (closed). The gitlab-runner binary fails on Alpine Linux systems because OpenRC (which provides the rc-service command) is not included in Alpine's minimal base image. The kardianos/service library requires rc-service for service management, but users installing gitlab-runner on bare Alpine systems had to manually install OpenRC first.
This MR provides a clean, packaging-level solution that automatically ensures OpenRC is available when the gitlab-runner package is installed.
What's the best way to test this MR?
Validate the OpenRC installation logic without building packages:
# 1. Verify script syntax
sh -n packaging/scripts/postinst.apk
# 2. Test OpenRC installation in Alpine container
docker run --rm --privileged alpine:3.18 sh -c '
# Configure repositories (use HTTP to avoid local SSL issues)
echo "http://dl-cdn.alpinelinux.org/alpine/v3.18/main" > /etc/apk/repositories
echo "http://dl-cdn.alpinelinux.org/alpine/v3.18/community" >> /etc/apk/repositories
# Verify initial state
echo "=== Initial State ==="
command -v rc-service || echo "rc-service not found (expected)"
# Run postinst.apk OpenRC installation logic
echo -e "\n=== Installing OpenRC ==="
if ! command -v rc-service >/dev/null 2>&1; then
echo "Installing OpenRC as a dependency for gitlab-runner..."
apk add --no-cache openrc
fi
# Verify success
echo -e "\n=== Verification ==="
command -v rc-service && echo "SUCCESS: rc-service is available"
rc-service --help | head -3
'
Expected output: OpenRC installs successfully and rc-service command becomes available.
What are the relevant issue numbers?
Closes #39210 (closed)