STACK
Ch 16 · CI/CD, DevOps & Quality
Chapter 16 · Ship safely, repeatedly

CI/CD, DevOps & Quality — the pipeline is the product

16.1 · The flow from PR to prod

PR opened→ Lint + types + tests→ Build + sign→ Preview env→ Review→ Merge→ Canary→ Full rollout

16.2 · Branching strategies

ModelBest for
Trunk-basedHigh velocity; short branches + feature flags.
GitHub FlowBranch → PR → merge → deploy.
Git-flowHeavy releases / regulated industries.
Stacked diffsSmall reviewable PRs that depend on each other (Graphite, Phabricator).

16.3 · CI/CD tools (2026)

ToolNotes
GitHub ActionsDefault for GitHub orgs.
GitLab CIIf you're on GitLab.
BuildkiteSelf-hosted agents, fast, scriptable.
CircleCIReliable; orb ecosystem.
DaggerPipelines as code in real languages.
Earthly / DroneNiche alternatives.

16.4 · Pipeline stages

  1. Static: format, lint, type-check, secret scan, dep audit.
  2. Test: unit, integration, contract.
  3. Build: container image, SBOM, sign.
  4. Preview: per-PR ephemeral environment.
  5. Approve: human gate on prod.
  6. Deploy: progressive (canary → 25% → 100%).
  7. Verify: synthetic checks, SLO probes.
  8. Rollback: one-button revert; always tested.

16.5 · Deploy strategies

StrategyHow
RollingReplace pods one at a time. K8s default.
Blue / GreenRun new full set; flip LB.
Canary1–10% to new; observe; expand.
ProgressiveCanary with auto-analysis on metrics (Flagger, Argo Rollouts).
ShadowMirror prod traffic to new version, no user impact.
Dark launchDeploy code behind a flag; enable later.

16.6 · Feature flags

  • Decouple deploy from release.
  • Use for: gradual rollouts, A/B tests, kill switches, customer-tier gating.
  • Tools: LaunchDarkly, Statsig, GrowthBook, Unleash, Flagsmith, ConfigCat.
  • Clean up dead flags or your codebase rots.

16.7 · Testing pyramid (and what's above it now)

LayerTools
UnitVitest / Jest / pytest / go test / cargo test / JUnit / xUnit.
ComponentTesting Library, Storybook stories-as-tests.
IntegrationTestcontainers (real DBs / brokers in Docker).
ContractPact, Spring Cloud Contract.
E2EPlaywright (default 2026), Cypress (legacy).
Visual regressionChromatic, Percy, Argos.
Synthetic / RUMCheckly, Datadog Synthetics + RUM, Sentry.
Loadk6, Gatling, Locust, JMeter.

16.8 · Mutation, fuzz, contract, property testing

  • Mutation testing (Stryker, PIT) — mutates code; if tests still pass, your tests are weak.
  • Fuzz testing (libFuzzer, AFL++, Jazzer, go-fuzz) — auto-generates inputs to crash code.
  • Property-based testing (Hypothesis, fast-check, QuickCheck) — define invariants; framework finds counterexamples.
  • Contract testing (Pact) — pinned API expectations between services.
  • Chaos engineering (Litmus, Chaos Mesh, Gremlin) — break things on purpose; verify resilience.

16.9 · Supply-chain security in CI

PracticeWhat it gives you
SBOM (Syft, CycloneDX, SPDX)Listing of components shipped; SOC 2 / EU CRA expect it.
SLSA levelsMaturity model for build provenance.
Sigstore / CosignKeyless signing of artefacts.
Dep scanningSnyk, Dependabot, Renovate, OSV-Scanner.
Container scanningTrivy, Grype.
Secrets scanninggitleaks, trufflehog, push-protection.
OIDC federationNo long-lived cloud keys in CI.

16.10 · DORA + SPACE — measuring the team

DORA (delivery)SPACE (developer experience)
Deploy frequencySatisfaction & well-being
Lead time for changePerformance (outcomes)
Change failure rateActivity (volume — careful)
MTTRCommunication & collaboration
Efficiency & flow

16.11 · Self-check

Q1 · Best leading indicator of test quality?
Coverage %
Mutation score
Lines of test code
PR count