What is CI/CD in DevOps?
Tags: devops, git, github, testing
Published: 2021-10-21 22:09:43

We’re only a couple of months away from the new year, which means it’s time to start looking ahead to the tech trends that will dominate the software industry in 2022. As the new year approaches, we want to help you get familiar with upcoming trends so you can be prepared and start taking your skills to the next level. Today, we’ll discuss ***CI/CD***. CI/CD is a DevOps practice that enables software development teams to automate their software development lifecycle. 
 
**We’ll cover**:

* [What is CI/CD?](#whatiscicd)
* [What is continuous integration?](#continuousintegration)
* [What is continuous delivery?](#continuousdelivery)
* [What is continuous deployment?](#continuousdeployment)
* [CI/CD tools](#cicdtools)
* [Wrapping up and next steps](#nextsteps)

<a name="whatiscicd"></a>

## What is CI/CD?

CI/CD is an important **DevOps practice** and an **Agile methodology best practice**. This practice allows development teams to frequently deliver and deploy applications and accelerate the application development process. Introducing a CI/CD pipeline into our software development lifecycle allows us to efficiently **implement automation** and monitor code changes, new features, potential bug fixes, and more.
 
CI/CD typically refers to continuous integration and continuous delivery, but the “CD” can also stand for continuous deployment. Continuous delivery and continuous deployment both refer to automating stages of the CI/CD pipeline, but continuous deployment goes a step further. The purpose of continuous delivery is to make it easy to deploy new code. The purpose of continuous deployment is to allow teams to be **“hands-off”** in the process by automating the deployment stage.

> **Cloud-native CI/CD**: A cloud-native CI/CD pipeline allows us to take full advantage of cloud computing services and features, such as containerization, going serverless, and implementing a multi-cloud infrastructure. A cloud-native app is built to run in the cloud. The cloud-native CI/CD process supports cloud services throughout the software development lifecycle.

### Benefits of CI/CD
There are many benefits of implementing CI/CD into your software development lifecycle. Let’s take a look at some of them:

* **Increased speed**: With an automated CI/CD pipeline, teams can ship changes every hour, day, week, month, etc., and we can optimize each stage of the process. New changes and features can be launched quickly, which allows you to respond to new trends and address any issues that come up.
* **Easy maintenance**: When it’s time to perform routine maintenance, you don’t want all of the system to shut down at once. To address this problem, you can create microservices in the architecture of your code so that individual areas of the system are taken down for maintenance instead of the entire system.
* **Improved collaboration and visibility**: A CI/CD pipeline allows many people to get involved in the process, which promotes visibility and collaboration across different teams and orgs.
* **Real-time feedback**: Shipping regular updates allows you to receive more immediate feedback from users. It also allows you to experiment with different features and fixes, and then hear about their performance shortly after deployment.
* **Continuous reliability and continuous testing**: *Continuous reliability*, or test reliability, improves in a CI/CD pipeline. This is because incremental changes are implemented one at a time, which allows for more precise and accurate tests to be conducted continuously.
* **High-quality code**: With CI/CD, your code is tested regularly. This means that you’ll discover bugs sooner and fix them more quickly. 

<br>
 
<a name="continuousintegration"></a>

## What is continuous integration?

Continuous integration refers to the build / integration stage of the software release process. It’s a stage where developers **consistently merge their changes into the main repository** of a version control system (like Git). After these changes are merged into the main repository, automated builds and tests are run. Before code changes are committed, you can run unit tests to verify the code before integrating it into the main repository. If you don’t run the tests yourself, the CI service performs automated tests and builds on any new code changes. 
<br>
 
<a name="continuousdelivery"></a>

## What is continuous delivery?

Continuous delivery expands upon continuous integration. It is a delivery process that allows us to **automatically test and upload code changes to a repository** (like GitHub), and then deploy all code changes to a testing environment or a production environment. With a continuous delivery pipeline, we can further **automate testing** beyond just unit tests and perform UI tests, integration tests, load tests, and more. When we thoroughly test the codebase, we can verify that the application is error-free and ready for deployment. With continuous delivery, the operations team triggers the deployment instead of it happening automatically (this is where continuous deployment comes in).
<br>

<a name="continuousdeployment"></a>

## What is continuous deployment?

It’s common to mistake continuous deployment for continuous delivery. Continuous deployment goes a step beyond continuous delivery. It’s a software release process that refers to the **automatic deployment of applications** into production. Continuous deployment releases the application from the repository to production, which eliminates the need for human interference. Since tests are still implemented throughout the process, problematic code will not be deployed to production. Development teams are notified when tests fail so they can take the necessary steps to fix the problem before deployment.

Continuous deployment is beneficial because it **speeds up the delivery** of the application and the feedback loop with users. It allows teams to increase productivity and efficiency and rapidly push their software to the market. Verified and tested applications can be instantaneously deployed, which allows developers to focus on other tasks, including new features, updates, bug fixes, and more. While there are many advantages to implementing continuous deployment, the initial implementation itself can be expensive. The continuous deployment pipeline may require ongoing maintenance and updates to ensure it runs as smoothly as possible.
<br>

<a name="cicdtools"></a>

## CI/CD tools

A good CI/CD tool can help you create a strong CI/CD pipeline. Popular CI/CD tools include:

* **Jenkins**: Jenkins is an open-source, Java-based automation server that supports building, deploying, and automating software development processes.
* **CircleCI**: CircleCI supports software development and publishing. It allows you to automate the entire pipeline, and integrate with services like GitHub, GitHub Enterprise, and Bitbucket to perform builds when code is committed. 
* **GitLab**: GitLab provides a suite of tools for managing the software development lifecycle. You can perform builds, run tests, and deploy code. It also allows you to build jobs in a VM, Docker container, or a different server.
 
Major cloud providers, such as Microsoft, Amazon, and Google, also offer CI/CD process tools:

* **Azure DevOps**: Azure DevOps provides a variety of CI/CD tools, like Git repo management, testing, reporting, and more. It provides support for Azure, Kubernetes, and VM-based resources.
* **AWS CodePipeline**: AWS CodePipeline is a continuous delivery service that allows you to automate release pipelines. It easily integrates with third-party services like GitHub.
* **Cloud Build from Google Cloud Platform (GCP)**: Cloud Build from GCP is a serverless CI/CD platform that allows you to build software across all languages, such as Java and Go, deploy across multiple environments, and access cloud-hosted CI/CD workflows within your own private network.
<br>

<a name="nextsteps"></a>

## Wrapping up and next steps

Congrats on taking your first step with CI/CD! It’s an important DevOps practice that enforces automation in the building, testing, and deployment of applications. CI/CD is just one part of DevOps. There’s still so much more to learn about DevOps, such as:

* Split API pods
* Collecting and querying metrics
* Creating a remote development environment

To get started learning these concepts and more, check out Educative’s learning path [**DevOps for Developers**](https://www.educative.io/path/devops-for-developers). In this hands-on learning path, you’ll work with popular DevOps tools like Docker and Kubernetes. You’ll learn how to work with Docker containers, the fundamentals of Kubernetes, and more about CI/CD. By the end, you’ll have the skills to excel in any DevOps role.

*Happy learning!*
<br>
 
### Continue learning about DevOps
* [Ansible for beginners: Get started with IT automation](https://www.educative.io/blog/ansible-for-beginners)
* [Chaos engineering 101: Principles, process, and examples](https://www.educative.io/blog/chaos-engineering-process-principles)
* [YAML tutorial: Get started in 5 minutes](https://www.educative.io/blog/yaml-tutorial)