Bar Programming #01 - What is CI/CD and how its works
Tags: productivity, learning, github, docker
Published: 2024-02-28 15:00:00

Today, I will talk about CI/CD, a strategy to create and update as most fast as can. With this tool, you will never need to spend hours merging all branches of your project. 

Obs: For now, I will write in English, because I really focus on devolving my English writing. 

## What is CI/CD?

CI is an acronym to Continuous Integration, with this part, our focus is on to constantly integrate and merge the code. CD Continuous Delivery, and with this, we want constantly to deliver features and updates to our production server. 

For your better understand, I get an infographic from Red Hat website. 


![Red Hat infographic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4t27uh7j0miguoi8aia.png)

(Is hard to see in dark mode)


In a more directly way, CI wants to avoid the merge hell day and the CD wants to make the main branch is updated and ready for deploy. 

## Why would you use CI/CD?

The goal of this strategy is to prevent bugs and conflicts by testing code before merging it, and by maintaining a cycle of constant updates. As applications grow in scope, these techniques help to reduce project complexity and make development more efficient.

Thanks to the automatic tools of CI/CD, human intervention is not necessary when adding a commit to the production area. This means that updates reach the deployment area faster and users receive updates more frequently. This allows their feedback to reach developers sooner.

## Delving deeper into CI

### What is CI?

CI stands for “Continuous Integration”. It is a software development practice that involves frequently merging code changes into a shared repository. This practice helps to prevent bugs and conflicts by identifying and fixing problems early in the development process.

### Why is CI important?

In modern software development, it is common for multiple developers to work on different parts of the same codebase. This can lead to issues when it comes time to merge the changes together. For example, changes made by one developer may conflict with changes made by another developer.

CI helps to prevent these issues by automating the process of merging code changes. When a developer makes a change to the code, they commit the change to a local repository. The CI server then automatically pulls the latest changes from the local repository and merges them into the shared repository.


### How does CI work?

The CI process typically involves the following steps:

- A developer makes a change to the code and commits the change to a local repository.
- CI server pulls the latest changes from the local repository.
- CI server runs a series of tests to ensure that the changes do not break the code.
- the tests pass, the CI server merges the changes into the shared repository.
- the tests fail, the developer is notified and must fix the problem before the changes can be merged.


## Delving deeper into Continuous Delivery (CD) and Continuous Deployment (CD)

What is CD?

CD stands for "Continuous Delivery" and/or "Continuous Deployment." These are two related concepts that deal with the final stages of the software development process.

Continuous Delivery

The goal of continuous delivery is to ensure that a software application can be released to production at any time. This is achieved by using automated tests to verify that the code is working as expected. If the tests pass, the code is automatically deployed to a staging environment. In this environment, the code can be further tested and evaluated before it is released to production.

Continuous Deployment

Continuous deployment is a step beyond continuous delivery. It involves automatically deploying the code to production whenever a change is made to the codebase. This means that new features and bug fixes can be released to users as soon as they are ready.