Lesson 1 of 9 · 24m
Pipeline Topology and Failure Boundaries
Shape CI as a dependency graph with fast feedback, explicit artifacts, and failure zones instead of one long fragile script.
The worst enterprise pipeline I inherited was one YAML file with 1,900 lines and a stage named misc. Every failure canceled everything else, every retry reran the world, and nobody could say which artifact had actually been tested. The mental shift is simple: a pipeline is not a shell script with extra syntax. It is a production system that builds, verifies, stores, and moves evidence.
Design around decisions
Every stage should answer a distinct question:
compile can the code build at all?
unit are isolated behaviors correct?
package did we produce immutable artifacts?
integration do components work together?
security did policy or supply-chain checks fail?
release may this exact artifact advance?If one job answers three questions, a failure tells you nothing. Split work at decision boundaries, not merely by runtime convenience.
Model dependencies honestly
Most CI systems execute directed acyclic graphs. Declare the graph:
# GitHub Actions shape
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: web-dist-${{ github.sha }}
path: dist/
test:
needs: build
runs-on: ubuntu-24.04
steps:
- uses: actions/download-artifact@v4
with:
name: web-dist-${{ github.sha }}
path: dist/
- run: npm testneeds is not decoration. It prevents accidental parallelism where tests execute against a different checkout or an artifact that does not yet exist.
Fast feedback beats maximal parallelism
Run cheap, high-signal checks early. Expensive end-to-end suites can start in parallel only when they use the same immutable inputs and their cost is justified. Otherwise put them behind the first quality gate. A graph that finishes in seven minutes but hides the real failure until minute six is worse than a boring ten-minute graph with feedback in ninety seconds.
Artifacts are the contract
Jobs should communicate through versioned artifacts, not workspace state, shared runners, or recompilation. Name artifacts with immutable coordinates such as commit SHA and build number. Record provenance: source revision, toolchain, dependency lockfile digest, and environment. If deployment cannot point to the exact bits tests approved, your pipeline is producing hope rather than evidence.
Failure boundaries and retries
Retries should be scoped to the unit that failed. Re-running an entire pipeline because one browser test flaked trains teams to distrust results. Quarantine flaky tests deliberately, expose their failure rate, and make retry behavior visible. Never let retry turn a failed security scan into a pass merely because the scanner timed out differently.
Field notes
always()is a loaded weapon; use it for evidence collection, not to mask failed dependencies.- Keep checkout, dependency install, compile, test, and package logs attributable to separate steps.
- A green pipeline with manually copied artifacts is not continuous delivery; it is continuous transcription.
- Draw the graph on one page. If you cannot, neither can the next engineer debugging it at 2 a.m.
Was this lesson helpful?