Two approvals for production, with a hotfix bypass
Hold every production deploy for two approvals from people other than the author, name who may approve, and let one on-call lead pass the rule once when a hotfix cannot wait.
The situation
shop ships web-production from main. Today a merge to main goes straight to production. You want every production deploy to have two approvals from people other than whoever made the change, from the Checkout team's leads and the SRE on-call, and you want the rule to give way for exactly one case: at 02:00 an outage fix cannot wait for a second reviewer, and one named person may let that one snapshot through, with a reason that is on the record.
Wardn has three pieces for this, and each does a different job:
- A guardrail with an Approval requirement says how many approvals production needs. The snapshot is stored and held, and an approval request opens.
- A duty says who may approve. Approving is
release:approve, held by team leads and by people you grant a role. It is not held by seniority, so an Admin cannot approve by default. - A bypass is the way through for one snapshot.
release:bypassis a separate duty held by fewer people, and everyone else asks.
| Who | Role in this recipe |
|---|---|
| Ravi, Checkout engineer | Makes the change. Can raise releases. Cannot approve his own. |
| Maya and Omar, Checkout team leads | Approve for the team's apps. |
| Priya, SRE on-call lead | Holds the bypass duty on production, and approves. |
| Wardn Owner | Creates the roles. Holds every duty, so they can approve too. |
You need at least three people who may approve besides the author, or two approvals can never be reached. Here that is Maya, Omar and Priya.
Settings
Who may approve
Maya and Omar already hold the approval duty on the Checkout team's deployments, as team leads. For the SRE on-call, make a role that holds the duty and grant it on the production environment.
Open Access › Roles and choose New role. Name it Production approver, start Blank, and under Where it is granted choose On a scope. Under Permissions tick release:read, release:approve and deployment:read, then Create role.
On the role's page choose Grant this role. Pick the person (Priya), choose Where: An environment, production, and optionally set Expires. Choose Grant role.
The person who grants a duty does not need to hold it, but a person below Contributor cannot use it. See Roles and grants.
Who may bypass
The bypass duty can be given away only by someone who holds it, so this is the Owner's step. Make a second role with release:bypass and grant it to Priya on production, and to nobody else.
BYPASS_ROLE=$(api -X POST "$WARDN_API_URL/api/v1/roles" -d '{
"name": "Production bypass",
"description": "Lets one snapshot through the rules that hold it on production, once",
"granted": "scope",
"permissions": ["release:read", "release:bypass", "deployment:read"]
}' | jq -r .id)
api -X POST "$WARDN_API_URL/api/v1/role-bindings" -d '{
"roleId": "'"$BYPASS_ROLE"'",
"scope": {"kind": "environment", "id": "'"$PRODUCTION_ENV_ID"'", "label": "production"},
"subject": {"kind": "member", "id": "'"$PRIYA_USER_ID"'"}
}'In the web app this is the same two steps as above with release:bypass ticked. Creating a role that holds release:bypass needs you to hold it: a role cannot hold more than its creator does.
Tell Wardn who pushed
A push is raised by whoever pushed, and GitHub names them by login. The person who pushed cannot approve it, so Wardn has to know who the login is. A push by a login nobody is linked to is held until it is linked.
api -X PUT "$WARDN_API_URL/api/v1/github/logins/ravi-shop" -d '{"userId": "'"$RAVI_USER_ID"'"}'Linking needs integration:manage, and is recorded in Activity. Link each person who pushes to a branch production tracks.
The guardrail
Open Guardrails › Rules and choose New guardrail. Name it Production needs two approvals, and set the owner team in the header chip.
Under Applies to, add a condition: Field class, Operator is, Value production. The chips below show how many deployments it reaches.
Under Governs, leave only Release ticked. It covers a promotion, a hotfix, an ad hoc promotion and a deploy; leaving Rollback off means going back in an incident does not wait for two people.
Under Requires, choose Add requirement › Approval, then Edit on its row, set Approvals to 2, and choose Done. The row reads "At least 2 approvals from a person".
Under Mode, choose Warn only, and Create guardrail.
Start in Warn only. It records what it would have held (the Rules list says "Would have blocked N this month") and holds nothing, so you can see its reach, and who it would have asked, before it slows anyone down. A warn-only rule opens no approval requests.
When the reach looks right, switch it to Enforce: open the guardrail, set Mode to Enforce and choose Save version 2. With the API, PUT /guardrails/$GUARDRAIL_ID with the same body, "mode": "enforce" and "expectedVersion": 1.
Once enforced, every deploy to a deployment of class production waits for two approvals, including a plain merge to main. Check the Covers chips before you enforce, and make sure at least three people can approve.
Check that it works
First ask the Evaluator, which runs the same check a real deploy runs and changes nothing. On Guardrails › Evaluator, pick web-production and Check; the verdict says the snapshot needs approvals, with "At least 2 approvals from a person" under Approvals. With the API:
api -X POST "$WARDN_API_URL/api/v1/policy-evaluations" -d '{"deploymentId": "'"$PRODUCTION_DEPLOYMENT_ID"'", "action": "promote"}' | jq '{state: .verdict.state, headline: .verdict.headline, ways}'Then do it for real. Ravi merges a change to main.
On Deployments › web-production › Snapshots, the new snapshot is stored and shown as held by the guardrail, and the deployment keeps running what it ran. Activity has approval.requested. Maya, Omar and Priya are told, and Slack posts the request if it is connected (see Slack).
Ravi opens Approvals › Releases and the request is there, but not under Waiting on me: he raised it. Its page says "You raised this request, so you cannot approve it."
Maya opens the request, reads What moves, and under Your decision chooses Approve. The request now shows one given, and the snapshot is still held: it needs two. As API:
api "$WARDN_API_URL/api/v1/approvals?state=open&decidable=true" | jq '.items[] | {id, needs: [.needs[].label], given: .counts.approvals}'
api -X POST "$WARDN_API_URL/api/v1/approvals/$APPROVAL_ID/decisions" -d '{"decision": "approve", "note": "Migration is backwards compatible"}'Omar approves. This is the last approval: Wardn judges the snapshot again as Ravi, and when nothing else holds it, releases it. web-production applies the snapshot, and the request shows Approved. A second approval from Maya answers 409 approval.already_decided, and Ravi's attempt answers 403 approval.requester_excluded.
The hotfix that cannot wait
It is 02:00. Checkout is failing, and the fix is merged. Maya approved from her phone, and Omar is asleep. The snapshot is held with one of two approvals.
Priya holds the bypass duty, so she could bypass directly. Ravi does not hold it, so he asks. There is no button for asking in the web app yet; use the API, from the snapshot and deployment of the request:
api -X POST "$WARDN_API_URL/api/v1/deployments/$PRODUCTION_DEPLOYMENT_ID/snapshots/$SNAPSHOT_ID/bypass-requests" -d '{
"reason": "INC-2041: checkout is returning 5xx. The fix is merged and Maya has approved; a second approver is not reachable."
}'The answer is the request in state open. Priya is told, and Approvals › Bypass requests shows it under Waiting on me.
Priya chooses Review. What it bypasses lists "At least 2 approvals from a person" with who set it, Still applies lists everything else that holds the snapshot (a freeze, the production branch rule) which the bypass does not skip, and The request has the reason. She chooses Approve bypass, adds "Agreed, on call for INC-2041", and confirms.
Wardn lets the snapshot through the guardrails once and applies it as Ravi. Activity has bypass.requested and guardrail.bypassed, with both names, the reason and the rules skipped. The next snapshot meets the two-approval rule again.
If Priya declines (she must say why), the snapshot stays held and Ravi sees her note. Omar can still approve when he wakes, and the request does not need to be redone. A bypass lifts only the rules that hold the snapshot: if a freeze also covered production, it would still hold, and Priya would see it under Still applies.
Ravi could also have raised the fix as a hotfix release with "breakglass": true, but that needs the bypass duty himself; see Releases.
Keep it honest
- Review the bypass list. Approvals › Bypass requests keeps Recent bypasses, and
guardrail.bypassedis in Activity with the reason. A bypass that happens weekly is a rule that does not fit. - Do not make approvers a bottleneck. When Maya is away, she can delegate her approvals to a colleague.
- An approval is for one snapshot. If another commit lands before the second approval, the first request closes as superseded and the new one starts from zero. Approve what is current.
- Conditions are notes. An approver can add a condition such as "pause after the canary wave", but it is recorded, not enforced. Give the wave a manual gate in the pipeline if you need it to stop.
Next
Approvals
Requests, who may approve and every way to decide.
Bypass requests
Direct and requested bypass, and what each skips.
Delegate approvals while away
Cover for an approver on leave.
Related: Guardrails, Roles and grants, Releases, Restore and rollback.
A pipeline with a QA stage and sign-off
Carry one snapshot from dev into QA on its own, hold it there until tests pass, it has soaked and a tester signs it off, then promote the same snapshot to production inside a weekday window.
Delegate approvals while you are away
Cover for a team lead on leave: pass the approval duty to a colleague for two weeks, see the first approval made under it with both names, and end it early.