ebook img

Jenkins: The Definitive Guide (Also Covers Hudson) PDF

406 Pages·2011·6.57 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Jenkins: The Definitive Guide (Also Covers Hudson)

Jenkins: The Definitive Guide Jenkins: The Definitive Guide John Ferguson Smart Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo Jenkins: The Definitive Guide by John Ferguson Smart Copyright © 2011 John Ferguson Smart. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]. Editors: Mike Loukides and Meghan Blanchette Indexer: Angela Howard Production Editor: Adam Zaremba Cover Designer: Karen Montgomery Proofreader: Jennifer Knight Interior Designer: David Futato Illustrator: Robert Romano Printing History: July 2011: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Jenkins: The Definitive Guide, the image of an ornate chorus frog, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. Jenkins: The Definitive Guide is available under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-1-449-30535-2 [LSI] 1309980503 Table of Contents Foreword .................................................................. xiii Preface ..................................................................... xv 1. Introducing Jenkins ..................................................... 1 Introduction 1 Continuous Integration Fundamentals 1 Introducing Jenkins (née Hudson) 3 From Hudson to Jenkins—A Short History 4 Should I Use Jenkins or Hudson? 5 Introducing Continuous Integration into Your Organization 6 Phase 1—No Build Server 6 Phase 2—Nightly Builds 6 Phase 3—Nightly Builds and Basic Automated Tests 6 Phase 4—Enter the Metrics 7 Phase 5—Getting More Serious About Testing 7 Phase 6—Automated Acceptance Tests and More Automated Deployment 7 Phase 7—Continuous Deployment 7 Where to Now? 8 2. Your First Steps with Jenkins .............................................. 9 Introduction 9 Preparing Your Environment 9 Installing Java 10 Installing Git 10 Setting Up a GitHub Account 11 Configuring SSH Keys 11 Forking the Sample Repository 12 Starting Up Jenkins 13 Configuring the Tools 17 v Configuring Your Maven Setup 18 Configuring the JDK 19 Notification 20 Setting Up Git 20 Your First Jenkins Build Job 21 Your First Build Job in Action 26 More Reporting—Displaying Javadocs 33 Adding Code Coverage and Other Metrics 34 Conclusion 40 3. Installing Jenkins ...................................................... 41 Introduction 41 Downloading and Installing Jenkins 41 Preparing a Build Server for Jenkins 44 The Jenkins Home Directory 46 Installing Jenkins on Debian or Ubuntu 47 Installing Jenkins on Redhat, Fedora, or CentOS 48 Installing Jenkins on SUSE or OpenSUSE 48 Running Jenkins as a Stand-Alone Application 49 Running Jenkins Behind an Apache Server 52 Running Jenkins on an Application Server 53 Memory Considerations 54 Installing Jenkins as a Windows Service 54 What’s in the Jenkins Home Directory 58 Backing Up Your Jenkins Data 62 Upgrading Your Jenkins Installation 62 Conclusion 63 4. Configuring Your Jenkins Server .......................................... 65 Introduction 65 The Configuration Dashboard—The Manage Jenkins Screen 65 Configuring the System Environment 68 Configuring Global Properties 69 Configuring Your JDKs 70 Configuring Your Build Tools 72 Maven 73 Ant 74 Shell-Scripting Language 75 Configuring Your Version Control Tools 75 Configuring Subversion 76 Configuring CVS 76 Configuring the Mail Server 76 Configuring a Proxy 77 vi | Table of Contents Conclusion 78 5. Setting Up Your Build Jobs ............................................... 79 Introduction 79 Jenkins Build Jobs 79 Creating a Freestyle Build Job 80 General Options 81 Advanced Project Options 82 Configuring Source Code Management 84 Working with Subversion 84 Working with Git 87 Build Triggers 97 Triggering a Build Job Once Another Build Job Has Finished 98 Scheduled Build Jobs 98 Polling the SCM 99 Triggering Builds Remotely 100 Manual Build Jobs 102 Build Steps 102 Maven Build Steps 102 Ant Build Steps 104 Executing a Shell or Windows Batch Command 105 Using Jenkins Environment Variables in Your Builds 106 Running Groovy Scripts 108 Building Projects in Other Languages 110 Post-Build Actions 110 Reporting on Test Results 110 Archiving Build Results 111 Notifications 114 Building Other Projects 115 Running Your New Build Job 115 Working with Maven Build Jobs 115 Building Whenever a SNAPSHOT Dependency Is Built 116 Configuring the Maven Build 117 Post-Build Actions 119 Deploying to an Enterprise Repository Manager 119 Deploying to Commercial Enterprise Repository Managers 123 Managing Modules 123 Extra Build Steps in Your Maven Build Jobs 123 Using Jenkins with Other Languages 125 Building Projects with Grails 125 Building Projects with Gradle 127 Building Projects with Visual Studio MSBuild 130 Building Projects with NAnt 131 Table of Contents | vii Building Projects with Ruby and Ruby on Rails 131 Conclusion 133 6. Automated Testing ................................................... 135 Introduction 135 Automating Your Unit and Integration Tests 136 Configuring Test Reports in Jenkins 137 Displaying Test Results 139 Ignoring Tests 142 Code Coverage 144 Measuring Code Coverage with Cobertura 145 Measuring Code Coverage with Clover 153 Automated Acceptance Tests 155 Automated Performance Tests with JMeter 158 Help! My Tests Are Too Slow! 166 Add More Hardware 167 Run Fewer Integration/Functional Tests 167 Run Your Tests in Parallel 168 Conclusion 168 7. Securing Jenkins ...................................................... 169 Introduction 169 Activating Security in Jenkins 169 Simple Security in Jenkins 170 Security Realms—Identifying Jenkins Users 171 Using Jenkins’s Built-in User Database 171 Using an LDAP Repository 175 Using Microsoft Active Directory 176 Using Unix Users and Groups 177 Delegating to the Servlet Container 177 Using Atlassian Crowd 178 Integrating with Other Systems 178 Authorization—Who Can Do What 181 Matrix-based Security 181 Project-based Security 185 Role-based Security 188 Auditing—Keeping Track of User Actions 189 Conclusion 193 8. Notification .......................................................... 195 Introduction 195 Email Notification 195 More Advanced Email Notification 197 viii | Table of Contents

Description:
Streamline software development with Jenkins, the popular Java-based open source tool that has revolutionized the way teams think about Continuous Integration (CI). This complete guide shows you how to automate your build, integration, release, and deployment processes with Jenkins—and demonstrate
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.