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.

The situation

shop has one app, web, that runs in three places: dev, qa and production. Today people argue in chat about whether a build is ready for production. You want the answer to be a fact on the screen: a change that lands in dev goes to qa by itself, stays there until its tests pass, it has run healthy for an hour and a tester who did not write it signs it off, and only that exact snapshot may then go to production, on a weekday between 09:00 and 16:00.

A pipeline does this. Each environment is a stage. The qa stage has qualification rules (tests, soak, sign-off) that give every snapshot there a verdict. The route from qa to production requires that verdict, so the production stage will not take a snapshot that has not qualified. Nothing is rendered again on the way: the snapshot that dev built is the one production gets (Pipelines and promotion).

What this recipe relies on, and what it does not

Everything here is applied: stage rules, qualification, sign-off, auto-promotion and promotion by hand. Two parts are not: the pipeline's History tab does not record these trips yet, so use the deployments' Snapshots tabs and Activity to follow them; and what a stage does when a snapshot is rejected or qualified (roll back, notify a channel) is stored and not carried out. The recipe uses no approval rule: a stage's approval rule does not open an approval request by itself yet (Stage rules).

What you need first

ObjectSetting
Environments dev, qa, productionCreated with the classes development, qa and production, each with a cluster (Environments).
App webFrom Deploy your first app, in the repository example/shop on main.
Deployment web-devOn dev, arrival branch, tracking main.
Deployments web-qa and web-prodOn qa and production, arrival request, so nothing changes them except a promotion. Each holds exactly the app web.
A test suite for webSee Tests. It must be one a run on web-qa can use.
PeopleYou, the author of the change, who hold release:raise on the deployments. A tester, riley, who will sign off.
api() { curl -fsS -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' "$@"; }

mkdep() { # name, environment id, arrival, branch (only for arrival branch)
  jq -n --arg name "$1" --arg app "$APP_ID" --arg env "$2" --arg arrival "$3" --arg branch "${4:-}" \
    '{name: $name, apps: [{appId: $app}], targetKind: "environment", environmentId: $env, namespace: "shop", arrival: $arrival}
     + (if $branch != "" then {branch: $branch} else {} end)' \
    | api -X POST "$WARDN_API_URL/api/v1/deployments" -d @- | jq -r .id
}
DEV_DEP=$(mkdep web-dev "$DEV_ENV" branch main)
QA_DEP=$(mkdep web-qa "$QA_ENV" request)
PROD_DEP=$(mkdep web-prod "$PROD_ENV" request)

A deployment on an environment lands on every cluster in it (Environments).

Settings

Let a tester sign off

Sign-off is a duty: only people designated for it can sign, not by seniority. The Owner holds it; nobody else does until you grant it. Make a role that holds it and give it to the tester on the qa environment. The role needs to read the deployments and snapshots to find the work.

Under Access › Roles choose New role. Name it QA sign-off, choose On a scope under Where it is granted, and tick deployment:read, snapshot:read and snapshot:signoff. Open the role, choose Grant this role, pick riley under Who gets it, Where An environment and qa, then Grant role (Roles and grants).

The pipeline

Three stages and two routes. The dev stage has no rules, so a snapshot qualifies there as soon as it runs. The qa stage arrives by auto-promote and carries three qualification rules. The prod stage arrives by request and has one rule, a deploy window. Both routes use the default gate, qualified.

Open Pipelines and choose New pipeline. Under Start from choose Blank, which gives a dev stage. Give it the Name shop, pick the Owner team, add web under Apps, and choose Create pipeline. The graph opens on version 1.

In the graph choose Add a stage. In the dialog enter the Stage name QA and pick the qa Environment (the menu lists environments no stage uses yet); the stage is added after the one you started from and joined to it by a main route. Do it again for prod and the production environment. Open each stage in the side panel and set How a snapshot enters: Auto-promote for QA, By request for prod. Choose Save version (the button names the number) when the line reads dev → QA → prod.

Open the QA stage with the pencil. Under Qualification choose Add rule three times. Type test, Rule "Smoke tests pass". Type soak, Rule "Healthy for an hour", Hours healthy 1. Type signoff, Rule "QA sign-off", How many 1. Choose Save version.

Open the prod stage. Under When choose Add window, give it the Rule "Weekday office hours", tick Mon to Thu, and set From 09:00 and To 16:00. Choose Save version.

SettingWhy this value
qa auto-promoteA snapshot that qualifies in dev is copied into web-qa with no one acting, and waits if a guardrail or freeze holds it (Auto-promotion).
Qualification rules in qaThey judge a snapshot that already runs in qa, so they never stop it arriving. They decide whether it may leave.
signoff count 1One person. The author of the snapshot cannot be that person unless the rule sets notAuthor to false; allowIssues: true would also accept a sign-off that notes known issues. Both are set through the API.
Route must: qualified into prodEvery arrival into production asks "Qualified in QA", whoever promotes and from wherever.
window on prodDays 1 to 4, 09:00 to 16:00 in the organization's time zone. A snapshot that arrives outside it is held.
prod By requestWardn promotes nothing into production by itself.

Check that it worked

A change enters QA by itself

Change a file under deploy/web and merge it to main. web-dev renders and applies the commit. Because dev has no qualification rules the snapshot qualifies at once, and the controller's next pass (it looks every 30 seconds) queues one promotion into web-qa.

api "$WARDN_API_URL/api/v1/activity?action=deployment.promote&limit=3" | jq '.items[0]'

The entry is deployment.promote with auto: true, fromStage: dev and toStage: QA. On Deployments › web-qa › Snapshots the new snapshot is marked as promoted and its verdict reads Qualifying. Read it back:

QA_SNAP=$(api "$WARDN_API_URL/api/v1/deployments/$QA_DEP/snapshots?limit=1" | jq -r '.items[0].id')
api "$WARDN_API_URL/api/v1/deployments/$QA_DEP/snapshots/$QA_SNAP/qualification" \
  | jq '{verdict, reason, checks: [.checks[] | {title, state, result}]}'
{
  "verdict": "qualifying",
  "reason": "Waiting on test results, healthy for an hour, sign-off",
  "checks": [
    {"title": "Smoke tests pass",    "state": "waiting", "result": "No test results yet"},
    {"title": "Healthy for an hour", "state": "running", "result": "4m of 1h"},
    {"title": "QA sign-off",         "state": "waiting", "result": "0 of 1 signed off"}
  ]
}

A check that waits is never read as a pass: No test results yet holds the verdict at qualifying.

Hold production until it qualifies

Ask what promoting this snapshot to production would meet. The preflight changes nothing:

api "$WARDN_API_URL/api/v1/deployments/$PROD_DEP/promotions/preflight?snapshotId=$QA_SNAP" \
  | jq '{blocked, rules: [.rules[] | select(.status == "blocked" or .status == "waiting") | {title, setBy, status, message}]}'

It is blocked, and a rule titled "Qualified in QA", with setBy "Guardrail · prod stage" (stage rules and guardrails are judged by one engine and listed together), is the reason. You can see the same on the Promote ad hoc screen below, in Rules that apply.

Run the tests against the snapshot

A run counts as evidence only when it names the snapshot. The web app's Run buttons do not name one, so start the run from CI or a script (Tests):

SUITE_ID=$(api "$WARDN_API_URL/api/v1/test-workspace?appId=$APP_ID" | jq -r '.suites[0].suite.id')
api -X POST "$WARDN_API_URL/api/v1/test-runs" -d '{
  "suiteIds": ["'"$SUITE_ID"'"], "deploymentId": "'"$QA_DEP"'",
  "snapshotId": "'"$QA_SNAP"'", "targetKind": "cluster"
}'

