Lesson 12 / 21

Failing Fast

Give developers bad news as early and as cheaply as possible.

The principle

Fail fast means ordering pipeline steps so the cheapest, quickest checks (linting, unit tests) run first. If those fail, the pipeline stops before wasting minutes on a slow deploy step.

Order: cheap to expensive

A good ordering is: lint → unit tests → build → integration tests → deploy. Each stage should only run once the cheaper stage before it has passed.

Checking the easy things first

A doctor checks your temperature before ordering an MRI. Cheap, fast checks first rule out the obvious problems before you spend time and money on expensive ones.

Quick check: In a fail-fast pipeline, which should typically run first?

  • The production deploy
  • Fast, cheap checks like linting and unit tests
  • Slow end-to-end integration tests
Answer

Fast, cheap checks like linting and unit tests — Running the cheapest checks first surfaces most bugs quickly, before time is spent on slower stages.