What is Jenkins DevOps.

Ranjit Saini
5 min readOct 7, 2020

What is DevOps?
DevOps is a software development approach which involves Continuous Development, Continuous Testing, Continuous Integration, Continuous Deployment and Continuous Monitoring throughout its development lifecycle.
To know more about Jenkins: https://www.jenkins.io/

What is Jenkins?
It is an open source automation tool written in java with plugins built for Continuous Integration purpose. Plugins allows integration of various DevOps stages.

Why we use Jenkins?
According to above screen, Developer check in the code into some shared repository (Git, TFS etc.). When you going to run a build and suppose there is a bug in code and build failed. It is very difficult to identify what exact code failed the build and at what point bug introduced in the code. Then you need to go back and check the code that was created in that day. It is a lot of confusion.
So here we introduced Jenkins. As soon as any developer commit the code in shared repository, Jenkins will take that latest code and trigger a build. If there is any error or build failed, you will get notification as soon as build complete. If there is any issue due to any commit, we can reverse that code. No need to find out what route cause break the build.
When build run successfully then Jenkins trigger the test and send back to the report.

What is a Pipeline?

The Pipeline defines a set of action that Jenkins will execute in order to test, build and deploy your application. You can define Stages per branches, run commands in parallel, define environment variables and much more.

Here is the complete flow of the system:
a. You made some changes in your project.
b. You push those changes in GitHub on master or any branch.
c. GitHub will notify Jenkins about the new push. ( We will configure it )
d. Jenkins will then run the commands you ask it to run.
Those commands will contain the following.
1. Test script.
2. Deployment script (Deployment script will be added to Project only and Jenkins will use that to communicate to Server and perform the push.)

Step to create repository at GitHub Account:
1. Go to https://github.com/ and register it if you don’t have account and login into the GitHub account.
2. After login, create a new repository, clone the project on your local system using the following command.
git clone https://github.com/<username>/repo-name.git
3. Now do your code and commit the changes by using below command
git commit -m “first push” and push the changes by using below command
git push
4. When any changes i.e. commits are pushed to GitHub repository, we need a mechanism to notify that event to our Jenkins Server which we going to configure in next section.
GitHub allows us to add Webhook services to achieve same. Open GitHub repository, go to settings and click “Webhooks and Services” from side panel. Click on “Add Services” and search Jenkins, click on “Jenkins GitHub Plugin”.

After that, add the webhook URL which is in the following format.
http://yourdomain.com-OR-IP/github-webhook

Click on Add Service and you are good.
5. Now download the Jenkins from https://www.jenkins.io/ link.
6. Go to command prompt (windows) | terminal(mac)
7. If download file is jenkins.war then go to folder directory where you have place Jenkins file and run the command -java -jar jenkins.war otherwise just click on execution file and install the Jenkins.
8. After installation, Jenkins will automatically start itself and you can visit the domain-name:8080 to access it.

We have installed Jenkins, let’s add GitHub plugin in Jenkins in order to integrate the project.

Adding GitHub plugin in Jenkins

Click on “Manage Jenkins” and then click on “Manage Plugins”.

Now search for “GitHub” from search bar placed at right side of the screen and choose the GitHub plugin.

Click on “Install without restart” and in few seconds plugin will be installed.

Click on “New Item” and fill in the proper project name. Choose “Freestyle project” among the options.

In configuration screen, check GitHub project and add the GitHub project link. Under “Source Code Management” select Git and add the Repository URL with .git extension.

You can choose which branches you want to cover up in the deployment process or leave it blank for any branch.

Under “Build Trigger” section select “Build when a change is pushed to GitHub” option. This is very important.

Under “Build” section, Click on “Add build step” button and then click “Execute shell” option.

In that for instance type “npm install” and then click on Save. Here is full-page screenshot.

Make any changes in the project and do the commit and push. As soon as you push new changes Jenkins will show you new build in the project dashboard.

Pros and Cons:

Pros->
1. It is free of cost.
2. Easily configurable — Jenkins can be easily modified and extended. It deploys code instantly, generates test reports. Jenkins can be configured according to the requirements for continuous integrations and continuous delivery.
3. Easy support — Because it is open source and widely used, there is no shortage of support from large online communities of agile teams.
4. Most of the integration work is automated. Hence fewer integration issues. This saves both time and money over the lifespan of a project.
Cons->:
1. Jenkins management is generally done by a single user and that leads to tracking and accountability problems with the pushed code.
2. Jenkins doesn’t allow one developer to see the commits done by another team member, readily. This makes tracking the overall release progress a rather difficult job for larger projects. This can cause a lot of trouble with the release manager.
3. Jenkins doesn’t provide any analytics (there are plugins but they are not enough) on the end-to-end deployment cycle. This again goes back to the lack of overall tracking that contributes to the lack of analytics as well.

Happy reading! Happy coding!

Thank you.

--

--