Building a deployment pipeline your team is not afraid of

Ship small, ship often, and be able to undo it.

The short answer

A working pipeline runs automated tests on every commit, builds one artefact, deploys it to a preview environment per pull request, then to staging and production behind the same automation — with a rollback that takes a single command and under a minute.

Key takeaways

  • Build the artefact once and promote it; rebuilding per environment reintroduces the differences you were avoiding.
  • Preview environments per pull request change how reviews happen more than any tooling change.
  • Optimise for recovery time, not for preventing every bad deploy.
  • Keep the pipeline fast. A twenty-minute pipeline gets bypassed.

The measure of a pipeline is not how much it checks. It is whether the team deploys on a Friday afternoon without a meeting.

The stages, in order

  1. 01On every commit: lint, type check and unit tests. Under five minutes or people start skipping the branch protection.
  2. 02Build once, producing a single artefact that is promoted through environments unchanged.
  3. 03Preview environment per pull request, with a URL in the PR so reviewers look at the thing rather than the diff.
  4. 04Staging deploy on merge, with integration tests against it.
  5. 05Production deploy, manual or automatic depending on your appetite, with health checks and automatic rollback on failure.

Keep it fast

Pipeline duration is a cultural lever. Under five minutes, developers wait for it. Over fifteen, they context-switch and the feedback loop is broken. Cache dependencies, run tests in parallel, and move the slow end-to-end suite to a nightly run rather than blocking every commit with it.

Secrets and access

  • Secrets in the platform's secret store, never in the repository, and rotated on a schedule.
  • Deployment credentials scoped to the minimum they need, per environment.
  • Production deploys require review; staging does not. Friction should be proportional to consequence.
  • Every deploy recorded — who, what commit, when — so an incident timeline reconstructs itself.

Questions people also ask

Yes, and it needs to match production in configuration rather than in size. Preview environments per pull request cover most day-to-day review; staging is where integration tests and final checks run against something production-shaped.

Keep reading

Related

What this connects to

Rather have this answered about your own account?

Send us what you have. We will look at it properly and write back with what we would change, in the same plain terms as the page you just read.