Powered by Blogger.

01 December 2016

Delivering Frequently - CI/CD , DevOps

Posted by: Bhaskar Kulkarni

Many of us in our career have heard or used this sentence one way or the other
"The project is almost done, the only thing remaining is integrating the modules/pieces/component",
And that small task of integration soon becomes a big pain.
Those who have gone through this or anybody with a beating heart, will appreciate the advantages of integrating early.



There are various factors why everybody requires the famous Continuous Integration/Continuous Deployment pipeline, but everyone has a one goal in common "deliver faster". There is a fierce competition out there in the market,. everybody want to go to market quickly get the feedback, come back, respond and go to the market again, There is no point in spending time anywhere else in this feedback loop other than, getting the feedback and implementing/responding to the feedback or change. Any time spend on the feedback loop other than this is wastage.

With most of us adapting to agile methodology which brought the business analyst , developer and tester a lot closer except the guy from IT. Traditionally the release would happen once a year, may be six months , so our guy from IT wont need to interact with others except few days prior to release.

So what is this CI/CD Pipeline?
Delivering has evolved over the period of time, be it consumer goods, heavy machinery or software. Go anywhere the key to deliver faster is Automation and nothing else.

Continuous Integration / Deployment pipeline is a set of tools acting together to make delivery faster. there are lot of tools available in the market, depending on the situation you can pick the correct set of tools suited to your needs.
Before diving into the automation tools and its usage its important to understand the process that needs automation.
Multiple developers work on multiple components of a software system. These individual components need integration, Testing the integrated software gives the confidence that the integration works, Apart from integration the individual components also need review of code and unit testing.
This cycle of code review - unit testing - integration build - integration testing - producing deliverables holds the key to faster releases.
So this workflow of code review - build - unit testing - integration - deployment - integration testing -  producing release artifacts needs automation.

Git - Gerrit - Jenkins - Artifactory , One of the most common and popular chain of tools to do CI/CD. Where in Jenkins plays a pivotal role of workflow controller.

Git - Source repository
Gerrit - Code review and merge tool
Jenkins - Primarily a build server but more than that a excellent platform to design and implement deployment related workflows.
Artifactory - A release artifacts repository.

A single push from a developer triggers a series of events in the CI pipeline
1. Developer pushes a changeset to a special branch on gerrit refs/for/master
2. Gerrit then triggers a jenkins build job , if the build is successful , you get +1
3. A developer then goes to gerrit and and adds a code reviewer
4. Reviewer reviews the code and if everything is good gives +1 as well
5. If either build fails or there are review comments then the process repeats till you get +2.
6. After this a jenkins deploy is triggered which deploys the current branch code to the integration server to do automated integration test
7.If the tests are successful then jenkins publish job is triggered which will publish the release artifacts (jar,war, exe,rpm,docker image) to artifactory.

This is just a typical flow and there can be multiple variations to it. Depending on your requirements number of jenkins jobs will increase and so does the load on the pipeline.

Apart from this pipeline there is another set of tools which enhance the developer productivity.
The above set of tools comes in picture when the developer is done with his coding in his development environment, but sometimes it is required and also a good practice that developer is developing in a production like environment.
Putting together a production like environment requires orchestration. There are multiple tools available for orchestrating building of an environment from ground up.
One of the set of tools that will build your development environment from ground up is,
Vagrant - virtual box / openstack

Vagrant is orchestration tool which can be used to provision build in images on IaaS providers (Infrastructure as a service) , The beauty of vagrant is it can provision a development environment on
a virtual box which you can deploy on your development machine or you can deploy it openstack or any popular cloud provider like AWS, Azure or google cloud. With its plugin architecture you will get almost every functionality that is required for provisioning an environment.

Virtual Box - Virtual box is opensource tool from Oracle which plays virtual machines on your development box. So lets say you are developing on a windows machine and your code in production will go on linux box, You can install Virtual Box on your windows machine and run a linux VM on that virtual box to deploy your code locally on a linux environment.

 This is an introduction to the pipe line and few tools in the pipeline. In coming series we will cover
Few other tools which can be used to build CI pipeline ,
Which pipeline is best suited for you

contd ......

0 comments :

Post a Comment