Continuous delivery vs continuous deployment

Intermediate · 18 min

Continuous delivery keeps every change releasable and a person picks when. Continuous deployment ships every green change. And deploying is not releasing.

Before thisAnatomy of a pipeline: stages, jobs and gatesContinuous integration as a practice

Modern Software Engineering · 18 min

Continuous delivery vs continuous deployment

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by Modern Software EngineeringReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • Continuous delivery means every change that passes the pipeline is releasable, and releasing is a business decision made with one click, at any time.
  • Continuous deployment goes one step further: every change that passes the pipeline goes to production automatically, with no human approval.
  • The engineering is the same for both. The only difference is whether the final step to production is automatic or a button.
  • Deploying puts code on production servers. Releasing exposes a behaviour to users. Feature flags separate the two, so continuous deployment does not mean every feature is visible at once.
  • Continuous deployment needs strong automated tests, monitoring and fast rollback. Regulated releases, app stores and installed software are common reasons to stop at continuous delivery.

Two phrases, one abbreviation

“CD” means two different things, and people use them interchangeably. That causes real confusion: one team says “we do CD” and means a release button, another means every merge goes straight to production.

Both build on continuous integration. The question they answer is what happens after the pipeline goes green.

Continuous delivery: always releasable

Continuous delivery is the practice of keeping your software in a state where it can be released to production at any time. Every change that passes the pipeline has been built, tested and deployed to a production-like environment. Releasing it is a decision, made with one click, not a project.

Jez Humble and Dave Farley set this out in Continuous Delivery (2010). The key test is not how often you release. It is whether you could release today’s main branch without a stabilisation phase. A team that releases monthly but could release any day is doing continuous delivery. A team that releases weekly but spends two days each week fixing the build so it can ship is not.

Continuous deployment: no button

Continuous deployment removes the button. Every change that passes every stage goes to production automatically. A merge to main is, minutes later, a production deploy.

The engineering is the same as continuous delivery. In the bash pipeline from the pipeline anatomy lesson, the difference is one line: the gate that stopped with deploy needs APPROVE=yes. Keep the gate and it is continuous delivery. Delete it and it is continuous deployment. In GitHub Actions, the same switch is a required reviewer on the production environment.

That is why the distinction is about risk and organisation, not tooling.

Deploying is not releasing

The idea that makes continuous deployment practical is separating two events people usually fuse:

  • Deploy: new code is running on production servers.
  • Release: users can see or use a new behaviour.

If they are the same event, every deploy is a launch, and a half-built feature can’t be merged. If they are separate, you can deploy unfinished work switched off and release it later by changing configuration, without a deploy.

I ran a tiny Python web server, version 1.5.0, that reads a flags.json file on every request and serves either the old or new checkout. With the server running the whole time, I flipped the flag on and then off again:

$ curl -s localhost:8077/
1.5.0: old checkout
$ echo '{"new_checkout": true}' > flags.json
$ curl -s localhost:8077/
1.5.0: new checkout
$ echo '{"new_checkout": false}' > flags.json
$ curl -s localhost:8077/
1.5.0: old checkout

The version never changed. The new checkout was deployed before it was released, released without a deploy, and withdrawn in one write, without a rollback. Real systems use a flag service rather than a file, and can turn a feature on for 1% of users, or only for staff. Feature flags in practice covers the code side, including cleaning flags up afterwards so they don’t pile up.

Choosing between them

Continuous deployment is the more demanding option. It needs:

  • Tests you trust enough to ship on green without a human look.
  • Monitoring that tells you within minutes if a deploy hurt users.
  • Fast, practised rollback or roll-forward, covered later in this group.
  • Small changes, so each deploy is low risk.

Teams that have those get the shortest lead times and the smallest batches. Companies such as Etsy and Amazon have described deploying many times a day this way.

Reasons to stop at continuous delivery are usually outside engineering:

  • App stores and installed software. You can’t push a new build to every phone or customer server whenever you like.
  • Regulation. Some industries require a documented approval per release. Continuous delivery lets that approval be one click on an already-proven build.
  • Coordinated launches. Marketing wants a date. Feature flags often solve this better than holding back deploys.

Either way, the expensive part, being always releasable, is the same. Most teams should get there first and decide about the button afterwards.

About the video

Dave Farley’s “The Difference Between Continuous Delivery & Continuous Deployment” (Modern Software Engineering, 2022, about 18 minutes) describes, per its description, what each gives you and when continuous deployment may not be the right answer. Its chapters cover the definitions, feedback, working in small steps, “releasability vs actual release”, experimental product development, and risk and release frequency. Farley co-wrote the book that defined continuous delivery. I had no transcript, so this is from the title, description and chapters. English was judged from the same metadata. IBM’s five-minute lightboard version and Farley’s shorter 2020 take are under deeper.

Where this fits

Being releasable assumes the thing you release is the thing you tested. The next lesson makes sure of that: build once, promote through environments.

Check yourself

  1. 01Your pipeline builds, tests and deploys to staging automatically, and a product manager presses a button to deploy to production. Which practice is this?

    Continuous delivery, as long as every green build is genuinely releasable. If production deploys happened automatically after staging, it would be continuous deployment.

  2. 02How can a team practise continuous deployment while a feature is still half built?

    Merge and deploy the code with the feature switched off behind a flag. It runs in production but users do not see it until the flag is turned on, which is the release.

  3. 03What is a situation where continuous deployment is not a good fit?

    A mobile app that must pass app store review, software customers install themselves, or a regulated system that requires a documented approval for each release. There, continuous delivery keeps the benefits while a person or process controls when to release.

  4. 04If a team only releases monthly, can it still be doing continuous delivery?

    Yes, if every change is kept in a releasable state and the monthly release is a choice rather than a stabilisation effort. If the month before release is spent fixing things so the build can ship, it is not continuous delivery.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark