CI/CD pipeline
Tags: circleci, cicd
Published: 2021-09-25 09:57:35

##What is CI?
**CI** is **Continuous Integration**. It is a way-of-work that required teammates to integrate their work regularly. For each integration, the host server will do a series of steps to detect potential issues, automate repetitive manual processes, like test, build....

##What is CD?
**CD** is **Continuous Delivery**. This process will automatically deploy every change in team code to the testing or staging environment. Besides, It also allows developers to set up other steps like system testing, performance testing... before actually deploy it to the production environment.

In addition, **CD** can stand for **Continuous Deployment** (they are all CD in short form =) ). Continuous Delivery is a technique to auto-deploy code change to the staging environment, but manually deploy to the production, and Continuous Deployment is a technique to auto-deploy to **production**.

Basically, the staging and production environments have the same configuration. However, the production is a serious case, we don't want to make any mistakes on it. So, we usually choose manual deployment for the production.

##CI/CD process
Different processes are depending on companies. Below one is applied in most of my projects.

![cicd-process](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n1qttp4a55b9io0q6ebu.png)
 
- **Step 1 [Hand]:** Init repository with, usually, master, staging, and develop branch.
- **Step 2 [Hand]:** Developer will do their jobs in a **new branch**, then create **Pull Request (PR)** to start **Peers Review** process. The new feature will be pushed to the **develop** branch when the PR is accepted.
- **Step 3 [Pipeline]:** After pushing code to the **develop** branch, CI/CD pipeline is triggered to process testing. If it is passed, The feature will be deployed to the **develop** environment.
- **Step 4 [Hand]:** Tester/QE will perform testing before confirming that the new feature is good to go.
- **Step 5 [Hand]:** Developer create **PR** to merge code from the **develop** branch to the **staging** branch.
- **Step 6 [Pipeline]:** CI/CD pipeline is triggered to process another test suite. If it is passed, the new feature will be deployed to the **staging** environment.
- **Step 7 [Hand]:** Tester/QE will perform testing on the **staging** environment.
- **Step 8 [Hand]:** Developer create **PR** to merge code from the **staging** branch to the **master** branch.
- **Step 9 [Pipeline]:** CI/CD pipeline finishes its job, and the new feature will be deployed on production.
- **Step 10 [Hand]:** Tester/QE need to deal with the production environment. If it is not ok, developer will roll back the previous version.
- **Step 11 [Hand]:** Pray!!!🙏🤞

##Pipeline tools
With the movement of DevOps methodologies and Agile culture, a lot of good CI/CD tools are developed. Depending on your favor, you can find one [here](https://www.katalon.com/resources-center/blog/ci-cd-tools/). In this series, I will use [CircleCI](https://circleci.com/).

[Paypal](https://paypal.me/DantisMai).

_this is the first artical of **CI/CD with CircleCI on Heroku** series. Honetly, I had a lot of fun when trying to build a CI/CD pipeline for my side project, and I hope you will too._
_I am really happy to receive your feedback on this article. Thanks for your precious time reading this._