Prompt
How do I make my CI/CD pipeline require manual approvals before production?
Latest observation
To require manual approvals before production in CI/CD, the usual pattern is to add a gated deployment stage so the pipeline can build/test automatically, but pause before deploying to prod until an authorized person approves it.
Common ways to do it
1) Use your CI/CD platform’s built-in environment approvals
Most platforms support protected environments or approval gates:
- GitHub Actions: Use Environments with required reviewers
- GitLab CI/CD: Use manual jobs and protected environments
- Jenkins: Use an input step
- Azure DevOps: Use Environments with approvals/checks
- CircleCI / others: Use approval jobs or hold steps
2) Split pipeline into stages
Typical flow:
- Build
- Test
- Deploy to staging
- Manual approval
- Deploy to production
This keeps production deployment blocked until approval is granted.
3) Restrict who can approve
Only allow:
- release managers
- platform/DevOps team
- senior engineers
Also consider requiring:
- 2-person approval
- approval from a different team than the deployer
- approval only after successful staging deploy
Examples
GitHub Actions
Use an Environment named production and set required reviewers in repo settings.
jobs:
deploy-prod:
needs: test
runs-on: ubuntu-latest
environment: production
steps:
- run: ./deploy-prod.sh
Then in GitHub:
- Go to Settings → Environments → production
- Add Required reviewers
The job will pause until approved.
GitLab CI/CD
Use a manual job:
deploy_prod:
stage: deploy
script:
- ./deploy-prod.sh
when: manual
allow_failure: false
only:
- main
You can also use protected environments so only specific users can trigger it.
Jenkins
Add an approval step:
stage('Deploy to Production') {
steps {
input message: 'Approve production deployment?', ok: 'Deploy'
sh './deploy-prod.sh'
}
}
Azure DevOps
Configure:
- Environments
- Approvals and checks
- Add approvers for the production environment
Then reference that environment in your pipeline.
Best practices
- Require approval only for production, not every environment
- Make approvals happen after tests and staging
- Log who approved and when
- Add rollback steps
- Use a separate service account for deployment
- Require branch protection on
main/release - Consider change management integration if your org uses it
Recommended pipeline design
A solid setup is:
- Push to branch
- Automated build/test
- Auto-deploy to dev/staging
- Smoke tests
- Manual approval gate
- Production deploy
- Post-deploy verification
If you want, I can show you how to set this up specifically for GitHub Actions, GitLab, Jenkins, or Azure DevOps.