Add suspend/resume support to GitLab

What does this MR do and why?

Summary

  • Adds a suspend_options field to the runner job response JSON, carrying suspend_on_success, suspend_on_failure, and environment_key from build.options
  • Introduces a pipeline creation chain path for suspend_options: RunWorkloadServiceCreatePipelineServiceChain::CommandSeed::ContextSeed::BuildJobDefinition
  • Extends WorkloadDefinition with 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_options reads from build.options and returns a hash
  • Response entity exposes suspend_options conditionally (only when present)

Write side (pipeline creation chain):

  • WorkloadDefinition carries suspend_on_success, suspend_on_failure, environment_key as attrs (not in to_job_hash — these are not CI YAML keys)
  • RunWorkloadService builds a suspend_options hash and passes it to CreatePipelineService
  • CreatePipelineService#extra_options whitelists suspend_options and puts it on Chain::Command
  • Chain::Seed passes command.suspend_options into Seed::Context
  • Seed::Build#attributes deep-merges { options: context.suspend_options } into the build, following the same pattern as inputs_attributes
  • Options land in JobDefinition (immutable) through the normal Processable.fabricate path

JSON schema:

  • build_metadata_config_options.json updated to allow suspend_on_success (boolean), suspend_on_failure (boolean), and environment_key (string)

Wire format

{
  "suspend_options": {
    "suspend_on_success": true,
    "suspend_on_failure": false,
    "environment_key": "runner-abc/acquisition-key=\"uuid-123\""
  }
}

References

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

Merge request reports

Loading