While it runs the check shows progress ("212 of 412 done"); when every run has passed it reads "412 of 412 passed". A failed run is fatal: the verdict becomes Rejected and the snapshot cannot be signed off or promoted. Push a fix, which starts again in dev.

Sign it off

Once the soak is done and the tests have passed, only the sign-off is left. The tester signs in as riley.

Open Approvals › Sign-offs. The row for web-qa is under Needs you. Choose Review: the page shows what changed, each check under Qualification and Your decision. Choose Sign off, add a note ("Checkout and refunds checked on QA"), and choose the button at the bottom. The verdict turns Qualified.

If it is not right, choose Reject and say why; a rejection is final for that snapshot in that stage. If you are the author, or do not hold the duty, the page says why you cannot decide instead of hiding the choices.

Promote to production

Now the route requirement holds, and the same snapshot may go to web-prod.

Open Releases and choose Promote ad hoc. (The Promote link on a deployment's Snapshots tab opens the same screen, but it is not offered on the snapshot the deployment is running now, which is the one you want here.) Under From choose web-qa; its snapshots are listed newest first with their Checks and Verdict. Tick the qualified one.

Under Target deployments tick web-prod. What moves compares the app with what production runs now, and Rules that apply lists the production stage's rules and your guardrails: "Qualified in QA" is met and "Weekday office hours" is met inside the window. (A fixed Deploy window row that says "Comes with pipelines" is a leftover and judges nothing; your window is the "Weekday office hours" row.)

Add a Reason and choose Promote now. The deployment's Snapshots tab shows the new snapshot, marked promoted from web-qa, and applies it.

For a tracked release with waves and a change request form, use Use a pipeline instead on that screen (Promote by hand, Releases).

Outside the window the same call is refused with 409 naming the rule "Weekday office hours". The promotion needs you to try again inside the window; nothing is held in a queue for you. Someone who holds release:bypass can pass a blocked rule once, with a reason that Activity records, by sending "bypass": {"reason": "..."} (Guardrails). Use it for an emergency, not to skip QA.

Confirm the trip: GET /deployments/$PROD_DEP/promotions lists the promotion with sourceSnapshotId equal to $QA_SNAP, and the snapshot's content id on web-prod is the same as on web-qa.

When something goes wrong

  • The tests fail. The verdict is Rejected with the failed check as the reason. Nothing else happens by itself (the stage's When rejected choice is stored and not carried out). If production is unaffected, leave web-qa where it is and push a fix. If a rejected snapshot is running somewhere it should not, restore the last good one.
  • The soak never ends. The soak counts time the snapshot is healthy in qa. A deployment that is unhealthy for a while does not accumulate it; fix the deployment first (Health).
  • A newer commit lands in dev. Only the snapshot web-qa runs now is judged afresh, and auto-promotion carries the one that qualified, so the older snapshot, if it was still qualifying, shows Superseded. Sign off the one that is current.
  • Nobody can sign. The Sign-offs page says why, per snapshot: "You made this snapshot", "You do not hold the sign-off duty here", or "This is not the snapshot the QA stage runs now".
  • A freeze or a guardrail holds the promotion into qa. Activity shows it as waiting with the reason, and the job looks again after 30 seconds, then 1, 2 and 4 minutes, and every 5 minutes after, without skipping the stage.

Next

Related: Guardrails, Tests, Roles and grants, Approvals, Protect production.

On this page