Pipeline design: fast feedback, clear stages

ExplainedCI/CDDevOps, Hands OnBy Cloud Hands On

How to arrange jobs and stages so a pipeline answers quickly, fails clearly and costs little.

A good pipeline is judged by two things: how quickly a developer hears that their change is good or bad, and how much they trust the answer. Slow pipelines get skipped; flaky ones get ignored.

Order checks by cost and likelihood of failure: formatting and lint (seconds), unit tests (a minute or two), build, integration tests, security scans, then deployments. Run independent checks in parallel. Stop as soon as something fails. Keep deploy stages separate from build stages, and make every stage after the build use the same built artifact.

Measure it. Track the time to a result on pull requests and the share of runs that fail for reasons unrelated to the change (flaky tests, network timeouts). Fix flakiness quickly: a test that fails at random teaches people to press re-run instead of reading the result.

Cost. Free to practise in a public GitHub repository.

Use it when

How it works

Order
Cheap and likely-to-fail checks first.
Parallel
Independent jobs side by side, joined with needs.
Stop early
A failed job skips everything that depends on it.
Build once
Later stages use the same artifact.
Gates
Approvals and checks between environments, not inside builds.

Options

One workflow with many jobs
Simple to follow for one app.
Several workflows
Separate PR checks, releases and scheduled jobs.
Reusable workflows
The same design across many repositories.

Example. Fernhill Cloud found that 30% of red builds were caused by one flaky test that called a real website. Replacing the call with a local fake brought false failures under 2%, and developers stopped re-running by habit.

Don't confuse it with

Pipeline speed
Time to a result; affects how often people integrate.
Pipeline reliability
How often a red result is real; affects whether people trust it.

Words to know

Flaky test
A test that sometimes passes and sometimes fails with no change.
Fail fast
Stopping at the first failure to save time.
Gate
A check or approval between stages.

Where to look

  1. Actions tab
  2. Workflow run graph

Practise it

Read it in the guide, next to the tasks and labs.

Open in DevOps, Hands On

Keep going