tanksta.github.io

View on GitHub
20 May 2019

A brief introduction in CI/CD

by tanksta

Continuous Integration, Continuous Delivery and Continuous Deployment

In the previous post microservices are described as enabler and prerequisite for Continuous Delivery. In order to understand how microservices can support and enable Continuous Integration and Continuous Delivery, it is necessary to define and delimit Continuous Integration, Continuous Delivery and Continuous Deployment.

Continuous Integration (CI)/ Continuous Delivery (CD) is about automating software projects with the objective to build and deliver projects faster. It is not about using the latest tools, although automation tools are helpful to organize and automate builds. CI/ CD is more than using automation tools, it is an organization method to keep developer teams in synchronization, allowing to get fast feedback about code quality and obtain a delivered artifact, that is traceable back to the corresponding source code.

Continuous Integration

Continuous Integration is an organization method to synchronize the work of developer teams by automated building and testing newly checked-in code to ensure integration with existing code. “Continuous integration refers to the build or integration stage of a software release process and entails both, an automation component (e.g. a CI or build service) and a cultural component (e.g. learning to integrate frequently)” (Amazon Web Services, 2019). Developers are working on a shared version control repository. As new code is checked in, a CI Server detects that new code has been committed and starts a CI pipeline. The pipeline automatically executes a build and runs unit tests against the new code changes to ensure integration with existing code. This forces the developers to check in their changes more frequently to avoid build errors and failure of tests. The developers have to make sure, that their code integrates with other developers’ changes frequently, as future integration of large code changes is harder. It is recommended to use short-lived branches to manage changes and merge frequently into the single mainline branch of the project (Newman, 2015).

Continuous Delivery

Continuous Delivery extends Continuous Integration by preparing the code for release production. Continuous Delivery expands the Continuous Integration pipeline by delivering all code changes to a testing or production environment after the build stage. When properly implemented, developers will always have a deployment-ready build artifact, that has passed through a standardized test process (Amazon Web Services, 2019). After a successful build and unit tests, the build is delivered to an environment, where extended testing and interaction between services can be tested. Usual tests are UI testing, load testing, integration testing and API reliability testing (Amazon Web Services, 2019). Is the tested artifact a container, in Continuous Delivery, it is usually pushed to a container registry to ensure availability of the deployment-ready container build for production.

Continuous Deployment

Continuous Deployment extends Continuous Delivery by automated deployment of a tested build to a production environment. While in Continuous Delivery the build is delivered and tested on a test or staging environment, in Continuous Deployment this tested build is automatically pushed to the production environment. “The difference between continuous delivery and continuous deployment is the presence of a manual approval to update to production. With continuous deployment, production happens automatically without explicit approval” (Amazon Web Services, 2019). This ensures that code changes and updates are deployed to production more frequently and faster. Furthermore, an automated software release process increases efficiency due to build and test automation, increased developers’ productivity and more reliable and stable products. Continuous Integration frees developers from manual build and test tasks and encourage them to merge their changes more frequently to overcome integration problems. As standardized suites of tests are established within the software release process, bugs are discovered earlier and can be resolved before growing into bigger problems.

The following figure illustrates the described relation between Continuous Integration, Continuous Delivery and Continuous Deployment. Relation Continuous Integration, Continuous Delivery and Continuous Deployment

Sources

tags: microservices - ci - cd - Continuous Integration - Continuous Delivery - Continuous Deployment