Continuous delivery and deployment
Last updated
CI checks every change. But a checked change still has to reach the health centre, and if that takes a day of careful manual steps, releases become rare, big and frightening. Continuous delivery keeps Pila always ready to release, at the press of a button; continuous deployment takes away the button. In this lesson you'll tell the two apart, put a deployment pipeline's stages in order, and decide where Pila keeps a person in the loop.
By the end of this lesson you can
- Tell continuous delivery from continuous deployment
- Order the stages of a deployment pipeline, from commit to production
- Decide where a human approval belongs, and why
Always releasable
Jez Humble and David Farley's 2010 book Continuous Delivery starts from a question: why are releases so painful? Their answer: because they're rare. A release every three months holds three months of changes, done by hand, by people who last did it three months ago.
Their fix is to make releasing boring. Continuous delivery means the main branch is always in a releasable state, every change goes through the same automated deployment pipeline, and putting a version into production is a routine decision, not a project. The pipeline is CI (lesson 7.2) carried all the way to production: the same image, built once, moves through test and staging to the real servers.
Delivery or deployment
Two names that differ by one thing: the button.
| Continuous delivery | Continuous deployment | |
|---|---|---|
| Every change is built, tested and deployed to staging | Yes | Yes |
| Going to production | A person presses a button, when they choose | Automatic, as soon as every check passes |
| Suits | Teams that need to choose the moment: hospitals, banks, a health centre with a morning rush | Teams with strong automated checks and fast rollback, such as many web companies |
Both rest on the same pipeline; the difference is only who decides the last step. Pila uses continuous delivery: Bea, the product owner, chooses the time with Ate Cora, usually after 11:00 when the queue is quiet.
Build Pila’s deployment pipeline
Put the stages in order, cheapest and fastest checks first, and the riskiest step last.
- 1 Deploy the image to staging
- 2 Run the unit tests
- 3 Deploy the same image to production
- 4 Lint the code
- 5 Bea approves, at a time agreed with Ate Cora
- 6 Check production is healthy
- 7 Build the image
- 8 Smoke test on staging: text in, number out
The image is built once, at stage 3, and that exact image goes to staging and then production. Building again for production would mean releasing something nobody tested.
Watch it run
- Lint passed
- Test
- Build image
- Deploy to staging
- Smoke test
- Approve
- Deploy to production
- ▶ running
Show the next three numbers on the screenMarco
Spot the trap: the sticky note
Pila’s pipeline stops at staging. Releasing to production is eleven manual steps, written on a sticky note on Jun’s monitor. Only Jun has done it.
What happens if…
Check what you learned
Sources
Every claim on this page comes from these sources: the standard, the founding text of a method, a study, or the official record of a project, from the body that publishes it. Industry reports are labelled as such.
- Jez Humble: Continuous Delivery: the practice, from one of the authors of the book that named it
- Humble and Farley: Continuous Delivery (Addison-Wesley, 2010): the deployment pipeline, in full
- Martin Fowler: Continuous Delivery: delivery versus deployment, in brief
- DORA: Continuous delivery: what the research links it to