Add suspend/resume support to GitLab
What does this MR do and why?
Summary
- Adds a
suspend_optionsfield to the runner job response JSON, carryingsuspend_on_success,suspend_on_failure, andenvironment_keyfrombuild.options - Introduces a pipeline creation chain path for
suspend_options:RunWorkloadService→CreatePipelineService→Chain::Command→Seed::Context→Seed::Build→JobDefinition - Extends
WorkloadDefinitionwith suspension attrs so workloads can request environment suspension programmatically
Problem
Suspension triggers and the resume key were previously carried as CI variables (CI_SUSPEND_ON_SUCCESS, CI_SUSPEND_ON_FAILURE, CI_SUSPENDABLE_ENVIRONMENT_RESUME_KEY). Per the suspendable environments blueprint, these are internal job plumbing — not user-visible, not overridable by group/project settings, and not subject to CI variable inheritance. They belong in build.options, set by the pipeline creation chain.
Solution
Read side (presenter + entity):
BuildRunnerPresenter#suspend_optionsreads frombuild.optionsand returns a hashResponseentity exposessuspend_optionsconditionally (only when present)
Write side (pipeline creation chain):
WorkloadDefinitioncarriessuspend_on_success,suspend_on_failure,environment_keyas attrs (not into_job_hash— these are not CI YAML keys)RunWorkloadServicebuilds asuspend_optionshash and passes it toCreatePipelineServiceCreatePipelineService#extra_optionswhitelistssuspend_optionsand puts it onChain::CommandChain::Seedpassescommand.suspend_optionsintoSeed::ContextSeed::Build#attributesdeep-merges{ options: context.suspend_options }into the build, following the same pattern asinputs_attributes- Options land in
JobDefinition(immutable) through the normalProcessable.fabricatepath
JSON schema:
build_metadata_config_options.jsonupdated to allowsuspend_on_success(boolean),suspend_on_failure(boolean), andenvironment_key(string)
Wire format
{
"suspend_options": {
"suspend_on_success": true,
"suspend_on_failure": false,
"environment_key": "runner-abc/acquisition-key=\"uuid-123\""
}
}References
- Epic: Resumable Jobs for CI and Agent Sessions (gitlab-org#21159)
- Blueprint: Blueprint - Resumable Jobs for CI and Agent Ses... (#593314)
Screenshots or screen recordings
N.A.
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Vishal Tak