• abhishek srivastava

What is CI and CD ?

CI ( Continuous Integration) and CD ( Continuous Delivery or Deployment) are words that can be heard very often in any software development team nowadays. The organizations which are adopting devOps culture for development and delivery of their applications are familiar with the concept of Continuous Integration and Continuous Delivey or Deployment and realizes how efficiently it is helping them to deliver applications on time and with quality.


In this article, we will discuss the concepts of continuous integration and continuous delivery or deployment . But before that, let us find out why these concepts were introduced.


Version Control and Source Code Management


Source Code Management and Version controlling are important parts of any software development life cycle. Managing source code and versions plays an important role in delivering bug free and high quality software on time. There are many tools which are used for source control and versioning of softwares and applications eg. git, svn, mercurial, perforce etc. These tools creates and manages source code repositories on local machines and remote servers. GitHub, Bitbucket, GitLab etc are repository hosting platforms and co-ordinate parallel development efficiently in a large team.


Earlier, developers used to implement large chunks of code for introducing new functionality in their application and after testing, these code were checked-in into version control systems and shared with other team members. Other team members who were writing the code for the same application used to introduce their code in the version control system. Now, if the developers implemented their code in different files of the application , it was fine to go ahead with merging the code, testing and delivering the aplication. But, if the changes were done in common files, merge conflicts were reported and it used to take lot of time to resolve these conflicts causing delay in delivery of the application.


Let us understand it with an example.


Here is a file called Payment.cpp which requires implementation of payment method using UPI and Credit Card. Let us as sume that UPI payment implementation has been assigned to Mr. Peterson and Credit Card implementation to Mr. Johnson. Before the implementation code may look something like this :


Payment.cpp

 void payment_method(string method, string user_data)
 { 
     if method=="Netbanking"
     {
         //code for netbanking payment
     }
 
 {

Mr. Peterson implemented his code in Payment.cpp for UPI payment and after testing checked-in the code.


Payment.cpp

void payment_method(string method, string user_data)
 { 
     if method=="Netbanking"
     {
         //code for netbanking payment
     }
     else if method=="UPI"
     {
         // code for UPI payment
     }
 
 {

Mr. Johnson also implemented his code for Credit Card payment and after testing checked-in his code.


Payment.cpp

 void payment_method(string method, string user_data)
 { 
     if method=="Netbanking"
     {
         //code for netbanking payment
     }
     else if method=="UPI"
     {
         // code for UPI payment
     }
     else if method=="Credit Card"
     {
         // code for credit card payment
     }
 
 {

Here, as soon as the code owner will try to merge their codes in the master branch, merge conflict will occur asking which part of the code should be merged and ask to resolve it.


To avoid such conflicts , Continuous Integration was introduced.


What is Continuous Integration?

Continuous Integration means integrating or merging small pieces of code continuously in the main or master branch instead of merging large chunks of code after the complete implementation. Developers writing code for any application should merge the small changes done to verify whether the integrity of the application is maintained and merge conflicts are prevented.


Taking above example of Payment.cpp, if Mr. Peterson has implemented his code and checked in, there should be a pipeline running which should build, test, deploy and run the code in development environment and verify that the application works fine wih the new code. This verified code should be then merged with the master branch and used for creating releases.


There are various tools available in the market which help teams to implement Continuous integration. Jenkins is the most popular among them and used as automation server for different processes of software development life cycle.



As soon as the code is checked-in into version control system, jenkins triggers the pipline and all other stages of the pipeline are run validating the new code. After the code of Mr. Peterson has been verified, Mr. Johnson should also follow the same procedure and his code should be merged with the master branch.


Continuous Integration has made significant improvements in the sofware development process and organizations which were releasing new versions of softwares in months are now able to deliver new versions within weeks without having any downtime of the application.


Integrating new changes to the application source code without any conflicts leads teams to deliver different versions of applications quickly in the production environment. Any team which has incorporated Continuous integration in their development cycle will be able to realize Continuous Delivery or Deployment as well.


What is Continuous Delivery or Deployment?

Continuous Delivery or Continuous Deployment refers to releases of different versions of the software in quick succession of time. These versions may include major changes or bug fixes. Python software can be taken as an example which has different versions available for download. Python 3.4 to Python 3.6 is a major change and python 3.6.2 to python 3.6.3 may be a bug fix. These changes are continuously introduced and implemented using a ci/cd pipeline.


Continuous Integration pipeline verifies and integrates small changes continuously and Continuous delivery or Deployment pipeline makes these changes available to the users in a short priod of time.


CI/CD Tools


Some popular CI/CD tools include:

Jenkins: An open source CI automation server, is one of the leading continuous delivery and continuous integration tools on the market. The leading open source automation server, Jenkins provides hundreds of plugins to support building and automating any project. Once a project is tested, Jenkins also supports the ability to deploy code with CD.


GitLab: A web-based Git repository manager with wiki, issue tracking, and CI/CD pipeline features, using an open source license.


JetBrains TeamCity: An integration and management server for CI/CD. TeamCity enables developers to test code before they commit changes to a codebase. TeamCity includes support for Docker, Jira, and other programs.


Bamboo: An on-premises CI tool integrated into Bitbucket that ties automated builds, tests, and releases together in a single workflow.


Codefresh: An easy-to-use tool to ease the migration of a project to Docker containers and to launch built Docker images to a hosted environment.


Travis CI: Lets you automate testing and development and can be synced to your GitHub account.


AWS CodeDeploy: A fully managed deployment service that automates software deployments to a variety of compute services, such as Amazon EC2, AWS Lambda, and on-premises servers.


Conclusion


CI/CD automates the process of integrating, releasing, and deploying software while removing traditional roadblocks. It supports the larger goal of agile methodology to accelerate the software development lifecycle, and it supports the DevOps approach of aligning development and operations teams. Be it startups, small or large organizations, everyone has started adopting ci/cd pipeline in their software developement cycle to deliver high quality and secure products in short period of time. I other words, ci/cd pipeline will become the indispensable part of any software development process in coming future.

11 views0 comments

Recent Posts

See All