Continuous Integration, Delivery and Deployment
Tags: productivity, software, devops
Published: 2023-04-09 10:48:35

---
title: Continuous Integration, Delivery and Deployment
published: true
date: 2023-01-01 00:00:00 UTC
tags: Productivity,Software,DevOps
canonical_url: https://www.billyokeyo.com/ci-cd/
---

CI/CD is a common term nowadays in the tech world and not everyone might be familiar with it, So what is it?

### Phases of CI/CD Pipeline

#### Key Terms

**CI/CD** is a software development process that automates the deployment of software.

**Continuous Integration (CI)** is a practice of merging all developers working copies to a shared mainline repository, this can happen multiple times per day.

**Continuous Delivery (CD)** is an engineering practice in which teams produce and release value in short cycles.

**Continuous Deployment (CD)** is a software engineering approach in which the value is delivered frequently through automated deployments.

**Pipeline** is a set of data processing elements connected in a series to form a continuous flow of data.

**Infrastructure as Code** is the management of infrastructure using code.

**Testing** is the process of validating the quality of the software.

**DevOps** is a set of practices that works to automate and integrate processes between software development and IT teams.

**Provisioning** is the process of setting up IT infrastructure.

![CI-CD Pipeline](https://www.billyokeyo.com/assets/img/ci-cd-pipeline.png)

### Best Practices for CI/CD

1. Fail fast - set up your CI/CD pipeline to find and reveal failures as early as possible. The faster you find the failure, the faster you can fix it.
2. Measure quality - measure your code quality and test coverage before you deploy.
3. Only road to production - since CI/CD does deployment on your behalf, it must be the only way to deploy and get rid of any manual steps.
4. Maximum automation - if it is a process that can be automated, automate it
5. Config in Code - all configuration code must be in code and versioned alongside production code. This includes CI/CD configuration, and deployment scripts.

### 8 Principles of Continuous Delivery

1. Repeatable reliable process
2. Automate everything
3. Version control everything
4. Bring the pain forward
5. Build-in quality
6. “Done” means released
7. Everyone is responsible
8. Continuous improvement

### Deployment Strategy

- Big Bang - Replace A with B all at once, A is the new version and B is the previous version.
- Blue-Green - Two versions run at the same time, blue is the previous version and green is the new version. The traffic can still be routed to blue while testing green and shifting to green when green is ready.
- Canary - This is also known as the rolling update, after deploying anew version traffic gets started being routed to the new version bit by bit until all the traffic hits the new version. Both versions will coexist for a period of time.
- A/B Testing - Similar to canary, but instead of routing traffic to new version, you test your new version with a subset of users in order to get feedback, then later route all traffic to the new version.

| **Big Bang Pros** | **Big Bang Cons** |
| --- | --- |
| Simplest to understand and perform | Downtime while you are replacing A with B |
|   | Encourages teams to batch up changes into large deploy event |
|   | Requires more testing and cordination |
|   | Features go to market very slowly |

| **Blue Green Pros** | **Blue Green Cons** |
| --- | --- |
| Allows you to test new production deployment without disturbing the old one | More costly infrastructure with two production servers running. |
| If it doesn’t work you can do a fast rollback |   |

| **Canary Pros** | **Canary Cons** |
| --- | --- |
| If there is a problem you can stop the roll out and in turn only a small portion of users will be affected | More costly tham big bang since you will have two production servers running for a period of time. |
|   | Quite a bit more difficult to set up |

| **A/B Testing Pros** | **A/B Testing Cons** |
| --- | --- |
| Get feedback from users on new version | Potential costly method of user acceptance testing |
|   | More difficult to set up than canary |

### Pipeline Building Blocks

1. Build - this involves everything that has to do with making code executable in production.
2. Test - this involves everything that has to do with testing the code and making sure it is working correctly.
3. Analyze - this involves static analysis on the code or checking of dependencies.
4. Deploy - this involves everything that has to do with creating server instances or copying pre-built application files to instance.
5. Verify - this involves any test that can be run against the deployed application.
6. Promote - this involves replacing the current production environment with the new version which was deployed
7. Rollback - this involves rolling back changes in case any verification fails after deployment.

### Characteristics of a Healthy CI Pipeline

- Highest priority when build is broken
- Trusted members of the team
- Have the same abilities as any member of the team
- Enforce team quality rules
- Communicate useful information
- Shorten feedback loops
- Don’t require stacks of documentation
- Automated to the end