Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Jenkins 2.x Continuous Integration Cookbook
Jenkins 2.x Continuous Integration Cookbook

Jenkins 2.x Continuous Integration Cookbook: Over 90 recipes to produce great results using pro-level practices, techniques, and solutions , Third Edition

Arrow left icon
Profile Icon Mitesh Soni Profile Icon Berg
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (2 Ratings)
Paperback Oct 2017 438 pages 3rd Edition
eBook
NZ$44.99 NZ$64.99
Paperback
NZ$80.99
Subscription
Free Trial
Arrow left icon
Profile Icon Mitesh Soni Profile Icon Berg
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (2 Ratings)
Paperback Oct 2017 438 pages 3rd Edition
eBook
NZ$44.99 NZ$64.99
Paperback
NZ$80.99
Subscription
Free Trial
eBook
NZ$44.99 NZ$64.99
Paperback
NZ$80.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Jenkins 2.x Continuous Integration Cookbook

Management and Monitoring of Jenkins

In this chapter, we will cover the following recipes:

  • Understanding master/agent architecture
  • Managing Jenkins Build jobs using Eclipse
  • Backing up and restoring Jenkins
  • Command line options in Jenkins using Jenkins CLI
  • Modifying the Jenkins configuration from the command line
  • Managing disk usage
  • Shutting down Jenkins safely
  • Monitoring Jenkins with JavaMelody
  • Monitoring Jenkins job using Build Monitor View
  • Configuring mail notifications
  • Signaling the need to archive

Understanding master/agent architecture

Jenkins supports the master/agent architecture. In master/agent architecture, we can install Jenkins on master and then utilize other agents for distributing the load.

We shoulddelegate Jenkins jobs to agents for execution. This way, we can support multiple executions using different resources.

There are specific scenarios where master/agent architecture is extremely useful, such as following:

  • The Jenkins machine has limited capacity; even with the higher capacity, there will be a time where it can't fulfil all requests. By distributing the load on agent nodes, we can free resources available on the system where Jenkins is installed.
  • Different jobs require different kinds of resources, and they are restricted to specific machines only. In such a case, we can only utilize that machine and it is not possible to configure it on a system...

Managing Jenkins build jobs using Eclipse

Can we execute a Jenkins job from Eclipse? Yes we can! So, let's see how to do that.

Getting ready

  1. Go to Help | Install New Software...:
  1. Add a site for Mylyn and click on Next >:
  1. Review the items to be installed and click on Next >.
  2. Accept the terms of the license agreement and then click on Finish. It will start installing the Mylyn package.
  3. Once it is finished, Restart Eclipse.

How to do it...

Let's see how to trigger a Jenkins build from Eclipse.

  1. In the Windows menu, click on Views.
  2. Select Mylyn and...

Backing up and restoring Jenkins

A core task for the smooth running of Jenkins is the scheduled backing up of its home directory. This is not necessarily all the artifacts, but is at least its configuration and the history of testing, which plugins will need to make reports.

