Continuous Integration vs Continuous Delivery vs Continuous Deployment

Jorge Acetozi
Nov 15, 2017 · 5 min read

Continuous Integration, Continuous Delivery or Continuous Deployment? There is always a great misunderstanding of these terms out there! Let’s clarify them in only 5 minutes.

Continuous Integration

Continuous Integration (CI) is a development practice from Extreme Programming that requires developers to integrate code into a mainline as often as possible, at least once a day, and each check-in is then verified by an automated build that compiles the code and runs the suite of automated tests against it, allowing teams to detect problems early.

In the Git context, the mainline often turns out to be the master branch and each check-in is a new commit that emerges into the remote repository.

Implementing continuous integration provides several benefits:

• Merge hell, that is, endless merge conflicts while merging code into the mainline, is avoided because the code should be integrated to the mainline as often as possible (at least once a day).

• Allows detecting errors quickly as automated tests run on every single commit that checks-in the remote repository. Hence, fewer bugs get shipped to production.

• When an error is detected, it’s much easier to fix because the amount of code involved in each commit is much smaller.

• Promotes human communication earlier when merge conflicts occur. People can sit together and understand how their codes are actually influencing the other’s code.

• Building the release is easy as all integration issues have been solved early.

However, everything comes at a price. To implement continuous integration, the development team must understand that:

• Tasks should be split as small as possible in the planning stage because the code should be developed (including automated tests) and integrated into the mainline as often as possible, at least once a day.

• Automated tests should be present for each new feature, improvement or bug fix. They will ensure that a change (even a small one) is not breaking any other part of the system.

The second part of the definition states that “each check-in is then verified by an automated build that compiles the code and runs the suite of automated tests”. In order to run automated tests on every single commit that emerges into the remote repository mainline, the team will need to set up a Continuous Integration server. The essential purpose of the CI server is to run automated tests on every new commit that emerges into the remote repository mainline, but it is actually capable of doing much more than that, such as issuing custom notifications when a test or build fail, triggering releases generation, triggering deployments to a specific environments, and so on. A well-known CI server is Jenkins, a leading open source CI server written in Java that provides hundreds of plugins to support building, deploying and automating any project.

A smooth Continuous Integration flow will ensure that the mainline is always in a deployable state. Continuous Integration and others Extreme Programming practices such as Automated Tests, Pair Programming, Test Driven Development, Refactoring, and Simple Design are all great contributors to the quality of an application code. If your team doesn’t care for these (and others) techniques, it’s very likely that you cannot ensure that the code actually works as intended. So, how could you have an automated deployment flow if you have no idea whether the code being delivered works or not? That’s the reason why Continuous Integration is a requirement for implementing both Continuous Delivery and Continuous Deployment.

Continuous Delivery

I really like Jezz Humble’s definition of continuous delivery:

Continuous Delivery is the ability to get changes of all types; including new features, configuration changes, bug fixes and experiments into production, or into the hands of users, safely and quickly in a sustainable way.

In other words, when your team really implements continuous delivery what it actually means that the mainline is always in a deployable state, and one could decide to deploy it to production at any time at the touch of a button. This in turns is only possible because when this button is touched, an automated pipeline (a set of automated steps that your code changes goes through until it is finally deployed to production) is triggered. The key element for achieving continuous delivery is automation!

Well, if you can deploy to production at any time, the question is: when is it the right time? Of course, the answer may vary depending on your business requirements, but the truth is that if you want to get the benefits of continuous delivery, you should deploy to production as early as possible to make sure that you release small batches that are easy to troubleshoot in case of a problem.

Continuous Deployment

Continuous deployment is very similar to continuous delivery, but it takes even one step further regarding automation. In continuous delivery, every change pushed to the main repository is ready to be deployed to production, but starting this process still requires human interaction. In continuous deployment, the deployment to production is automatically triggered for every change that passes the test suite.

Continuous Integration vs Continuous Delivery vs Continuous Deployment

As in continuous deployment every change that passes the test suite is deployed to production, it heavily relies on Feature Flags to release features to end users.


This article was based on the contents of my book Continuous Delivery for Java Apps: Build a CD Pipeline Step by Step Using Kubernetes, Docker, Vagrant, Jenkins, Spring, Maven, and Artifactory. Click on the link and download the free book sample (110 free pages!) to learn more about Agile, Continuous Delivery, Scrum, Automated Tests (unit, integration, acceptance and performance tests), Feature Branch, Feature Flags, A/B Tests, Canary Releases, Apache Maven, Artifactory, Docker, Kubernetes and more!

This book will guide you through the implementation of the real-world Continuous Delivery using top-notch technologies that are in high demand by the best companies around the world. Instead of finishing this book thinking “I know what Continuous Delivery is, but I have no idea how to implement it”, you will end up with your machine set up with a Kubernetes cluster running Jenkins Pipelines in a distributed and scalable fashion (each Pipeline run on a new Jenkins slave dynamically allocated as a Kubernetes pod) to test (unit, integration, acceptance, performance and smoke tests), build (with Maven), release (to Artifactory), distribute (to Docker Hub) and deploy (on Kubernetes) a Spring Boot application to testing, staging and production environments implementing the Canary Release deployment pattern to mitigate risks.

This is the book I wish I had found when I was learning about Continuous Delivery; that’s why I wrote it. It will bring to you years of experience implementing Continuous Delivery in many different projects.

jorgeacetozi

Articles about DevOps, tools, software development concepts, best practices, architecture, NoSQL and many other cool stuff! Visit the website: https://jorgeacetozi.com

Jorge Acetozi

Written by

Passionate Software Engineer, author of Pro Java Clustering and Scalability and Instructor. Check out my books at https://jorgeacetozi.com/books

jorgeacetozi

Articles about DevOps, tools, software development concepts, best practices, architecture, NoSQL and many other cool stuff! Visit the website: https://jorgeacetozi.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade