Improve runner support for maintenance mode

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Release notes

Problem to solve

When a GitLab instance enters maintenance mode, runners are prevented from reporting job execution results, including artifacts, back to the instance. This is expected behavior. However once exiting maintenance mode, those jobs are never reported back to GitLab. This leaves their job status and corresponding pipelines in an improper state. Maintenance mode documentation recommends restarting such pipelines, placing the burden on instance admins or dev teams to search for and restart them manually.

Admins can pause runners ahead of entering maintenance mode to reduce the number of jobs affected, however this does not fully mitigate the problem. In cases where instances have numerous runners, significant effort may be required to pause/unpause runners and track down jobs that complete while GitLab is in maintenance mode.

Use cases that are particularly affected by this behavior include scheduled pipelines, long-running jobs and continuous deployment.

Proposal

Runners should have the ability to identify when GitLab is in maintenance mode and pause artifact upload and job result updates until the instance exits maintenance mode.

Intended users

Edited by 🤖 GitLab Bot 🤖