You are previewing Jenkins: The Definitive Guide.

Jenkins: The Definitive Guide

Cover of Jenkins: The Definitive Guide by John Ferguson Smart Published by O'Reilly Media, Inc.
  1. Jenkins: The Definitive Guide
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. Foreword
    3. Preface
      1. Audience
      2. Book Layout
      3. Jenkins or Hudson?
      4. Font Conventions
      5. Command-Line Conventions
      6. Contributors
      7. The Review Team
      8. Book Sponsors
      9. Using Code Examples
      10. Safari® Books Online
      11. How to Contact Us
      12. Acknowledgments
    4. 1. Introducing Jenkins
      1. Introduction
      2. Continuous Integration Fundamentals
      3. Introducing Jenkins (née Hudson)
      4. From Hudson to Jenkins—A Short History
      5. Should I Use Jenkins or Hudson?
      6. Introducing Continuous Integration into Your Organization
      7. Where to Now?
    5. 2. Your First Steps with Jenkins
      1. Introduction
      2. Preparing Your Environment
      3. Starting Up Jenkins
      4. Configuring the Tools
      5. Your First Jenkins Build Job
      6. Your First Build Job in Action
      7. More Reporting—Displaying Javadocs
      8. Adding Code Coverage and Other Metrics
      9. Conclusion
    6. 3. Installing Jenkins
      1. Introduction
      2. Downloading and Installing Jenkins
      3. Preparing a Build Server for Jenkins
      4. The Jenkins Home Directory
      5. Installing Jenkins on Debian or Ubuntu
      6. Installing Jenkins on Redhat, Fedora, or CentOS
      7. Installing Jenkins on SUSE or OpenSUSE
      8. Running Jenkins as a Stand-Alone Application
      9. Running Jenkins Behind an Apache Server
      10. Running Jenkins on an Application Server
      11. Memory Considerations
      12. Installing Jenkins as a Windows Service
      13. What’s in the Jenkins Home Directory
      14. Backing Up Your Jenkins Data
      15. Upgrading Your Jenkins Installation
      16. Conclusion
    7. 4. Configuring Your Jenkins Server
      1. Introduction
      2. The Configuration Dashboard—The Manage Jenkins Screen
      3. Configuring the System Environment
      4. Configuring Global Properties
      5. Configuring Your JDKs
      6. Configuring Your Build Tools
      7. Configuring Your Version Control Tools
      8. Configuring the Mail Server
      9. Configuring a Proxy
      10. Conclusion
    8. 5. Setting Up Your Build Jobs
      1. Introduction
      2. Jenkins Build Jobs
      3. Creating a Freestyle Build Job
      4. Configuring Source Code Management
      5. Build Triggers
      6. Build Steps
      7. Post-Build Actions
      8. Running Your New Build Job
      9. Working with Maven Build Jobs
      10. Using Jenkins with Other Languages
      11. Conclusion
    9. 6. Automated Testing
      1. Introduction
      2. Automating Your Unit and Integration Tests
      3. Configuring Test Reports in Jenkins
      4. Displaying Test Results
      5. Ignoring Tests
      6. Code Coverage
      7. Automated Acceptance Tests
      8. Automated Performance Tests with JMeter
      9. Help! My Tests Are Too Slow!
      10. Conclusion
    10. 7. Securing Jenkins
      1. Introduction
      2. Activating Security in Jenkins
      3. Simple Security in Jenkins
      4. Security Realms—Identifying Jenkins Users
      5. Authorization—Who Can Do What
      6. Auditing—Keeping Track of User Actions
      7. Conclusion
    11. 8. Notification
      1. Introduction
      2. Email Notification
      3. More Advanced Email Notification
      4. Claiming Builds
      5. RSS Feeds
      6. Build Radiators
      7. Instant Messaging
      8. IRC Notification
      9. Desktop Notifiers
      10. Notification via Notifo
      11. Mobile Notification
      12. SMS Notification
      13. Making Noise
      14. Extreme Feedback Devices
      15. Conclusion
    12. 9. Code Quality
      1. Introduction
      2. Code Quality in Your Build Process
      3. Popular Java and Groovy Code Quality Analysis Tools
      4. Reporting on Code Quality Issues with the Violations Plugin
      5. Using the Checkstyle, PMD, and FindBugs Reports
      6. Reporting on Code Complexity
      7. Reporting on Open Tasks
      8. Integrating with Sonar
      9. Conclusion
    13. 10. Advanced Builds
      1. Introduction
      2. Parameterized Build Jobs
      3. Parameterized Triggers
      4. Multiconfiguration Build Jobs
      5. Generating Your Maven Build Jobs Automatically
      6. Coordinating Your Builds
      7. Build Pipelines and Promotions
      8. Conclusion
    14. 11. Distributed Builds
      1. Introduction
      2. The Jenkins Distributed Build Architecture
      3. Master/Slave Strategies in Jenkins
      4. Associating a Build Job with a Slave or Group of Slaves
      5. Node Monitoring
      6. Cloud Computing
      7. Using the CloudBees DEV@cloud Service
      8. Conclusion
    15. 12. Automated Deployment and Continuous Delivery
      1. Introduction
      2. Implementing Automated and Continuous Deployment
      3. Deploying to an Application Server
      4. Conclusion
    16. 13. Maintaining Jenkins
      1. Introduction
      2. Monitoring Disk Space
      3. Monitoring the Server Load
      4. Backing Up Your Configuration
      5. Archiving Build Jobs
      6. Migrating Build Jobs
      7. Conclusion
    17. A. Automating Your Unit and Integration Tests
      1. Automating Your Tests with Maven
      2. Automating Your Tests with Ant
    18. Index
    19. About the Author
    20. Colophon
    21. SPECIAL OFFER: Upgrade this ebook with O’Reilly
