How do you do a safe production deploy with approval in GitLab?
BeginnerProductionGitHub Actions and GitLab CI in Production
Answer
Make the production job manual, tied to a protected environment with an approval rule (for example two approvers from the release group, with committer approval prevented), and restrict it to protected branches or tags. Add resource_group: production, then run a smoke test job that triggers a rollback job on failure.
deploy-prod:
stage: deploy
script: ./deploy.sh production $CI_COMMIT_SHA
environment: production
resource_group: production
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
More on GitHub Actions and GitLab CI in Production
How do you organise reusable workflows for an organisation on GitHub?IntermediateHow do you reduce GitHub Actions minutes cost on private repos?IntermediateHow do you secure self-hosted runners?AdvancedHow do you design the GitHub Actions OIDC trust policy for AWS safely?AdvancedHow do you handle approvals and deployments across environments in GitHub Actions?IntermediateHow do you handle required checks when workflows use path filters or matrices?Advanced