[ARTICLE]

What is Continuous Deployment and Continuous Delivery?

What is a CD… Continuous Deployment; Continuous Delivery

The process of Continuous delivery or deployment (CD) is typically the latter stage of a CI/CD workflow.  Overall CI/CD is a set of practices that accelerate the pace at which DevOps teams can deliver value to their users. The principal tenet of CI/CD is keeping your codebase in a functional state so that it can be shipped to production at any time. This is typically achieved by moving toward frequent but small and safe changes to the code base rather than the big, high-stakes deployments commonly seen in the past. 

When you see CI/CD, you probably understand that the continuous integration part is the development of a code artifact that is the software that will run in production.  The CD part, broadly, is the process that vets the artifact to allow your DevOps team to quickly and reliably push bug fixes, features, and configuration changes into production. The entire CI/CD process is built on pipelines – a series of automated process steps – that reliably provide the confidence that the code being vetted will perform as expected in the production environment.

Before getting into the CD pipeline process in greater detail, it is important to clarify that CD refers to continuous deployment or continuous delivery.  The distinction is that delivery requires a pause for manual approval before the code is released into production, whereas deployment automates this step. This means that if an artifact successfully passes through the CD pipeline, it is put into production without pause. Continuous deployment is the end goal, and the other CD is a milepost along the way. As most of the CD process is similar, whether pausing at the end of the pipeline or not, we will use CD in this article to encompass both modes.

The benefits of CD pipelines are:

  • Increased code velocity – New features and bug fixes can be deployed more rapidly. Although pipelines can include manual steps, as the testing process is increasingly automated, steps like the process of code testing (acceptance and integration) proceed faster.
  • Reduced costs, faster time to value. The use of CD (and CI) pipelines make it possible to validate and deploy smaller bits of code to production. This means that small improvements, bug fixes, and new features can be rolled out quickly to improve the overall user experience.  Automating pipelines further frees developers from repetitive manual processes (aka toil) to focus on greater value business goals. 
  • Reduced risk. Automation reduces the errors and uncertainty of manual processes. Validated pipelines that include appropriate tests engender confidence in the reliability of new code behaving in production.  An added tool in the CD arsenal is blue/green deployments and canary releases that add a final safety measure to deployment processes that ensure customers are not impacted by unexpected breaks caused by new code.

CD Pipelines – Release vs. Build

Creating release branches, a branch cut off the master branch to support a release, has been a traditional practice. This candidate code is isolated from any changes to master that might cause instability and allow the team managing the release to fix problems in the code to ensure a smooth deployment. This means that the code being deployed may diverge from master as bugs are fixed, or configurations are updated on the release branch. 

The modern CI/CD process works differently as at the end of the CD process, the code artifact fed into a CD pipeline is a static snapshot.  The CD pipeline is defined by a series of stages that will conduct appropriate tests to ensure confidence in its functionality and then deploy it to production.  Automating the process increases confidence by eliminating sources of human error that can be lost when using manual processes, such as inconsistent changes to configurations or loss of bug fixes.

continuous delivery

CD Pipeline Stages

Testing

When a CD process is triggered (quite possibly by a successful completion of a CI pipeline), the code artifact will pass through a series of stages in the CD pipeline. The artifact is first deployed to a test environment and then run through tests to validate the code. Development environments should be identical to production environments though they may be smaller versions. A variety of tests for basic functionality and performance under load can be used to verify the code’s behavior. At the successful completion of the testing stage, the code is versioned. It may then either automatically be deployed, or there may be a manual gate in continuous delivery.

Deployment

Once the testing stages have been passed, the versioned code is deployed.  This could be a full deployment on the entire system where all the old versions are rolled out at the same time to production. To those that are a little bit more risk-averse, especially if your production and test deployment environments differ, blue/green deployments or canary releases add the ability to ensure zero downtime deployments and simplify version rollbacks should unpredicted issues arise. 

Conclusion

Continuous deployment pipelines provide a means of testing code updates in a manner that allows immediate deployment into production environments. Progressive deployments models allow the gradual release of deployable code into production to further reduce the risk of customer impact.  Automated CD pipelines reduce the chance of introducing human error, encourage more frequent, smaller, and faster deployments of new code, leading to increased value for both customers and the company. 

After your code is successfully deployed and the production environment has changed, performance criteria may have changed. Even when testing performance in the dev deployment environment, real-world traffic/performance is still difficult to adequately test and tune. Opsani’s continuous optimization solution works to tune performance and cost of your application in production safely. It is further possible to pretune a deployment candidate in the dev environment.  To see Opsani in action for yourself, sign up for a free trial and see how your application performance can benefit from continuous optimization.