Why CI/CD is important?
Tags: devops, googlecloud, aws, cavepot
Published: 2021-05-03 14:03:24

According to github recent report nearly 60% of survey respondents said their organizations deploy multiple times a day, once a day, or once every few days, which perhaps reflects the large number of responses from smaller (and thus presumably more nimble) companies. Just 11% said they deploy once a month and only 8% said every few months.

This post is intended to share my experience why it's so important to think about these techniques.


##What is? 

We can find lots of definitions over the internet but I like this definition I found on the internet: 

*“Continuous Delivery (CD) allows you to take the code stored in the repository and continuously deliver it to production. CI/CD creates a fast and effective process of getting your product to market before your competition as well as releasing new features and bug fixes to keep your current customers happy.“*

Also I selected some pages you can read more about like Amazon, [Google](https://cloud.google.com/docs/ci-cd) or [Microsoft](https://azure.microsoft.com/en-us/services/devops/pipelines/) among other definitions.

In my opinion is a group of techniques or practices that helps us in the journey to create software products. I will share my experience as a developer to understand why I think it’s important to use those practices.

When we are developing it is common to use our local machines to develop and test the application that we are building. It's ok to do that but at some point we need to create environments where other people can take a look in order to use it or test it. Also we need to provide a way to set up a production environment with high availability and scalability.

To explain ideas I will use a simple web application project with 3 environments: 1) Local for development purposes, 2) Testing for testing purposes and 3) Production environment.



![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4kravqz4qhlsti66wu8l.png)

I will present the steps that we will do periodically in the process of building the web application.

1) Develop and test our features locally.
2) Deploy to our testing environment.
3) Test our old and new features in the test environment.
4) Continue the process of points 1, 2 and 3.
5) Deploy to production.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/goqxde8sq39yokzur3cm.png)


There are a lot of tasks that we need to do in all steps of development. For example creating the environments, the databases and other stuff. For example if we need to deploy to the testing environment we will have to do the following tasks: Update the database, Get the new code, Compile, Publish, Test among other tasks.

Imagine that you have to do all that task manually, also you have to do the same every time you want to deliver a new feature. Even worse, imagine that every environment has more than one machine, load balancer, more than one database. 

Normally we think that we will waste a lot of time automating tasks but trust me that you will save a lot of time if you invest thinking on CI/CD.
 
Let’s start talking about some good practices we apply in this king of projects.


First of all we need to have our code in some repository, we have a lot of options there and we can recomend some of theme [Github](https://github.com/), [GitLab] (https://gitlab.com/). Also Google cloud has his own repository [Cloud Source Repository] (https://cloud.google.com/source-repositories).

Suppose we have three branches: develop, test and production. Each branch will have the code that we need in each environment. Think if everytime we push code to test something will prepare the test environment with the latest change for us. Also the same will happen for production or other environments we could have.

Ideally developers work on their own machines, pushing to different branches with automatic tasks that make the deployment for us. Deployment involves tasks like updating db with new data, compiling code, publishing code, run tests, etc.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kn5idms5xo4xnlnkzmc4.png)

We can automatize the tasks using different technologies that Google, Microsoft or Amazon among others can provide to us. In furute we will be talking about [Cloud Build](https://cloud.google.com/build), the Google tool to do that.

In conclusion for me CI/CD are a group of techniques that make our work easier. It doesn't matter the tools or technologies that you use, It matters if you deliver your code as fast as you can with good quality. 

In future posts I will be talking about some specific tools that Google and Amazon provide to us.