The idea in one minute#
Release engineering is the discipline of getting code from a commit to production reproducibly, safely and quickly. Its principles: build each version once, from source, in a hermetic environment; give it an immutable version; promote the same artifact through environments rather than rebuilding; release in small, frequent batches; make rollback a routine, one-step operation; and record everything.
Speed and safety are not opposites. The DORA research programme found, year after year, that teams that deploy most often also have the lowest change failure rates and fastest recovery — because small changes are easier to test, review, roll out and undo.
An analogy#
A pharmacy does not mix a new batch of medicine for each hospital. It manufactures one batch under controlled conditions, labels it with a lot number, tests samples, and ships that exact batch. If there is a problem, it recalls that lot number.
A picture#
flowchart LR
C[":github: <b>Commit</b><br/><small>reviewed PR</small>"] --> B[":i-package: <b>Build once</b><br/><small>hermetic, versioned, signed</small>"]
B --> T[":i-check: <b>Test</b><br/><small>unit, integration, contract</small>"]
T --> R[(":harbor: <b>Registry</b><br/><small>image@sha256</small>")]
R --> S[":i-flask-conical: <b>Staging</b>"]
S --> CA[":argo: <b>Canary</b><br/><small>1% → 10% → 50%</small>"]
CA --> P[":kubernetes: <b>Production</b><br/><small>same digest</small>"]
CA -->|"bad metrics"| RB["Automatic<br/>rollback"]
class C neutral
class B,T compute
class R memory
class S,CA queue
class P io
class RB warnHow it really works#
Principles#
| Principle | In practice |
|---|---|
| Hermetic, reproducible builds | Pinned toolchain and dependencies (go.mod/go.sum, lockfiles, pinned base images by digest); builds in CI, never on laptops |
| Build once, promote everywhere | Staging and production run the same image digest (@sha256:…), not the same tag rebuilt |
| Immutable versions | Never move a tag like v1.4.2; latest is not a version |
| Provenance and signing | Record what source and build produced an artifact (SLSA provenance), sign it (Sigstore cosign), verify at deploy |
| Small batches | Many small merges and deploys a day beat one big weekly release |
| Config separate from code | The same artifact runs everywhere with different config — but config changes are reviewed and rolled out like code (8.c) |
| Rollback is routine | One command or button; practised; schema changes stay backward-compatible (9.c) |
| Everything recorded | Who deployed what digest, where, when — into the shared change log (4.c) |
The pipeline#
- Pre-merge: formatting, linting, unit tests, build, security scans, review.
- Post-merge build: the one build of this version; produce the image, SBOM, provenance; sign.
- Automated tests: integration and contract tests against the built artifact.
- Staging: deploy the same digest; smoke tests; optional soak.
- Production, progressively: canary → percentage steps → all, with automated analysis (8.b), zone by zone or cell by cell (7.c).
- Verification: SLO burn and canary metrics; automatic rollback on failure.
Deploy is not release#
Separate deploying code (it is running in production) from releasing a feature (users can see it), using feature flags (8.c). Code can ship dark, be tested in production by employees, and be released gradually — or turned off in seconds without a deploy.
Rollback versus roll forward#
- Roll back when the last change is the likely cause: it is the fastest, safest mitigation if rollback is routine and compatible.
- Roll forward (ship a fix) only when rollback is impossible (an irreversible migration) or the fix is trivial and the pipeline is fast. Never “quickly patch production by hand”.
- Make rollback always possible: keep the previous artifact, keep schema changes backward-compatible (expand, migrate, contract), and keep data written by the new version readable by the old one.
Change freezes#
Many organisations freeze deploys around peak events (Black Friday, end of quarter). A freeze reduces change risk but accumulates it: the first deploy after a freeze is large. Prefer higher scrutiny (extra approval, smaller rollout steps) over a total freeze, and never freeze security fixes.
DORA metrics#
The four key metrics from DORA (DevOps Research and Assessment), widely used to measure delivery performance:
| Metric | Meaning |
|---|---|
| Deployment frequency | How often you deploy to production |
| Lead time for changes | Commit to running in production |
| Change failure rate | Share of deployments that cause a failure needing remediation (rollback, fix, incident) |
| Time to restore service (recent reports: failed deployment recovery time) | How long it takes to recover from a failed deployment |
DORA’s recent reports also track rework rate (unplanned deployments to fix production issues). Treat these as signals for the team, not targets for ranking teams.
A worked example#
A team deploys once a week. Each release has ~40 merged changes. One release in four causes an incident; diagnosing which of 40 changes is responsible takes hours, and rollback undoes all 40, including the urgent fix.
They move to: deploy on every merge (about 8 a day), each through a 15-minute canary. Six months later: deployment frequency 160 per month; change failure rate 4%; a bad change is almost always caught by the canary and rolled back automatically before reaching 10% of users; when it is not, the culprit is obvious — the one change in that deploy.
The program computes the DORA metrics from a deploy log.
Code#
// dora.go — compute the four DORA metrics from a deployment log.
package main
import (
"fmt"
"sort"
"time"
)
type deploy struct {
at time.Time
commitAt time.Time // oldest commit in this deploy
failed bool
restoredAt time.Time // when the failure was remediated
}
func main() {
base := time.Date(2026, 9, 1, 9, 0, 0, 0, time.UTC)
var log []deploy
// A month of deploys: ~6 per working day, lead time 1–5 h, ~5% fail.
seed := uint32(17)
rnd := func(n int) int { seed = seed*1664525 + 1013904223; return int(seed>>8) % n }
for day := 0; day < 30; day++ {
d := base.AddDate(0, 0, day)
if wd := d.Weekday(); wd == time.Saturday || wd == time.Sunday {
continue
}
for i := 0; i < 4+rnd(5); i++ {
at := d.Add(time.Duration(rnd(8*60)) * time.Minute)
dep := deploy{at: at, commitAt: at.Add(-time.Duration(60+rnd(240)) * time.Minute)}
if rnd(100) < 5 {
dep.failed = true
dep.restoredAt = at.Add(time.Duration(5+rnd(55)) * time.Minute)
}
log = append(log, dep)
}
}
var leads, restores []time.Duration
failures := 0
for _, d := range log {
leads = append(leads, d.at.Sub(d.commitAt))
if d.failed {
failures++
restores = append(restores, d.restoredAt.Sub(d.at))
}
}
median := func(ds []time.Duration) time.Duration {
if len(ds) == 0 {
return 0
}
sort.Slice(ds, func(i, j int) bool { return ds[i] < ds[j] })
return ds[len(ds)/2]
}
fmt.Printf("deployment frequency: %d deploys in 30 days (%.1f per working day)\n", len(log), float64(len(log))/22)
fmt.Printf("lead time for changes: median %v\n", median(leads).Round(time.Minute))
fmt.Printf("change failure rate: %.1f%% (%d of %d)\n", 100*float64(failures)/float64(len(log)), failures, len(log))
fmt.Printf("failed deployment recovery: median %v\n", median(restores).Round(time.Minute))
}Remember this#
- Build once, hermetically; version immutably; promote the same digest; sign and record provenance.
- Small, frequent deploys are safer than big, rare ones.
- Separate deploy from release with feature flags.
- Rollback is the default mitigation — keep it routine and schema-compatible.
- Use the DORA metrics as team signals: frequency, lead time, change failure rate, recovery time.
Try it#
- Run
dora.go. Make 20% of deploys fail. Which metric would you look at first? - In a pipeline you know, check whether production runs the same image digest as staging.
- Time a rollback of a service you own, end to end. Is it under five minutes?
Check yourself#
- Why promote the same artifact rather than rebuilding for each environment?
- What is the difference between deploying and releasing?
- When is rolling forward better than rolling back?
- Why do teams that deploy more often tend to have lower change failure rates?