Backups are not interesting unless you can also restore. There is a wide range of stories on this subject. My favorite (and I won't name the well-known company involved) is that, sometime in the early 70's, a company bought a very expensive piece of software and a tape backup facility to back up all the marketing results being harvested through their mainframes. However, not everything was automated. Every night, a tape needed to be moved into a specific slot. A poorly paid worker was allocated the task. For a year, the worker would professionally fulfill the task. One day, a failure occurred and...

Command-line options in Jenkins using Jenkins CLI

You can access various features in Jenkins through a command-line tool.

Getting ready

Download the Jenkins-cli.jar file from the link available on the Jenkins dashboard.

How to do it...

  1. Go to the location where Jenkins-cli.jar is downloaded and execute the java -jar jenkins-cli.jar -s http://localhost:8080/ help command to see the help of CLI commands:
  1. Execute the following commands:
java -jar jenkins-cli.jar -s http://localhost:8080/ version
java -jar jenkins-cli.jar -s http://localhost:8080/ who-am-i
java -jar jenkins...

Modifying the Jenkins configuration from the command line

You may well be wondering about the XML files at the top level of the Jenkins workspace. These are configuration files. The config.xml file is the main one that deals with the default server values, but there are also specific ones for any plugins that have values set through the GUI.

There is also a jobs subdirectory underneath the workspace. Each individual job configuration is contained in a subdirectory with the same name as the job. The job-specific configuration is then stored in config.xml within the subdirectory. It's a similar situation for the users directory: there is one subdirectory per user, with the personal information stored in config.xml.

Under a controlled situation where all the Jenkins servers in your infrastructure have the same plugins and version levels, it is possible for you to test on one...

Managing disk usage

Jenkins stores multiple jobs and the multiple builds created are stored on the machine. It is important to keep track of disk usage, as, over time, builds from multiple projects will take up a lot of space.

Getting ready

Go to Dashboard| Manage Jenkins|Manage Plugins|Available|Install Disk Usage plugin.

How to do it...

This plugin gives details on disk usage on the system where Jenkins is installed.

  1. Go to Dashboard | Manage Jenkins | Disk Usage:
  1. Go to Manage Jenkins and click on Configure System. Go to the Disk usage section and click on Show disk...

Shutdown Jenkins safely

Is it possible to stop executing new builds so that the system can eventually be shut down safely? Let's find out in the following recipe.

Getting ready

You need to have administrative access to Jenkins.

How to do it...

  1. Go to the Jenkins dashboard, then Manage Jenkins Prepare for Shutdown:
  1. Go to the Jenkins dashboard again, then Manage Jenkins to Cancel Shutdown:

Monitoring Jenkins with JavaMelody

JavaMelody (http://code.google.com/p/javamelody/) is an open source project that provides comprehensive monitoring. The Jenkins plugin monitors both the master instance of Jenkins and also its nodes. The plugin provides a detailed wealth of important information. You can view evolution charts ranging from 1 day or 1 week to months for the main quantities, such as CPU or memory. Evolution charts are very good at pinpointing scheduled jobs that are resource-hungry.

The Monitoring plugin provides the monitoring of Jenkins with JavaMelody. It provides charts for CPU, memory, system load average, HTTP response time, and so on. It also provides details of HTTP sessions, errors and logs, actions for garbage collection, heap dumps, invalid session(s), and so on.

...

Monitoring a Jenkins Job using a Build Monitor View

The Build Monitor plugin provides a visualization of the status and progress of selected Jenkins jobs. It displays an updated view automatically every couple of seconds using AJAX. It can easily accommodate different computer screen sizes too.

Getting ready

Go to Manage Jenkins | Manage Plugins | Available tab. Install the Build Monitor View plugin:

Go to the Jenkins dashboard.

How to do it...

  1. Click on New View:
Jenkins Dashboard - Create New View
  1. Provide View name and select Build Monitor View. Click OK:
  1. Select...

Configuring mail notifications

How about sending a mail notification when a build is successful or fails?

Getting ready

It is essential to know when something fails so that we can take corrective measures at the right time. You need to have an email account to configure email notifications in Jenkins and SMTP details.

How to do it...

  1. Go to Manage Jenkins and go to the E-mail Notification section. Provide all the necessary details based on the email account:
  1. In the build job where you want to configure mail notifications, go to Post-build Actions and select E-mail Notification...

Signaling the need to archive

Each development team is unique. Teams have their own way of doing business. In many organizations, there are one-off tasks that need to be done periodically. For example, at the end of each year, making a full backup of the entire filesystem.

This recipe details a script that checks for the last successful run of any job; if the year is different to the current year, then a warning is set at the beginning of the job's description. Thus, it is hinting to you that it's time to perform an action, such as archiving and then deleting. You can of course programmatically do the archiving. However, for high-value actions, it is worth forcing interceding, letting the Groovy scripts focus your attention.

Getting ready

...
Left arrow icon Right arrow icon

Key benefits

  • Explore the use of more than 40 best-of-breed plug-ins for improving efficiency
  • Secure and maintain Jenkins 2.x by integrating it with LDAP and CAS, which is a Single Sign-on solution
  • Efficiently build advanced pipelines with pipeline as code, thus increasing your team's productivity

Description

Jenkins 2.x is one of the most popular Continuous Integration servers in the market today. It was designed to maintain, secure, communicate, test, build, and improve the software development process. This book will begin by guiding you through steps for installing and configuring Jenkins 2.x on AWS and Azure. This is followed by steps that enable you to manage and monitor Jenkins 2.x. You will also explore the ways to enhance the overall security of Jenkins 2.x. You will then explore the steps involved in improving the code quality using SonarQube. Then, you will learn the ways to improve quality, followed by how to run performance and functional tests against a web application and web services. Finally, you will see what the available plugins are, concluding with best practices to improve quality.

Who is this book for?

If you are a Java developer, a software architect, a technical project manager, a build manager, or a development or QA engineer, then this book is ideal for you. A basic understanding of the software development life cycle and Java development is needed, as well as a rudimentary understanding of Jenkins.

What you will learn

  • Install and Configure Jenkins 2.x on AWS and Azure
  • Explore effective ways to manage and monitor Jenkins 2.x
  • Secure Jenkins 2.x using Matrix-based Security
  • Deploying a WAR file from Jenkins 2.x to Azure App Services and AWS Beanstalk
  • Automate deployment of application on AWS and Azure PaaS
  • Continuous Testing – Unit Test Execution, Functional Testing and Load Testing

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 30, 2017
Length: 438 pages
Edition : 3rd
Language : English
ISBN-13 : 9781788297943
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Oct 30, 2017
Length: 438 pages
Edition : 3rd
Language : English
ISBN-13 : 9781788297943
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total NZ$ 224.97
Continuous Delivery with Docker and Jenkins
NZ$71.99
Jenkins 2.x Continuous Integration Cookbook
NZ$80.99
Learning Continuous Integration with Jenkins
NZ$71.99
Total NZ$ 224.97 Stars icon

Table of Contents

10 Chapters
Getting Started with Jenkins Chevron down icon Chevron up icon
Management and Monitoring of Jenkins Chevron down icon Chevron up icon
Managing Security Chevron down icon Chevron up icon
Improving Code Quality Chevron down icon Chevron up icon
Building Applications in Jenkins Chevron down icon Chevron up icon
Continuous Delivery Chevron down icon Chevron up icon
Continuous Testing Chevron down icon Chevron up icon
Orchestration Chevron down icon Chevron up icon
Jenkins UI Customization Chevron down icon Chevron up icon
Processes that Improve Quality Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(2 Ratings)
5 star 0%
4 star 50%
3 star 0%
2 star 50%
1 star 0%
PA Nov 19, 2017
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Good Book for beginners and User management is covered in detail for Authentication.
Amazon Verified review Amazon
Jurijs Kolomijecs Feb 21, 2018
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
Although this book contains lots of recipes for Jenkins, there is not much information:* First of all, there are extremely lots of screenshots. Too much! Each and every click is followed by a screenshot, resulting in several pages how to create a Freestyle project.* Secondly, build log. C'mon, why would reader wants to read 3 pages of build log!?* There is no hardcore at all. No recipe I can easily find in web.* The last thing I was upset with: half of material is how to setup environment, for example LDAP server. There are like 10-15 pages about LDAP installation and setup in order to show 2-3 screenshots how to configure Jenkins to use LDAP plugin.I cannot recommend this book to anybody who wants to learn Jenkins.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.