Knoldus Blog Audio
What is CI/CD
The name CI/CD stands for continuous integration (CI) and continuous deployment (CD). At a high level, this process is responsible for managing the automation of building projects, testing them, and then deploying them to different servers either for testing purposes or production. The CI/CD pipeline typically falls under the responsibility of DevOps.
Let us now concretize this idea by providing an example. The CI process typically starts when a developer pushes to a version control system like Github or Bitbucket on a branch that is monitored by a CI/CD tool. This push will trigger the CI/CD tool that will run a series of automated tests that provide feedback to the developer. Upon passing, the code is stored in the VCS and ends the CI portion of the process. The CD part is the automation of the build process and deployment to servers. This may take the form of building to test servers for smoke, unit, and integration tests, to a staging environment, or building to production.
In this example, the process starts with the push to the VCS. This triggers the CI/CD tool to compile and build the docker container for the program. This step deploys the program on to the testing servers where the smoke, unit, and integration tests are performed, these can be performed in parallel to increase efficiency. Once all the tests pass, the build will be deployed to staging for end-to-end testing by QA and then on to production. Not all CI/CD pipelines will mirror this, however this example is replicated by many companies.
Advantages of CI/CD Pipelines
CI/CD pipelines quickly and effectively inform developers upon pushing code. This standardized feedback loop communicates with the developer about the correctness of their code by running it through a series of automated tests.
Due to this process being almost entirely automated, it greatly reduces the chance of human error. It also drastically speeds up the process by being able to run tests in parallel. Typically, the CI/CD process when done manually involves many repetitive steps each time code needs to be tested and deployed. Automation removes this manual component and allows developers, QA, and DevOps freedom from these monotonous tasks and their associated time costs.
By automating deployment, less people need to be involved in the process. This, along with the increase in speed, allows more frequent builds. More frequent builds enable bugs to be resolved faster and allow more testing by the public (such as daily/weekly/monthly builds separate from the latest stable build). Additionally, these pipelines give QA, management, stakeholders, and others better insight into the status of builds and their timeline.
One of the most common tools to build an automated CI/CD pipeline is Jenkins. Jenkins is an open source automation server. Jenkins is popular due to it working with most technologies and allowing additional plugin support. It can be either used for part of the pipeline or its entirety. It is not only possible, but many times practical, to create the entire process between a code push and the deployment to a production environment using Jenkins.
Jenkins can be run either standalone or within a Java application server. Jenkins can be accessed through its web interface and programs can communicate with it through its REST API. The web UI allows the creation of various scripts to automate the CI/CD pipeline. These scripts can also be put inside special files inside of repositories that Jenkins recognizes and can act upon.