The gitlab-runner systemd service from the official GitLab CI runner package performs a force shutdown when stopping the service by sending a TERM signal to the gitlab-runner process. This results in the immediate termination of all running build jobs. This behavior can be changed to a graceful shutdown by sending a QUIT signal as the service kill signal (KillSignal) instead.

By default systemd has a stop timeout of 2 minutes configured before a TERM signal is send to the to be stopped service . This means that build jobs that haven’t finished after 2 minutes are still be terminated. This stop timeout can be changed through the TimoutStopSec setting to something more sensible. The default gitlab-runner job timeout is 2 hours.

[Service]
KillSignal=SIGQUIT
TimeoutStopSec=2h