Share with friends
In software development, you have heard the terms like SDLC, DevOps, CI/CD, CI/CD pipeline, etc. These 4 terms are connected with each other. To understand what is CI/CD, let's take a real-life example of Netflix.
Netflix is a leading streaming platform that a large number of users use on a daily basis. An organization like Netflix needs to provide a seamless experience to its users.
If there is a new web series that is to be released on Netflix so that users can access it. Now, the challenge is to set up a duration for the deployment i.e., the release of new content on the platform without harming the user experience. New content must be loaded without interruptions in the end users' watching experience.
The team will first write the code to include the new feature and would need to update the application or the website. The code wouldn't be written in a single stretch so, there comes a need to merge small iterations of code at regular intervals. The code would be automatically built and tested to detect any errors that might arise.
Now, if new web series is to be launched in multiple languages, there would be a need to test audio and caption scripts and check the video's quality.
After all the tests are passed and the quality of the series is assured, the series is deployed on the production environment without any downtime and the user can watch the series as soon as it is uploaded on the platform.
What is CI?
CI stands for Continuous Integration. In this, a fraction of the code is pushed into the code's repository and is tested and merged continuously. The code would be auto-fetched by the CI server. The CI server is responsible for building, testing, and merging. In the build phase, the server tries to find out the syntactical errors, if any, in the code.
The error-free code is sent to the testing team for testing against possible bugs and testing the output of the product by conducting some unit and integration tests. The code would then be merged. The developer could learn changes/errors in the code then and there or if the code has been merged.
What is CD?
CD stands for Continuous Delivery or Continuous Deployment. Continuous Delivery is the process of releasing the code automatically to the repository and Continuous Deployment is the process of deploying the code automatically to the production environment.
The integrated code is released into the repository and deployed to the end user. It is beneficial for the continuous releases of the code and also to provide a seamless experience to the end user in case of new releases without any downtime. Any new feature which is included in any product at any time could be provided to the user directly and in a shorter time span.
What is CI/CD Pipeline?
The pipeline is a logical entity that involves a series of steps of a Software Development Life Cycle(SDLC) from development to deployment. A CI/CD pipeline is an automated process for the SDLC to minimize human intervention and sustainable release of the software.
CI/CD pipeline solves the problem of delay in delivery of the product and reduces the time in fixing the errors in the code by providing regular feedback to the developers.
To know why CI/CD is important for your organization then must read our blog - Why Do You Need CI/CD at Your Organization?
Basic Steps in CI/CD Pipelines
1. Source Stage
The code is pushed into a repository where the source code is managed. The developer pushed the control in this repository which is generally stored in a version control system. The repository will store everything needed to build the project.
2. Merging
The code is merged continuously in small segments in frequent time intervals to avoid processing large bulk of code in the end.
3. Automated Builds
The code is built automatically. The CI process packages and compiles the code automatically. This helps in the detection of syntactical errors if any in code and could be provided to the developer directly.
4. Unit Tests
There is continuous testing of the built code to fetch and detect any error if there. The compiled code is tested against certain standards before deployment. Unit tests are generally easy to write and economical to maintain.
5. Frequent Iterations
There are multiple short-timed iterations of the code rather than a large iteration containing large lines of code. The code should be committed at regular intervals to avoid any kind of code discrepancies that might arise.
6. Stable Testing Environments
There should be dedicated environments to test the code. It is always advised to have a cloned environment of the production environment. The code should be tested only in this cloned version of the environment and the live production environment should remain isolated from the testing process. The aim of this is to detect any possible bugs that might arise in the project and to test on standardized test cases to check if the project performs successfully against the desired parameters.
7. Deployments
The project which passes through all the stages of automated processing should be ready for deployment purposes and should be deployed on the client side or to the live server. The code in all stages pre and post-deployment should be available to developers at all times. The code should follow CD methodology where any new feature or change which is done by the developer should be reflected directly to the live server without harming the end user's experience.
Share with friends