O'Reilly logo

The Configuration Dashboard—The Manage Jenkins Screen

In Jenkins, you manage virtually all aspects of system configuration in the Manage Jenkins screen (see Figure 4-1). You can also get to this screen directly from anywhere in the application by typing “manage” in the Jenkins search box. This screen changes depending on what plugins you install, so don’t be surprised if you see more than what we show here.

You configure your Jenkins installation in the Manage Jenkins screen

Figure 4-1. You configure your Jenkins installation in the Manage Jenkins screen

This screen lets you configure different aspects of your Jenkins server. Each link on this page takes you to a dedicated configuration screen, where you can manage different parts of the Jenkins server. Some of the more interesting options are discussed here:

Configure System

This is where you manage paths to the various tools you use in your builds, such as JDKs, and versions of Ant and Maven, as well as security options, email servers, and other system-wide configuration details. Many of the plugins that you install will also need to be configured here—Jenkins will add the fields dynamically when you install the plugins.

Reload Configuration from Disk

As we saw in the previous chapter, Jenkins stores all its system and build job configuration details as XML files stored in the Jenkins home directory (see The Jenkins Home Directory). It also stores all of the build history in the same directory. If you are migrating build jobs from one Jenkins instance to another, or archiving old build jobs, you will need to add or remove the corresponding build job directories to Jenkins’s builds directory. You don’t need to take Jenkins offline to do this—you can simply use the “Reload Configuration from Disk” option to reload the Jenkins system and build job configurations directly. This process can be a little slow if there is a lot of build history, as Jenkins loads not only the build configurations but also all of the historical data as well.

Manage Plugins

One of the best features of Jenkins is its extensible architecture. There is a large ecosystem of third-party open source plugins available, enabling you to add extra features to your build server, from support for different SCM tools such as Git, Mercurial or ClearCase, to code quality and code coverage metrics reporting. We will be looking at many of the more popular and useful plugins throughout this book. Plugins can be installed, updated and removed through the Manage Plugins screen. Note that removing plugins needs to be done with some care, as it can sometimes affect the stability of your Jenkins instance—we will look at this in more detail in Migrating Build Jobs.

System Information

This screen displays a list of all the current Java system properties and system environment variables. Here, you can check exactly what version of Java Jenkins is running in, what user it is running under, and so forth. You can also check that Jenkins is using the correct environment variable settings. Its main use is for troubleshooting, so that you can make sure that your server is running with the system properties and variables you think it is.

System Log

The System Log screen is a convenient way to view the Jenkins log files in real time. Again, the main use of this screen is for troubleshooting.

You can also subscribe to RSS feeds for various levels of log messages. For example, as a Jenkins administrator, you might want to subscribe to all the ERROR and WARNING log messages.

Load Statistics

Jenkins keeps track of how busy your server is in terms of the number of concurrent builds and the length of the build queue (which gives an idea of how long your builds need to wait before being executed). These statistics can give you an idea of whether you need to add extra capacity or extra build nodes to your infrastructure.

Script Console

This screen lets you run Groovy scripts on the server. It is useful for advanced troubleshooting: since it requires a strong knowledge of the internal Jenkins architecture, it is mainly useful for plugin developers and the like.

Manage Nodes

Jenkins handles parallel and distributed builds well. In this screen, you can configure how many builds you want. Jenkins runs simultaneously, and, if you are using distributed builds, set up build nodes. A build node is another machine that Jenkins can use to execute its builds. We will look at how to configure distributed builds in detail in Chapter 11.

Prepare for Shutdown

If you need to shut down Jenkins, or the server Jenkins is running on, it is best not to do so when a build is being executed. To shut down Jenkins cleanly, you can use the Prepare for Shutdown link, which prevents any new builds from being started. Eventually, when all of the current builds have finished, you will be able to shut down Jenkins cleanly.

We will come back to some of these features in more detail later on in the book. In the following sections, we will focus on how to configure the most important Jenkins system parameters.

The best content for your career. Discover unlimited learning on demand for around $1/day.