CICD WITH JENKINS

jayesh jamindar
2 min readAug 9, 2020

As the name suggest, ‘Continous integration and continous deployment’ is a continous cyclic process in which software code is continously pushed, merged, build, deployed, and tested. In a fast paced development cycle, the above process might be cumbersome and time consuming which can affect the delivery cycle. To overcome this, we can automate the entire process with the help of a devops tool.

1. What is DEVOPS ?

DevOps is a collaboration practice among developers, operations team and testers. Jenkins is one of the devops tool which supports numerous plugins for varied devops needs. Jenkins is an open source server developed by apache.
In real world, in a software project team, there are some developers who write code in their local machines and check-in their code in a common development repository may be SVN, bitbucket or github. Now the operations team is reponsible to fetch and build this integrated code and make sure that the integrated code build successfully. After a successful build, operations team has to deploy the code in target environment. Once deployed, Test team has to perform a regression or sanity test suite on the deployed code to make sure that the newly deployed code didn’t break the existing working modules. This continous cycle of check in, build, deploy, and test, is called CI/CD. All these activities can be automated using jenkins devops tool. We’ll see one by one how this can be achieved.

2. Job chaining for building, deploying and testing

We can achieve this with the help of job chaining. I’ve created two freestyle jobs in jenkins. First job will be triggered when a developer pushes his code in remote branch and then his code is merged in master by the approver or reviewer. As soon as the code is merged in master, my first job i.e. ‘test’ will be triggered and it will fetch the development code from bitbucket and build it (Refer below section on how to create a webhook). After successfull building, you can see the dev code is appearing in the workspace of this job. Once successfully build, the same job will deploy the code at some server. In this case, it will deploy the code in tomcat server. And this server is currently running at local host.
Now as soon as the first job is successfully done i.e. successfully build, and successfully deployed, my second job i.e. ‘test2’ will be triggered. This will build an automation script which is residing at another repository and execute the test scripts on the deployed code. This is job chaining. Now in the following sections we’ll see this step by step:

For further reading, visit our article at:

--

--