How to Add a Manual Approval Job to a Deploy in CircleCI
A workflow job with type: approval halts the pipeline; the deploy job that lists it under requires runs only after someone approves in the UI.
Insert an approval placeholder job into the workflow and make the deploy job require it, so the run waits for a click before proceeding.
Steps
- Define a job entry with
type: approvalin the workflow. - List that job in the deploy job
requires. - Keep build and test jobs ahead of the approval gate.
- Approve in the CircleCI UI to release the deploy.
Config
.circleci/config.yml
version: 2.1
workflows:
release:
jobs:
- build
- test:
requires: [build]
- hold:
type: approval
requires: [test]
- deploy:
requires: [hold]Gotchas
- The approval job runs no steps; it exists purely as a gate in the workflow graph.
- Anyone with write access can approve, so pair it with a restricted context for real protection.
Related guides
How to Gate a Production Deploy With Approval and a Restricted Context in CircleCIProtect a CircleCI production deploy with both a manual approval job and a context restricted to a security g…
How to Use a Context for Production Deploy Secrets in CircleCIInject production deploy secrets into a CircleCI job with a context instead of project env vars, sharing cred…