You are previewing Jenkins Continuous Integration Cookbook - Second Edition.
O'Reilly logo
Jenkins Continuous Integration Cookbook - Second Edition

Book Description

Over 90 recipes to produce great results from Jenkins using pro-level practices, techniques, and solutions

In Detail

Jenkins is an award-wining and 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 starts by examining the most common maintenance tasks. This is followed by steps that enable you to enhance the overall security of Jenkins. You will then explore the relationship between Jenkins builds and Maven pom.xml. Then, you will learn how to use plugins to display code metrics and fail builds 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.

What You Will Learn

  • Integrate Jenkins with LDAP and SSO solutions

  • Maintain and secure Jenkins

  • Run an integration server firing automatic functional and performance tests

  • Communicate through social media and by plotting custom data

  • Skin Jenkins to your corporate look and feel

  • Refine the use of code metrics to improve quality

  • Write your first custom Jenkins plugin

  • Apply tweaks to optimize your use of Jenkins

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Jenkins Continuous Integration Cookbook Second Edition
      1. Table of Contents
      2. Jenkins Continuous Integration Cookbook Second Edition
      3. Credits
      4. About the Author
      5. Acknowledgments
      6. About the Reviewers
      7. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Maintaining Jenkins
        1. Introduction
        2. Using a test Jenkins instance
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Backing up and restoring
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Checking for permission errors
            2. Testing exclude patterns
          5. See also
        4. Modifying the Jenkins configuration from the command line
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Turning off security
            2. Finding JavaDoc for custom plugin extensions
            3. The effects of adding garbage
          5. See also
        5. Installing Nginx
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Naming logfiles
            2. Backing up configuration
          5. See also
        6. Configuring Nginx as a reverse proxy
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Testing complex configuration
            2. Offloading SSL
          5. See also
        7. Reporting overall storage use
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Deliberately failing builds through log parsing
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Adding a job to warn of storage use violations through log parsing
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Keeping in contact with Jenkins through Firefox
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. RSS credentials
            2. Alternatives to Firefox
          5. See also
        11. Monitoring via JavaMelody
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Troubleshooting with JavaMelody – memory
            2. Troubleshooting with JavaMelody – painful jobs
          5. See also
        12. Keeping track of script glue
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        13. Scripting the Jenkins CLI
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        14. Global modifications of jobs with Groovy
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        15. Signaling the need to archive
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      10. 2. Enhancing Security
        1. Introduction
        2. Testing for OWASP's top 10 security issues
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Target practice with Webgoat
            2. More tools of the trade
          5. See also
        3. Finding 500 errors and XSS attacks in Jenkins through fuzzing
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Improving security via small configuration changes
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Avoiding sign-up bots with JCaptcha
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Defense in depth
            2. More information on bots
          5. See also
        6. Looking at the Jenkins user through Groovy
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Working with the Audit Trail plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. A complementary plugin – JobConfigHistory
            2. Missing audit logs
            3. Swatch
          5. See also
        8. Installing OpenLDAP
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Using Script Realm authentication for provisioning
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Reviewing project-based matrix tactics via a custom group script
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. My own custom security flaw
            2. Static code review, tainting, and untainting
          5. See also
        11. Administering OpenLDAP
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        12. Configuring the LDAP plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. The difference between misconfiguration and bad credentials
            2. Searching
          5. See also
        13. Installing a CAS server
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Backend authentication
            2. An alternative installation recipe using ESUP CAS
            3. Trusting LDAP SSL
            4. A few useful resources
          5. See also
        14. Enabling SSO in Jenkins
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        15. Exploring the OWASP Dependency-Check plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      11. 3. Building Software
        1. Introduction
          1. Jenkins is an enterprise-friendly agnostic
          2. A pom.xml template
          3. Maven changes
          4. Setting up a File System SCM
        2. Plotting alternative code metrics in Jenkins
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Running Groovy scripts through Maven
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Keeping track of warnings
            2. Where's my source?
            3. Maven phases
          5. See also
        4. Manipulating environmental variables
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Running Ant through Groovy in Maven
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Failing Jenkins jobs based on JSP syntax errors
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Different server types
            2. Eclipse templates for JSP pages
          5. See also
        7. Configuring Jetty for integration tests
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Looking at license violations with Rat
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Reviewing license violations from within Maven
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Multiple approaches and antipatterns
            2. Snapshots
          5. See also
        10. Exposing information through build descriptions
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        11. Reacting to generated data with the groovy-postbuild plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        12. Remotely triggering jobs through the Jenkins API
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Running jobs from within Maven
            2. Remotely generating jobs
          5. See also
        13. Adaptive site generation
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Searching for example site generation configurations
            2. Maven 2 and 3 pitfalls
          5. See also
      12. 4. Communicating Through Jenkins
        1. Introduction
        2. Skinning Jenkins with the simple themes plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. CSS 3
            2. Included JavaScript library frameworks
            3. Trust but verify
          5. See also
        3. Skinning and provisioning Jenkins using a WAR overlay
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Which types of content can you replace?
            2. Search engines and robots.txt
          5. See also
        4. Generating a home page
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Creating HTML reports
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Efficient use of views
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Saving screen space with the Dashboard View plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Making noise with HTML5 browsers
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. An extreme view for reception areas
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Mobile presentation using Google Calendar
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        11. Mobile apps for Android and iOS
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Android 1.6 and Hudson apps
            2. Virtualbox and the Android x86 project
          5. See also
        12. Knowing your audience with Google Analytics
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        13. Simplifying powerful visualizations using the R plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. RStudio or StatET
            2. Quickly getting help
            3. For more information
          5. See also
      13. 5. Using Metrics to Improve Quality
        1. Introduction
        2. Estimating the value of your project through sloccount
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Software cost estimation
            2. Goodbye Google code search; hello code.ohoh.net
          5. See also
        3. Looking for "smelly" code through code coverage
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Activating more PMD rulesets
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Throttling down PMD rulesets
            2. The Don't Repeat Yourself principle
          5. See also
        5. Creating custom PMD rules
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Finding bugs with FindBugs
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. The FindBugs Eclipse plugin
            2. The Xradar and Maven dashboards
          5. See also
        7. Enabling extra FindBug rules
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Finding security defects with FindBugs
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Verifying HTML validity
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        10. Reporting with JavaNCSS
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        11. Checking code style using an external pom.xml file
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        12. Faking Checkstyle results
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        13. Integrating Jenkins with SonarQube
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. SonarQube plugins
            2. Alternative aggregator – the violations plugin
          5. See also
        14. Analyzing project data with the R plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      14. 6. Testing Remotely
        1. Introduction
        2. Deploying a WAR file from Jenkins to Tomcat
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Creating multiple Jenkins nodes
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Custom setup scripts for slave nodes
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Testing with FitNesse
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Activating FitNesse HtmlUnit fixtures
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Running Selenium IDE tests
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Triggering failsafe integration tests with Selenium WebDriver
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Creating JMeter test plans
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Reporting JMeter performance metrics
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        11. Functional testing using JMeter assertions
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        12. Enabling Sakai web services
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        13. Writing test plans with SoapUI
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        14. Reporting SoapUI test results
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      15. 7. Exploring Plugins
        1. Introduction
        2. Personalizing Jenkins
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Testing and then promoting builds
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Fun with pinning JSGames
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Looking at the GUI samples plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Changing the help of the FileSystem SCM plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Adding a banner to job descriptions
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Creating a RootAction plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Exporting data
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Triggering events on startup
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        11. Groovy hook scripts and triggering events on startup
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        12. Triggering events when web content changes
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        13. Reviewing three ListView plugins
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        14. Creating my first ListView plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      16. A. Processes that Improve Quality
        1. Fail early
        2. Data-driven testing
        3. Learning from history
        4. Considering test automation as a software project
        5. Visualize, visualize, visualize
        6. Conventions are good
        7. Test frameworks and commercial choices are increasing
        8. Offsetting work to Jenkins nodes
        9. Starving QA/integration servers
          1. Reading the change log of Jenkins
        10. Avoiding human bottlenecks
        11. Avoiding groupthink
        12. Training and community
        13. Visibly rewarding successful developers
        14. Stability and code maintenance
        15. Resources on quality assurance
        16. And there's always more
        17. Final comments
      17. Index