Lesson 5 of 9 · 23m
Deployment Gates and Approval Policy
Implement gates as explicit policy over artifact evidence, environment state, approvals, and timing rather than as ceremonial buttons.
A deployment gate is useful when it answers a question automation cannot answer alone. It is harmful when it exists because nobody trusts the pipeline. I have watched teams click approve for every release while production burned; the button was present, the control was absent. A real gate evaluates evidence, binds identity and time, and leaves an audit trail.
Gates should have inputs
Useful inputs include:
artifact provenance exact SHA, build number, signature
test evidence required checks passed on the same artifact
change risk database migration, auth change, infrastructure diff
environment health deploy window, active incident, dependency status
approval who approved, when, under which policy
rollback readiness previous artifact and migration compatibilityIf none of these are evaluated, the gate is theater.
Encode the policy, not just the pause
GitHub Environments can require reviewers and branches:
deploy-production:
runs-on: ubuntu-24.04
needs: release-candidate
environment:
name: production
url: https://app.example.internal
steps:
- run: ./deploy --artifact "${{ needs.release-candidate.outputs.digest }}"The environment protection rule is policy. The needs edge and digest output are evidence binding. You need both; otherwise someone can approve deployment of bits the tests never saw.
Approval is contextual authority
The right approver depends on risk. A copy change may need product review. A schema migration may need the database owner. An emergency security patch may use a smaller quorum with heightened audit. Encode those paths deliberately. Do not let one senior engineer become a human routing table for every decision.
Time gates and freeze windows
Time-based gates are legitimate when they encode operational reality: no deploys during a known migration window, no Friday high-risk releases for an understaffed team, delayed rollout after business-hours support ends. They become harmful when folklore replaces measurement. If the team cannot deploy safely on Friday because rollback is manual, fix rollback rather than worshipping the calendar.
Automatic gates beat vague meetings
Policy-as-code can reject unsigned artifacts, unapproved base branches, missing incident clearance, or a migration that lacks a backward-compatible expand phase:
cosign verify --key cosign.pub "$IMAGE"
test "$(jq -r .status evidence/tests.json)" = passed
test "$(jq -r .migrations_compatible evidence/schema.json)" = trueHumans should decide exceptions and risk acceptance, not repeatedly inspect evidence machines can validate.
Audit the bypass path
Every production system needs a break-glass path. It should be rare, loud, authenticated, and reviewed afterward. Record who bypassed which gate, why, and what failed afterward. If bypass is common, either the gate is badly calibrated or the release process is genuinely unsafe.
Field notes
- Bind approvals to artifact digest, not merely to a branch name that can move.
- Revalidate time-sensitive evidence; a test pass from nine days ago is stale evidence.
- Do not let the person who triggered an emergency change be its only approver unless policy explicitly accepts that risk.
- A gate nobody can explain becomes a bottleneck people route around.
Was this lesson helpful?