Praise for Jenkins 2: Up and Running
This is now both my new go-to book for reference as well as the one I recommend to those new to Jenkins. Its quite a feat to write a book that can serve both audiences and Brent has pulled it off in spades.
Chaim Tinjaw Krause
Brent Laster does a fantastic job at distilling the power of Jenkins down to its essential components while still providing the comprehensive guide to getting the most out of Jenkins 2. Valuable examples of the pipeline as code provide building blocks for implementing continuous delivery. This belongs in the toolbox of new and experienced Jenkins users alike .
Brian Dawson, DevOps Evangelist, CloudBees
Jenkins 2: Up and Running
by Brent Laster
Copyright 2018 Brent Laster. All rights reserved.
Printed in the United States of America.
Published by OReilly Media, Inc. , 1005 Gravenstein Highway North, Sebastopol, CA 95472.
OReilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com/safari). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com .
- Acquisitions Editor: Brian Foster
- Development Editor: Angela Rufino
- Production Editor: Justin Billing
- Copyeditors: Dwight Ramsey and Rachel Head
- Proofreader: Jasmine Kwityn
- Indexer: Judith McConville
- Interior Designer: David Futato
- Cover Designer: Karen Montgomery
- Illustrator: Rebecca Demarest
Revision History for the First Edition
- 2018-05-02: First Release
See http://oreilly.com/catalog/errata.csp?isbn=9781491979594 for release details.
The OReilly logo is a registered trademark of OReilly Media, Inc. Jenkins 2: Up and Running, the cover image, and related trade dress are trademarks of OReilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
978-1-491-97959-4
[LSI]
To my best friend and wife, Anne-Marie,
who brings beauty and happiness to each day.
And to my sons Walker, Chase, and Tanner,
who have taught me more than I could ever teach them.
Foreword
The software development industry is going through a slow but real transformation. Software is increasingly a part of everything, and we, the software developers, are trying to cope with this exploding demand through more automation. Id imagine you are reading this book because you are a part of that transformation.
To serve you better in this transformation, Jenkins is itself going through a major transformation of its own as wellfrom the world of classic Jenkins, where you configure Jenkins through a series of jobs from server-rendered GUI, to the world of modern Jenkins, where you configure Jenkins through Jenkinsfiles in Git repositories and look at results through a pleasant single-page application.
As we develop the modern Jenkins in the community and roll out these new features, I keep running into this challenge. Most users are simply unaware of this transformation thats going on in Jenkins. People keep using Jenkins like they have been doing for years!
And to be fair, it made complete sense. On the one hand is peoples inertia and this massive body of information and knowledge accumulated in Google, Stack Overflow, our mailing lists, issue trackers, and so on that tells people how to effectively use Jenkins the classic way. On the other hand, we have the community that is, generally speaking, too busy building the modern Jenkins; and collectively not enough effort has been spent on telling people how to effectively use Jenkins the modern way.
So I was very happy to hear about this book, which really takes this challenge head on. In this book, Brent steps back and forgets everything weve known about Jenkins from the past decade. Then he goes on to reconstruct how Jenkins should be used today. Unlike Google, Stack Overflow, and so on, where knowledge is captured piecemeal, this book gives you a systematic path to explore the whole landscape, which makes it really valuable.
Its an ideal book for those who are new to CI/CD, as well as those who have been using Jenkins for many years. This book will help you discover and rediscover Jenkins.
Kohsuke Kawaguchi
Creator of Jenkins
CTO, CloudBees, Inc.
February 2018
Preface
How to Use This Book
This book is bigbigger than I ever thought it would be. Ive worried about this at some level, but decided that there were two ways to go when writing it: I could either limit the content to only what was needed to do a basic tutorial, or I could spend some time explaining concepts, creating code examples, and diving into what terminology, functions, and programming with pipelines-as-code really mean. If youve scanned the book, you can probably figure out that I opted to do the latter.
My reasoning for that was due to my experiences over many years of training people on using Jenkins. In a short class or workshop, we could only cover a small number of topics. And people were always hungry for moremore detail and more examples that they could apply. At the end of conference presentations, I would invariably get lines of people asking for more information sources, examples, and where to find info about such and such. Oftentimes, it would come down to Google this or See this question on Stack Overflow. Nothing wrong with that, but also not the most convenient approach.
This book is intended to help you find answers on how to use this powerful technology. Granted, its more mechanics than DevOps, but chances are if you are reading this, you already have some grasp of continuous integration (CI), continuous deployment (CD), DevOps, and Jenkins, and are looking for how to make the most out of the new Jenkins features.
So here are a few guidelines (feel free to use them or ignore them as fits your situation):
Dont try to read the entire book throughunless you need to get a lot of sleep.
Scan the sections listed in the Table of Contents. A chapters title only hints at its full contents. Also, dont forget about consulting the index to find topics you might be interested in.
If you want to understand the basic ideas and get going quickly, read the first two chapters and then start playing with some basic pipelines. As you run into questions or problems, consult the appropriate chapters in the book for the particular areas.
If you already know the basics of Jenkins and want to convert to pipelines-as-code, take a look at to get some ideas on conversions and then consult other chapters as needed.
If youre looking to create a larger pipeline, take a look at the chapter on conversions and the various chapters on integration with the OS and other technologies (Chapters ).
If youre looking to automate Jenkins, take a look at .
If you run into problems, each chapter contains some details that may help. Look at the notes, warnings, and sidebars for information on unusual situations or functionality that may trip you up (or provide an advantage you hadnt thought about). Theres also a chapter on more general troubleshooting at the end of the book.