Extending Jenkins: Get a complete walkthrough of the many interfaces available in Jenkins with the help of real-world examples to take you to the next level with Jenkins
()
About this ebook
About This Book
- Find out how to interact with Jenkins from within Eclipse, NetBeans, and IntelliJ IDEA
- Develop custom solutions that act upon Jenkins information in real time
- A step-by-step, practical guide to help you learn about extension points in existing plugins and how to build your own plugin
Who This Book Is For
This book is aimed primarily at developers and administrators who are interested in taking their interaction and usage of Jenkins to the next level.
The book assumes you have a working knowledge of Jenkins and programming in general, and an interest in learning about the different approaches to customizing and extending Jenkins so it fits your requirements and your environment perfectly.
What You Will Learn
- Retrieve and act upon Jenkins information in real time
- Find out how to interact with Jenkins through a variety of IDEs
- Develop your own Form and Input validation and customization
- Explore how Extension points work, and develop your own Jenkins plugin
- See how to use the Jenkins API and command-line interface
- Get to know how to remotely update your Jenkins configuration
- Design and develop your own Information Radiator
- Discover how Jenkins customization can help improve quality and reduce costs
In Detail
Jenkins CI is the leading open source continuous integration server. It is written in Java and has a wealth of plugins to support the building and testing of virtually any project. Jenkins supports multiple Software Configuration Management tools such as Git, Subversion, and Mercurial.
This book explores and explains the many extension points and customizations that Jenkins offers its users, and teaches you how to develop your own Jenkins extensions and plugins.
First, you will learn how to adapt Jenkins and leverage its abilities to empower DevOps, Continuous Integration, Continuous Deployment, and Agile projects. Next, you will find out how to reduce the cost of modern software development, increase the quality of deliveries, and thereby reduce the time to market. We will also teach you how to create your own custom plugins using Extension points.
Finally, we will show you how to combine everything you learned over the course of the book into one real-world scenario.
Style and approach
Extending Jenkins explores and explains advanced Jenkins functionality from a practical point of view, teaching you real-world skills that will help you get more from this powerful software. Each key topic is explained clearly with a practical example, and in sufficient detail so you understand the concepts and can then develop your own solutions using your preferred software and languages.
Donald Simpson
Donald Simpson is an information technology consultant based in Scotland, UK. He specializes in helping organizations improve the quality and reduce the cost of software development through the adoption of process automation and Agile methodologies. Starting out as a Java developer, Donald's interest in application servers, networking, and automation led him to a career as a build engineer. He remains highly technical and hands-on and enjoys learning about new technologies and finding ways to automate and improve manual processes. He can be reached at www.donaldsimpson.co.uk.
Related to Extending Jenkins
Related ebooks
Learning SaltStack - Second Edition Rating: 0 out of 5 stars0 ratingsDeveloping with Docker Rating: 5 out of 5 stars5/5Docker Orchestration Rating: 0 out of 5 stars0 ratingsDevOps. How to build pipelines with Jenkins, Docker container, AWS ECS, JDK 11, git and maven 3? Rating: 0 out of 5 stars0 ratingsLearning Ansible Rating: 0 out of 5 stars0 ratingsLinux Shell Scripting: From Basics to Expert Proficiency Rating: 0 out of 5 stars0 ratingsGetting Started with Kubernetes - Second Edition Rating: 0 out of 5 stars0 ratingsAnsible For Windows By Examples Rating: 0 out of 5 stars0 ratingsMastering DevOps in Kubernetes: Maximize your container workload efficiency with DevOps practices in Kubernetes (English Edition) Rating: 0 out of 5 stars0 ratingsMastering Kubernetes Rating: 5 out of 5 stars5/5Apache Maven Cookbook Rating: 3 out of 5 stars3/5Apache Karaf Cookbook Rating: 0 out of 5 stars0 ratingsDevOps. How To Build Pipelines With Bitbucket Pipelines + Docker Container + AWS ECS + JDK 11 + Maven 3? Rating: 0 out of 5 stars0 ratingsDevOps Bootcamp Rating: 0 out of 5 stars0 ratingsLearning CoreOS: Learning CoreOS Rating: 0 out of 5 stars0 ratingsExtending Docker Rating: 5 out of 5 stars5/5Kubernetes Handbook: Non-Programmer's Guide to Deploy Applications with Kubernetes Rating: 4 out of 5 stars4/5Creating Development Environments with Vagrant - Second Edition Rating: 0 out of 5 stars0 ratingsTroubleshooting Docker Rating: 0 out of 5 stars0 ratingsGitLab Guidebook: From Basics to Expert Proficiency Rating: 0 out of 5 stars0 ratingsOpenStack for Architects Rating: 0 out of 5 stars0 ratingsGit Essentials Rating: 4 out of 5 stars4/5A Pythonic Adventure: From Python basics to a working web app Rating: 0 out of 5 stars0 ratingsGoogle Cloud Professional Cloud Architect 100+ Practice Exam questions with Detailed Answers Rating: 0 out of 5 stars0 ratings
Computers For You
The ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 4 out of 5 stars4/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5CompTIA IT Fundamentals (ITF+) Study Guide: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsExcel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsThe Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution Rating: 4 out of 5 stars4/5Elon Musk Rating: 4 out of 5 stars4/5CompTIA Security+ Get Certified Get Ahead: SY0-701 Study Guide Rating: 5 out of 5 stars5/5Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5Computer Science I Essentials Rating: 5 out of 5 stars5/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5CompTia Security 701: Fundamentals of Security Rating: 0 out of 5 stars0 ratingsFundamentals of Programming: Using Python Rating: 5 out of 5 stars5/5How to Create Cpn Numbers the Right way: A Step by Step Guide to Creating cpn Numbers Legally Rating: 4 out of 5 stars4/5The Self-Taught Computer Scientist: The Beginner's Guide to Data Structures & Algorithms Rating: 0 out of 5 stars0 ratingsTor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5Slenderman: Online Obsession, Mental Illness, and the Violent Crime of Two Midwestern Girls Rating: 4 out of 5 stars4/5Standard Deviations: Flawed Assumptions, Tortured Data, and Other Ways to Lie with Statistics Rating: 4 out of 5 stars4/5The Musician's Ai Handbook: Enhance And Promote Your Music With Artificial Intelligence Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Excel Tables: A Complete Guide for Creating, Using and Automating Lists and Tables Rating: 5 out of 5 stars5/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5Mastering ChatGPT Rating: 0 out of 5 stars0 ratingsData Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5Microsoft Office 365 for Business Rating: 4 out of 5 stars4/5Microsoft Azure For Dummies Rating: 0 out of 5 stars0 ratings
Reviews for Extending Jenkins
0 ratings0 reviews
Book preview
Extending Jenkins - Donald Simpson
Table of Contents
Extending Jenkins
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Preparatory Steps
Getting started with Jenkins
Extending the basic setup
Jenkins evolution
Continuous Integration with Jenkins
Summary
2. Automating the Jenkins UI
Use case scenario 1 – a large number of jobs
Use case scenario 2 – multiple hosts
Use case scenario 3 – helping your users through UI automation
Use case scenario 4 – UI tweaks
Summary
3. Jenkins and the IDE
Eclipse and Mylyn
Installing Mylyn
Mylyn and Jenkins configurations
IntelliJ IDEA and Jenkins build connectors
NetBeans
Summary
4. The API and the CLI
Creating an Information Radiator with the Jenkins XML API
Getting the information from Jenkins
Automating the job
Radiating the information
Jenkins as a web server – the userContent directory
The Jenkins CLI
How to set it up
How to use it
Triggering remote jobs via the CLI
Updating Jenkins configuration
Summary
5. Extension Points
A brief history of Jenkins plugins
Interfaces
Abstract classes
Abstraction and interfaces
Singletons
Declaring an extension in Jenkins
Summary
6. Developing Your Own Jenkins Plugin
An introduction to Maven
Installing Maven
Summary
7. Extending Jenkins Plugins
Where to start?
Looking at the list of existing plugins
A new build type required
Loading and building our starting point
The Builder class and Stapler
Jelly and Jenkins
Help
Properties files and Messages
The POM file
Plugin progress
Summary
8. Testing and Debugging Jenkins Plugins
Running tests with Maven
Debugging Jenkins
Server debugging – a quick recap
Debugging with IntelliJ
Debugging with Eclipse
mvnDebug
The Jenkins Logger Console
Summary
9. Putting Things Together
The Jenkins script console and Groovy
Groovy and Gradle as alternatives
Jenkins and Docker
Docker in Jenkins
Jenkins in Docker
Jenkins and Android
Jenkins and iOS
Keeping your Jenkins version and plugins up to date
Summary
Index
Extending Jenkins
Extending Jenkins
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2015
Production reference: 1171215
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-424-3
www.packtpub.com
Credits
Author
Donald Simpson
Reviewer
Tony Sweets
Commissioning Editor
Amarabha Banerjee
Acquisition Editor
Indrajit Das
Content Development Editor
Riddhi Tuljapurkar
Technical Editor
Menza Mathew
Copy Editor
Kausambhi Majumdar
Project Coordinator
Sanchita Mandal
Proofreader
Safis Editing
Indexer
Tejal Daruwale Soni
Graphics
Abhinash Sahu
Production Coordinator
Melwyn Dsa
Cover Work
Melwyn Dsa
About the Author
Donald Simpson is an information technology consultant based in Scotland, UK.
He specializes in helping organizations improve the quality and reduce the cost of software development through the adoption of process automation and Agile methodologies.
Starting out as a Java developer, Donald's interest in application servers, networking, and automation led him to a career as a build engineer. He remains highly technical and hands-on and enjoys learning about new technologies and finding ways to automate and improve manual processes.
He can be reached at www.donaldsimpson.co.uk.
I would like to thank my wife, Clair, and my children, Freya and Lyla, for their support and encouragement throughout my career and the writing of this book.
About the Reviewer
Tony Sweets has over 20 years of experience in software development, with most of it in Java and Java-based technologies. Known as the Tools
guy before there was any concept of DevOps, he also has a passion for setting up and managing hardware and networks. Introduced to Agile development very early on, he has set up and maintained his company's continuous integration system that ranges from Cruise Control to Hudson, and now Jenkins. He is currently a software architect in the payments field and has been working in financial services for over 17 years.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
Support files, eBooks, discount offers, and morehttps://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Preface
Jenkins provides many interfaces and extension points to enable users to customize and extend its functionality. In this book, we will explore these interfaces in depth and provide practical real-world examples that will take your usage of Jenkins to the next level.
In this book, you will learn how to develop and test your own Jenkins plugin, find out how to set up fully automated build pipelines and development processes, discover how to interact with the API and CLI, and how to enhance the user interface.
What this book covers
Chapter 1, Preparatory Steps, will cover the initial setup steps—getting your development environment set up, an overview of Jenkins and some options to install and run it as well as extend the basic setup. We will also review the principles of Continuous Integration, which are explored in greater detail later.
Chapter 2, Automating the Jenkins UI, will discuss how several common issues and bottlenecks may be alleviated through the automation and adaptation of the Jenkins frontend. Here, we will look at four fairly typical use cases, identify the root cause of the issues, and propose some possible improvements that can be made through the alteration and automation of the GUI.
Chapter 3, Jenkins and the IDE, builds on the Continuous Integration principals that we looked at earlier and provides an introduction to the Mylyn project.
It then details how to set up a process that enables developers to interact with Jenkins directly from within their IDE. A selection of examples covers Eclipse, NetBeans, and IntelliJ.
Chapter 4, The API and the CLI, illustrates how we can automate and extend Jenkins through its API and CLI. In this chapter, we will illustrate how to use these interfaces by working through the high-level building blocks
of an example Information Radiator
project.
This chapter will explain how to create a dynamic application that consumes information from Jenkins via its exposed interfaces.
We will also review other ways in which you could extend Jenkins via the CLI—by kicking off jobs and making other changes to Jenkins automatically and remotely.
Chapter 5, Extension Points, introduces many important concepts that provide a foundation for the Jenkins Extension points topics in the subsequent chapters. We will run through Java interfaces, Design by Contract, abstract classes, and Singletons. We will then take a look at how these patterns are used in the real world when we define our own Extension Point in Jenkins.
Chapter 6, Developing Your Own Jenkins Plugin, will combine the skills, concepts, and tools from the preceding chapters to build our first Jenkins plugin.
We will take a look at Maven and learn how to set it up and use it for Jenkins plugin development. We will then create our first Jenkins plugin, learn how to install it locally, and then learn how to quickly make, build, and deploy subsequent changes using Maven.
Chapter 7, Extending Jenkins Plugins, makes use of a simple plugin with the Hello world
functionality we created in the previous chapter to keep the focus on getting to grips with the processes and tools. This chapter takes a look at the best way to get started with adding your own implementations. You will learn how to reuse existing code and functionality and understand how and where to find them.
After taking a look at