Release promotion and rollback
Prerequisite: node-dependency-provenance-and-sbom. Objective: Design approval gates. Each example is independent. Tested with Node.js 22.16.0 on Linux. Save as main.mjs in a fresh disposable directory and run node main.mjs. These are static code blocks; external system behavior is not established by a local model.
How it works
Promote by immutable artifact digest and verify that the same bytes tested are the bytes deployed. Require review, recorded test results, migration compatibility and environment-specific authorization. A canary exposes a limited share of traffic and compares error, latency and business signals under explicit sample and stop rules. Rollback of an application does not undo database writes; use compatible migrations, recovery plans and reconciliation. Keep credentials and production endpoints out of training fixtures.
Verify promotion identity and gates
import assert from 'node:assert/strict';import {createHash} from 'node:crypto';const digest=s=>createHash('sha256').update(s).digest('hex');function allowed(tested,candidate,approved){return approved===true&&digest(tested)===digest(candidate);}assert.equal(allowed('v1','v1',false),false);console.log(allowed('v1','v1',true),allowed('v1','v2',true));Expected output:
true falseIdentical content and explicit approval are necessary in this model, not sufficient for real deployment.
Evaluate a canary stop rule
import assert from 'node:assert/strict';function decision({requests,errors}){if(requests<100)return 'hold';return errors/requests>0.02?'stop':'continue-review';}assert.equal(decision({requests:20,errors:0}),'hold');console.log(decision({requests:100,errors:3}),decision({requests:100,errors:1}));Expected output:
stop continue-reviewThe fictional threshold illustrates gating, not statistical significance or an operational recommendation.
Common mistake
Do not use a mutable tag as sole artifact identity or automatically reverse a destructive migration during an app rollback.
Practice
Given a failed canary and an incompatible database schema, explain why an application-only rollback may be unsafe.
Reference candidate: node-release-promotion-and-rollback-lookup (route unverified). Documentation anchors: https://docs.github.com/en/actions/how-tos/secure-your-work/use-artifact-attestations/use-artifact-attestations, https://kubernetes.io/docs/concepts/workloads/controllers/deployment/. External versions and full integration are pending.
Administrative staged lab: staged-deployment-labs/ci/pipeline.md. Read its README for prerequisites, execution boundaries and cleanup. Not a verified public route.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Release promotion and rollback — knowledge check
Apply the lesson to a fresh scenario and explain the evidence boundary.
What should promotion preserve?
What can an application rollback fail to reverse?
Why hold a canary with too little evidence?