Add support for pre-filled variables on the “Run job” form for manual jobs

Proposal

  • Add support for pre-filled variables on the “Run job” form for manual jobs (when: manual), similar to how pipeline-level variables and CI/CD inputs can be pre-configured for the New pipeline screen.

  • Currently, the manual job UI only allows free-form entry of key–value pairs. There is no way for pipeline authors to declare which variable keys should appear, provide descriptions, or restrict values, which leads to usability and safety issues for consumers of the pipeline.

  • When a job is configured with when: manual, users can click the job name and add manual job variables before running it. However:

    • The variable keys are not pre-populated in the UI.
    • Users must know and type the keys manually, which adds potential for errors to be introduced (typos, wrong names, missing variables).
    • Variables can not be documented like inputs: at the pipeline level with a description: string, or constrained to a set of options using options:
    • The mandatory definition of a variable cannot be enforced
  • This proposal is to introduce a way to declare job-level variables that render as pre-filled fields on the manual job “Run job” screen, analogous to pipeline-level prefilled variables and/or CI/CD inputs.

    • I can see two approaches to implementing this:

As variables: or inputs: on the job itself:

deploy_production:
  stage: deploy
  when: manual
  variables:
    DEPLOY_ENVIRONMENT:
      value: "production"
      options:
        - "staging"
        - "production"
        - "canary"
      description: "Deployment target. Choose from staging, production, or canary."
    RELEASE_VERSION:
      description: "Version/tag to deploy (for example, v1.2.3)."

or

Defining a job in a separate file and using the spec:inputs: syntax, and then using include: to merge the file into .gitlab-ci.yml:

spec:
  inputs:
    deploy-environment:
      type: string
      options: ["staging", "production", "canary"]
      default: "staging"
    release-version:
      type: string
      description: "Version/tag to deploy (for example, v1.2.3)."

---

deploy_production:
  stage: deploy
  when: manual
  # Map inputs to environment variables for the job
  variables:
    DEPLOY_ENVIRONMENT: $[[ inputs.deploy-environment ]]
    RELEASE_VERSION: $[[ inputs.release-version ]]
Assignee Loading
Time tracking Loading