Nguyen Le Phong

Continuous Integration vs. Continuous Delivery

CI keeps shared code working every day, continuous delivery keeps every good build releasable, and continuous deployment ships it.

Thursday, 4 p.m. Three pull requests land in the merge queue within a minute of each other. One test goes red. In the team channel someone writes "CI is broken", someone else replies "so CD is blocked?", and a third person asks whether the release is still on for tomorrow. Everyone is using the same two acronyms, and each of them means something slightly different.

It's worth untangling, because CI and CD protect different things. If you know which one is hurting, you know where to spend next sprint's improvement time.

Engineers gather around screens showing a failing pipeline while several pull requests arrive at once.
Several changes landing at once is exactly when CI earns its keep. Fast feedback keeps the problem small enough to fix before anyone panics.

Three terms, three promises

Martin Fowler's definitions are the cleanest place to start. Continuous integration means everyone on the team merges their work into the shared mainline at least daily, and an automated build with tests checks every merge (Continuous Integration, rewritten in 2024). Continuous delivery means the software can be released to production at any time. His litmus test: a business sponsor could ask to ship the current development version at short notice, and nobody would panic (ContinuousDelivery). Continuous deployment goes one step further: every change that passes the pipeline goes to production automatically.

PracticeThe promiseYou know it's working when
Continuous integrationThe shared code works, todayEveryone merges at least daily and a red mainline gets fixed within minutes
Continuous deliveryAny good build could go to productionReleasing is a business decision, not an engineering project
Continuous deploymentEvery good build does go to productionNobody presses a release button at all

Each one depends on the one before it. You can't keep software releasable at any moment if nobody knows whether the mainline even builds. And you shouldn't automate every release until releasing on demand already feels routine.

What CI asks of the team

CI sounds like a server that runs tests. Fowler's list of practices shows it's mostly a set of team habits: keep everything in version control, make the build test itself, push to mainline every day, fix a broken build immediately, keep the build fast, and make the status visible to everyone. His advice when the mainline goes red is to revert the bad commit first and debug second, so everyone else can keep working. He quotes Kent Beck's even stricter version: no code should sit unintegrated for more than a couple of hours.

He's also blunt about one common setup. Pulling mainline into a long-lived feature branch and running CI there, without ever pushing back, is what he calls semi-integration. The tests pass, but only against a version of the world that's days or weeks old. Merge after three weeks and the integration itself becomes a small project. DORA's research lands in the same place: teams that do well keep three or fewer active branches, merge to trunk at least once a day and don't need code freezes (DORA: Trunk-based development). There's a whole post on that habit here: Trunk-Based Development: Merge Small, Merge Daily.

When CI works, problems show up while they're still small. You change some validation logic. Unit tests run, the type checker passes, lint catches an unused import, and one focused integration test checks the API boundary you touched. If something fails, the change is ten minutes old and still in your head. Nobody has stacked four other changes on top of it yet.

Build speed matters too. Fowler treats the XP guideline of a ten-minute build as reasonable for most projects. If the build takes 40 minutes, people stop waiting for it, start batching changes, and you're back to merging big surprises.

What CD adds after the green build

A green build tells you the code compiles and the tests pass. It doesn't tell you the database migration is safe, the config for production is right, or that you can roll back if the new version misbehaves. Continuous delivery covers that gap. Fowler's checklist: the software stays deployable throughout its life, the team puts keeping it deployable ahead of new features, anyone can get fast automated feedback on whether a change is production-ready, and any version can go to any environment on demand.

In practice, that means a pipeline that keeps going after the unit tests: packaging, environment checks, security scans, a deploy to something close to production, smoke tests, and monitoring that can tell you within minutes if things got worse. It also means changes designed to be reversible. Database changes are the classic example. With parallel change (also called expand and contract), you add the new column, migrate readers and writers over in separate steps, and only remove the old column once nothing uses it (ParallelChange). Every step can ship and roll back on its own.

A delivery team reviews environment checks and a rollback plan together before a release.
Continuous delivery is a habit: the team keeps the product ready to release, so shipping is just another Tuesday.

CD isn't only for web startups. DORA says it applies to firmware, mobile apps, mainframes and regulated environments, and recommends starting there even if you never move to continuous deployment. Their research links it to less deployment pain and less anxiety about pushing to production (DORA: Continuous delivery). That last part rings true for anyone who has done a Friday-night release with a 40-step checklist.

Continuous deployment is a choice

Once releasing is routine, you can decide whether a person still needs to press the button. Some teams drop it, and every passing change goes live many times a day. That works well when changes are small, monitoring is good and feature flags control who sees what. Other teams keep a manual approval for good reasons: a regulator wants a sign-off, a contract defines release windows, an app store review sits in the middle, or marketing needs the launch on a specific date.

Either way, the engineering bar is the same. Continuous delivery says you could ship any good build. Continuous deployment says you do. The second is a business decision built on top of the first.

Where feature flags fit

Feature flags are often the glue between the two. They let half-finished work sit in the mainline, switched off, so you can integrate daily without showing users an incomplete feature. Fowler lists this under "hide work-in-progress" in his CI practices. The catch is that every flag is a hidden branch in your code. Flags need an owner and an expiry date, or the pipeline stays green only because nobody tested the combination of flags production is actually running. The details are in Feature Flags: Deploy Today, Release When You're Ready.

Engineers watch rollout metrics and feature flag states on a shared screen during a staged release.
Flags let you merge daily and release on your own schedule, as long as someone owns each flag and removes it when it's done.

Which one hurts on your team?

Good CI/CD ends up boring, in the best way. Small changes merge all day. Tests answer within minutes. Releases follow the same steps every time, and rollback has been practiced. When something breaks, you can see which change, which environment, which flag and which metric moved.

If yours doesn't feel like that yet, figure out which part hurts:

  • Merging is painful, conflicts are big and the mainline is often red: work on CI. Shorter branches, faster builds, and a rule that a red mainline gets fixed or reverted first.
  • Code merges fine, but releases are scary, manual or need a weekend: work on CD. Automate the deploy, make migrations reversible, add smoke tests and a rollback path.
  • Releases are routine and nobody worries about them: now continuous deployment is worth a conversation.

Something to try this week: time your mainline build and count your open branches older than three days. Those two numbers will tell you more about your CI than the name of your CI tool.

What did you think?

Frequently asked questions

What is the difference between continuous integration and continuous delivery?
Continuous integration means everyone merges into the shared mainline at least daily and an automated build with tests checks each merge. Continuous delivery builds on that: the software is kept releasable at any time, so shipping becomes a business decision. CI protects the shared code; CD protects the path to production.
What is the difference between continuous delivery and continuous deployment?
With continuous delivery, any build that passes the pipeline could go to production, but a person may still decide when. With continuous deployment, every passing build goes to production automatically. Continuous deployment depends on continuous delivery being in place first.
Is running CI on feature branches the same as continuous integration?
Not really. If the branch pulls in mainline but never pushes back, Martin Fowler calls it semi-integration: the tests pass on your branch, but nobody else sees your changes until you merge, maybe days or weeks later. Real CI means merging back to the mainline at least daily. DORA's research describes three or fewer active branches and merging to trunk at least once a day.
Can regulated teams practice continuous delivery?
Yes. DORA says continuous delivery applies to firmware, mobile apps, mainframes and regulated environments. Those teams may keep a manual approval before production, which means they practice continuous delivery without continuous deployment.