"Continuous effort—not strength or intelligence—is the key to unlocking our potential."
Jenkins is an open source application written in Java. It is one of the most popular continuous integration (CI) tools used to build and test different kinds of projects. In this chapter, we will have a quick overview of Jenkins, essential features, and its impact on DevOps culture. Before we can start using Jenkins, we need to install it. In this chapter, we have provided a step-by-step guide to install Jenkins. Installing Jenkins is a very easy task and is different from the OS flavors.
We will also learn the basic configuration of Jenkins. We will take a quick tour of some key sections of the Jenkins UI and plugin installations as well. This chapter will also cover the DevOps pipeline and how the rest of the chapters will cover implementing it.
To be precise, we will discuss the following topics in this chapter:
Introduction to Jenkins and its features
Installation of Jenkins on Windows and the CentOS operating system
A jump-start tour of the Jenkins dashboard
How to change configuration settings in Jenkins
What is the deployment pipeline
On your mark, get set, go!
Let's first understand what continuous integration is. CI is one of the most popular application development practices in recent times. Developers integrate bug fix, new feature development, or innovative functionality in code repository. The CI tool verifies the integration process with an automated build and automated test execution to detect issues with the current source of an application, and provide quick feedback.
Jenkins is a simple, extensible, and user-friendly open source tool that provides CI services for application development. Jenkins supports SCM tools such as StarTeam, Subversion, CVS, Git, AccuRev and so on. Jenkins can build Freestyle, Apache Ant, and Apache Maven-based projects.
The concept of plugins makes Jenkins more attractive, easy to learn, and easy to use. There are various categories of plugins available such as Source code management, Slave launchers and controllers, Build triggers, Build tools, Build notifies, Build reports, other post-build actions, External site/tool integrations, UI plugins, Authentication and user management, Android development, iOS development, .NET development, Ruby development, Library plugins, and so on.
Jenkins defines interfaces or abstract classes that model a facet of a build system. Interfaces or abstract classes define an agreement on what needs to be implemented; Jenkins uses plugins to extend those implementations.
To learn more about all plugins, visit https://wiki.jenkins-ci.org/x/GIAL.
To learn how to create a new plugin, visit https://wiki.jenkins-ci.org/x/TYAL.
To download different versions of plugins, visit https://updates.jenkins-ci.org/download/plugins/.
Easy installation on different operating systems.
Easy upgrades—Jenkins has very speedy release cycles.
Simple and easy-to-use user interface.
Easily extensible with the use of third-party plugins—over 400 plugins.
Easy to configure the setup environment in the user interface. It is also possible to customize the user interface based on likings.
The master slave architecture supports distributed builds to reduce loads on the CI server.
Jenkins is available with test harness built around JUnit; test results are available in graphical and tabular forms.
Build scheduling based on the cron expression (to know more about cron, visit http://en.wikipedia.org/wiki/Cron).
Shell and Windows command execution in prebuild steps.
Notification support related to the build status.
Go to https://jenkins-ci.org/. Find the Download Jenkins section on the home page of Jenkins's website.
warfile or native packages based on your operating system. A Java installation is needed to run Jenkins.
Select the native package available for Windows. It will download
jenkins-1.xxx.zip. In our case, it will download
jenkins-1.606.zip. Extract it and you will get
setup.exeand perform the following steps in sequence. On the welcome screen, click Next:
Select the destination folder and click on Next.
Click on Install to begin installation. Please wait while the Setup Wizard installs Jenkins.
Verify the Jenkins installation on the Windows machine by opening URL
http://<ip_address>:8080on the system where you have installed Jenkins.
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repocommand to download
yand it will download the required package to install Jenkins on CentOS. Verify the Jenkins status by issuing the
service jenkins statuscommand. Initially, it will be stopped. Start Jenkins by executing
service jenkins startin the terminal.
Download Java Web Archive (.war) (latest and greatest (1.606)) from http://jenkins-ci.org/.
Open Command Prompt and execute the
java –jar Jenkins.warcommand. Verify the Jenkins installation on the system by opening the
http://<ip_address>:8080URL on the system where you have installed Jenkins.
To verify system properties, visit
http://<ip_address>:8080/systeminfoor click on Manage Jenkins, and then click on System Information to get environmental information to assist troubleshooting.
Jenkins uses Groovy as its scripting language. To execute the arbitrary script for administration/trouble-shooting/diagnostics on the Jenkins dashboard, go to the Manage Jenkins link on the dashboard, click on Script Console, and run
To get more information on third-party libraries—version and license information in Jenkins, go to the Manage Jenkins link on the dashboard and click on the About Jenkins link.
The application development life cycle is a traditionally lengthy and a manual process. In addition, it requires effective collaboration between development and operations teams. The deployment pipeline is a demonstration of automation involved in the application development life cycle containing the automated build execution and test execution, notification to the stakeholder, and deployment in different runtime environments. Effectively, the deployment pipeline is a combination of CI and continuous delivery, and hence is a part of DevOps practices. The following diagram depicts the deployment pipeline process:
Members of the development team check code into a source code repository. CI products such as Jenkins are configured to poll changes from the code repository. Changes in the repository are downloaded to the local workspace and Jenkins triggers an automated build process, which is assisted by Ant or Maven. Automated test execution or unit testing, static code analysis, reporting, and notification of successful or failed build process are also part of the CI process.
Once the build is successful, it can be deployed to different runtime environments such as testing, preproduction, production, and so on. Deploying a
war file in terms of the JEE application is normally the final stage in the deployment pipeline.
One of the biggest benefits of the deployment pipeline is the faster feedback cycle. Identification of issues in the application at early stages and no dependencies on manual efforts make this entire end-to-end process more effective.
In the next chapters, we will see how Jenkins can be used for implementing CI practices in modernizing IT.
Q1. What is Jenkins?
A continuous integration product
A continuous delivery product
Q2. What makes Jenkins extensible?
Open Source Distribution
Q3. Which command is used to run the Jenkins installation file in the
Q4. How do we get system information on the Jenkins dashboard?
Q5. How do we change global settings for configuration on the Jenkins dashboard?
Click on the Manage Jenkins link on the dashboard
Click on the Credentials link on the dashboard
Q6. What is the deployment pipeline?
Continuous Integration Practices
Continuous Delivery Practices
Demonstration of automation involved in the application development life cycle
None of the above
Q7. Explain the benefits of the deployment pipeline?
Faster feedback cycle
Identification of issues in an application at early stages
No dependencies on manual efforts
All of the above
Congratulations! We reached the end of this chapter and hence we have Jenkins installed on our physical or virtual machine, and you are ready to go to the next chapter. Till now, we covered the basics of CI and the introduction to Jenkins and its features. We completed the installation of Jenkins on Windows and CentOS platforms. We also completed a quick tour of features available in Jenkins's dashboard. In addition to this, we discussed the deployment pipeline and its importance in CI.
Now that we are able to use our CI server, Jenkins, we can begin creating a job and verify how Jenkins works.