CI and CD -- what they are and why they're not the same [Q&A]
You'll often hear CI (continuous integration) and CD (continuous deployment) mentioned in the same breath, often as CI/CD, and indeed both are part of improving the quality, speed and efficiency of software development.
However, Stephen Atwell, principal product manager at Armory, argues that they shouldn't be considered as related functions. We spoke to him to find out why.
BN: Okay, let's start with the easy stuff, what is continuous integration?
SA: In simple terms, continuous integration (CI) is about automating builds. It happens early in the development cycle when teams are coding and completing their work. With CI, developers frequently merge their changes into the main branch, and a CI solution tests those changes by creating a build and running automated tests. If the code doesn't pass those tests, the changes won't merge with the main branch. This helps catch errors early and ensures all code changes work well together.
BN: And continuous deployment and delivery?
SA: In the realm of DevOps, CD can refer to both continuous delivery and continuous deployment, although these terms are often used interchangeably. However, it's important to note they are not exactly the same thing, despite their similarities. Continuous delivery occurs when a built and tested artifact is written to an artifact repository. At this point, users can download it and deploy it to their infrastructure. Continuous deployment requires continuous delivery, but takes it one step further. It automates the process for deploying the artifact to running infrastructure, typically running in staging environments and triggering additional automated tests before finally deploying to all production environments.
BN: Why do you think the two are often conflated?
SA: In part because people like to say 'CI/CD' whether they mean 'Continuous Integration', 'Continuous Delivery' or 'Continuous Deployment'.
Continuous delivery focuses on preparing code changes for deployment by automating the build and testing processes. It ensures all types of code changes, such as new features, bug fixes and configuration changes, are ready for deployment. However, continuous delivery still requires human intervention to push the code to production.
On the other hand, continuous deployment takes automation a step further. It automates the final step of the software delivery process: the deployment itself. Once the code has been approved, tested and deemed ready for deployment, continuous deployment automatically sends it to production without human intervention.
Continuous deployment often leverages advanced deployment strategies like Blue/Green and Canary deployments. These strategies introduce changes to the system gradually, minimizing risks and enabling quick response to any issues that may arise. In case of a failed test, developers can swiftly roll back changes to a predetermined version, minimizing the impact of faulty code on users.
BN: How much of this is about working practices and how much about tools?
SA: You really need to both culturally embrace continuous deployment and have great tooling in order to achieve it.
From a working practices standpoint, test driven development, automated testing, and peer review processes are very very valuable to achieve continuous deployment, but they won’t typically be enough to get a company there. Continuous deployment requires expertise that many application developers lack, or if they have the knowledge or don't have the time to do it manually. Great tooling allows these processes to be automated, and enables application developers who may not be experts in deployment concepts to benefit from common best practices.
Historically there was one way to get continuous deployment at your company -- build your own tooling and scripts for it. This is where Spinnaker, the open source project Armory built itself upon, got started. These days there are many tooling options in this space that have a strong focus on ease-of-use for the developer, which is a key focus for Armory’s products.
BN: What are the key use cases for each?
SA: Let's say a team of game developers are working on a multiplayer online game. They want to create a dynamic and engaging gaming experience while continuously adding new features and updates. They decide to implement continuous delivery and continuous deployment to ensure a seamless gaming experience for their players.
With continuous delivery, the team can constantly release new game features, levels and bug fixes, but they do not automatically reach production. They may just reach an artifact store, or perhaps an internal staging environment. They likely need to invoke a manual process, often involving an entirely different team before they can get any feedback from their actual players.
With continuous deployment, these features can be automatically released to production. During and immediately after release, game metrics and errors rates can be monitored to automatically roll back if the change has unintended consequences. Additionally, feature flagging can be leveraged to expose the feature to a select group of players in order to gather feedback.
Throughout this experiment, the team can continue to optimize the new features and their experience, regularly releasing these updates to production, and seeing how they perform. Once the team is happy with the features behavior, they can just remove the feature flag to enable it for all of their users. Players seamlessly receive all of these updates without any disruptions or downtime.
This enables the game developers to surprise their players regularly with new quests, characters and gameplay improvements. The continuous deployment process enables quick iteration, ensuring players always have fresh content and an engaging gaming experience. Additionally, the team can leverage advanced deployment strategies to gradually roll out major updates, monitor player response and swiftly roll back if any issues arise.
By utilizing continuous delivery and continuous deployment, the game developers create an immersive and ever-evolving gaming world, keeping their players eagerly anticipating what's next and ensuring a fun and enjoyable gaming experience.
Image credit: ArtemisDiana/depositphotos.com