The software world has undergone many changes over the years. This vast sector has proven its importance not only in terms of providing employment but also in the day-to-day lives of people. Let’s talk about a small part of this software world – Jenkins. Jenkins is a tool that makes the work of developers easier and the development process of an application smoother. Before you know more about Jenkins, you need to know about Continuous Integration. There were some setbacks in software development before Continuous Integration. In Continuous Integration, the developers make changes to the source code repository. After the entire source code is written, the software will be built with specific tools. The developed software deploys the test server for testing. If there is any bug in the code, the developers are notified with the help of a feedback loop. In the case of no bugs, the application is automatically deployed to the production server for release. In this article, we will discuss all about Devops & Jenkins
The following are the main flaws in the older system –
1. The developer has to wait a long time to get the test results. Because the application will be deployed to the test server, only after the entire application is built. The whole process is time-consuming. Developers have to wait a long time to get test results.
2. The entire source code is first built, then it is tested. So developers have to go through the source code to find bugs. This is frustrating and time-consuming.
3. They were wasting a lot of precious time fixing and locating a bug instead of developing a new application.
Continuous Integration solves all these problems by –
1. Developing, testing and deploying the application on the go and notifying the developers if there is any bug on any code when they are writing it themselves.
2. Developers won’t have to go through the entire source code as they know exactly where the bug is. They have to make changes to that specific part only.
With the help of Continuous Integration, developers will be making changes to the source code. These commits will be pulled by the continuous integration server and built, tested and deployed to the production server for release and the developers will get constant feedback on their application. There are specific tools for Continuous Integration.
Jenkins is an open source of continuous integration tools. It is written in Java. Jenkins carried out this continuous Integration with the help of Plugins. Jenkins has over thousands of plugins. It is the most widely accepted integration tool, mainly for this reason. It supports well over a thousand plugins. Jenkins has various plugins for various purposes like notification, deployment, compiling, testing etc. Jenkins has plugins for testing like JUnit, for reports it has plugins like HTML Publisher. For notification, it has Jenkins building the Notification Plugin and for deployment and compiling; it has various plugins like deploying plugin and Maven. There are options to install Jenkins with the relevant Plugins and to install the plugins later.
How to install Jenkins?
Since Jenkins has a Java application, you have to first install Java on your computer. Then Install Apache Tomcat Version 9 as it is required to deploy a Jenkins War file. The next step is to download the Jenkins war file. This is required to install Jenkins. Then all you have to do is deploy the Jenkins war file using Tomcat for Jenkins Installation. After Jenkins is installed, install those plugins that are suggested by Jenkins. The above-mentioned steps are for users with CentOS operating system. You can install a CentOS VM if you do not have one.
How to install Plugins?
To install a Plugin, click on the ‘Manage Jenkins’ option, then click on the ‘Manage Plugins’ option. There you can see the list of all the plugins that are currently installed under ‘Installed’ option and the updates available for installed Plugins under the ‘Updates’ option and the available Plugins under the ‘Available’ option. To install a plugin, type the name of the plugin in the selection box, select the plugin and select ‘Install without restart’. The wait for some time and that plugin will be ready to be used.
How Jenkins Work?
When the developers make changes to the source code, it is stored in the Source Code Repository from where the Jenkins server pulls the source code at regular intervals. The Jenkins server pulls out every change that is made in the source code and it will prepare a building. The developers will be notified at the same time. They will be notified about each commitment they make to the source code. The building code is then compiled and the Jenkins server deploys the built code to the test server for testing and the developers will be notified about the test results at the same time. Developers can make changes easily if needed. After the testing phase, the application is then deployed into the production server for release. The concerned team of developers are always notified about the built and test results.
What you must do?
Open your Jenkins Dashboard and create a new item. Provide a suitable name and create a freestyle project. Try it in the Freestyle project as it is the most flexible option, and it is easy to set up. Click ok and go to the source code management tab and select the type of source code management. Then type your repository URL. Then go to the built option and click on ‘Invoke top level Maven Targets’. With the goals tab, you have to compile the codes in the account. You have to type compile and this will trigger the compile built phase of Maven. Then just click and apply. In the dashboard, there is an option ‘Build now’ to trigger the build. Click there and you can see that the building is starting.
Why is Jenkins superior?
There are some factors that make Jenkins superior over so many other continuous integration tools. Jenkins has installed over 147000 active users across the world. The main advantage of Jenkins is that it is connected with over 1000 plugins that allow your integration to be really smooth.
Jenkins Master and Jenkins Slave
There are certain disadvantages in using a single Jenkins server too. You may require different environments for you to build and test. So if you are using a single Jenkins Server, it can’t serve that purpose. If you have heavier work regularly, one single Jenkins server might not be able to handle it. Suppose you need a built job on a windows machine and a Linux box at the same time, you can’t do it with a single Jenkins server. To solve this problem there is Jenkins Distribution Architecture. Jenkins Distribution Architecture consists of a Jenkins Master and Multiple Jenkins Slaves.
Jenkins Master Schedules built jobs and dispatches works to slaves. These Jenkins Slaves are Java executable data presented on remote machines. They perform the jobs as told by the Jenkins master. They can operate on a variety of operating systems. You can operate a particularly built job on a particular Jenkins slave, or you can let Jenkins select a slave to do a particular work.
To add a Jenkins slave, there is an option called ‘Manage Jenkins’ in the Jenkins window box. Click there and select ‘Manage Nodes’. Next selection will be select ‘new nodes’. Click on ‘Permanent Agent’ and give a name to your slave. Then you have to fill out the remote root directory, labels, launch methods etc. in your respective columns.
Jenkins is a tool that is really helpful in the development process of an application. It really helps the continuous integration much more efficiently with its plugins. It is creating a new revolution in software development.