Skip to content
Latchkey

How to Run a Job Manually with Input Variables in GitLab CI

A when:manual job waits for a human, and pre-filled variables let them choose what it does.

Mark a job when:manual so it only runs when someone clicks it, and expose tunable values as variables with descriptions so the run form pre-fills them.

A manual job with operator-supplied variables

Declare variables with description and value so GitLab shows them in the manual run dialog.

.gitlab-ci.yml
variables:
  TARGET_ENV:
    value: "staging"
    description: "Environment to deploy to"

deploy:
  stage: deploy
  when: manual
  script:
    - echo "Deploying to ${TARGET_ENV}"
    - ./deploy.sh "${TARGET_ENV}"

Notes

  • Variables with a description appear in the "Run pipeline" form and on manual job triggers.
  • Add allow_failure: false to make the manual job block the pipeline until it succeeds.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →