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
How to Cache Maven Dependencies in GitLab CISpeed up GitLab CI Java builds by caching the Maven local repository (.m2) keyed on pom.xml so dependencies a…
How to Use rules:if for Branch Pipelines in GitLab CIControl when GitLab CI jobs run using rules:if expressions on predefined variables so a job runs only on the…