Book Image

Jenkins Essentials - Second Edition

By : Mitesh Soni
Book Image

Jenkins Essentials - Second Edition

By: Mitesh Soni

Overview of this book

<p>In agile development practices, developers need to integrate their work frequently to fix bugs or to create a new feature or functionality. Jenkins is used specifically for Continuous Integration, helping to enforce the principles of agile development. This book focuses on the latest and stable release of Jenkins (2.5 and later), featuring the latest features, such as Pipeline as Code, the new setup experience, and the improved UI. With the all-new Pipeline as Code feature, you will be able to build simple or advanced pipelines easily and rapidly, hence improving your teams' productivity.</p> <p>This book begins by tackling the installation of the necessary software dependencies and libraries you'll need to perform Continuous Integration for a Java application. From there, you'll integrate code repositories, applications, and build tools for the implementation of Continuous Integration.</p> <p>Finally, you will also learn how to automate your deployment on cloud platforms such as AWS and Microsoft Azure, along with a few advanced testing techniques.</p>
Table of Contents (17 chapters)
Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Dedication
Preface

Preface

Jenkins has been used specifically for Continuous Integration over the years. Continuous Integration systems are a vital part of Agile teams because they help enforce the principles of Agile development.

Jenkins, a continuous build tool, enables Agile teams to focus on work and innovations by automating the build, artifact management, and deployment processes, rather than worrying about manual processes. However, the release of Jenkins 2.0 and later versions are focused on Continuous Delivery.

Jenkins is an open source automation server. Continuous Integration is a significant part of DevOps culture and hence many open source and commercial tools for Continuous Delivery utilizes Jenkins for a complete product.

DevOps is a buzzword in 2015 and for coming years as per Market trends by various research firms. Continuous Integration is a significant part of DevOps culture and hence the trend to use Jenkins will increase in future. If Continuous Integration is the base, then Continuous Delivery is the topping. Jenkins supports and focus more on end-to-end automation of application life cycle management system.

What this book covers

Chapter 1, Exploring Jenkins, describes in detail the basics of Continuous Integration and an overview of Jenkins. It describes the recent growth of importance of Continuous Integration as a practice to cultivate DevOps culture. This chapter also describes the installation and configuration of Jenkins. We are going to take a whistle-stop tour through some of the key features of Jenkins, and plugin installation as well.

Chapter 2, Installation and Configuration of Code Repositories and Build Tools, describes in detail how to prepare the runtime environment for application life cycle management and configure it with Jenkins - the open source continuous integration tool. It will cover how to integrate Eclipse and Jenkins, so builds can be run from Eclipse as well.

Chapter 3, Managing Code Quality and Notifications, will cover how to integrate static code analysis behavior into Jenkins. Code quality is an extremely vital feature that impacts on applications' effectiveness and by integrating it with Sonar, users get insights into problematic portions of code. This chapter also covers email notifications on build status.

Chapter 4, Continuous Integration with Jenkins, describes in detail how to create and configure build jobs in Java, how to run build jobs, unit test cases using Ant, and Maven build tools. It covers all aspects of running a build to create a distribution file or war file for deployment.

Chapter 5, Continuous Delivery - Implementing Automated Deployment, provides insights into how functional testing and load testing can be performed and how they can be integrated with Jenkins to adopt the Continuous Testing practices of DevOps culture.

Chapter 6, Continuous Testing - Functional and Load Testing with Jenkins, takes one step forward in the DevOps pipeline by deploying artifacts to local or remote application servers. It gives insights into automated deployment and Continuous Delivery processes, and also covers how to deploy applications to a public cloud platform using Jenkins.

Chapter 7, Build Pipeline and Pipeline as a Code, will cover how to orchestrate build job to execute them in a specific sequence. We will cover the Build Pipeline plugin and the Pipeline as a Code feature that is available in Jenkins 2 and later.

Chapter 8, Managing and Monitoring Jenkins, gives insight into the management of Jenkins nodes and monitoring them with Java Melody, in order to provide details on the utilization of resources. It also covers how to monitor build jobs configured for Java-or .NET-related applications, and managing those configurations by keeping backups of them.

Chapter 9, Security in Jenkins, will cover security management options available in Jenkins. This will help to perform user management, authentication, and authorization, including matrix-based security and role-based access.

What you need for this book

This book is for beginners. This book assumes that you are familiar with at least the Java programming language. Knowledge of core Java and JEE is essential if you are to use this book to gain better insights. Having a strong understanding of programming logic will provide you with the background to be productive with Jenkins, while using plugins or writing commands for the shell.

As the application development life cycle will cover a lot of tools, it is essential to have some knowledge of repositories such as svn, git, and so on, IDE tools such as Eclipse, and build tools such as Ant and Maven.

Knowledge of code analysis tools will make jobs easier to configur and integrate, however, it is not required in order to complete the exercises presented in this book. Most of the configuration steps are mentioned clearly. SonarQuve version 6.3 is used for code analysis.

You will be walked through the steps required to install Jenkins on a Windows and Linux-based host. In order to be immediately successful, you will need administrative access to a host that runs a modern version of Windows and Linux; Windows 10 will be used for demonstration purposes. If you are a more experienced reader, then a recent release of almost any distribution will work just as well (but you may be required to do a little bit of extra work that is not outlined in the book).

Additionally, you will need access to the internet to download plugins that you do not already have, as well as an installation of Jenkins. Any normal hardware configuration is good enough, such as 4 GB RAM and 500 GB hard drive.

Who this book is for

This book assumes that you are familiar with at least java programming language. Knowledge of core java and JEE is essential considering this book to gain better insight. Having a strong understanding of program logic will provide you with the background to be productive with Jenkins while using plugins of writing commands for shell.

As application development life cycle will cover lot of tools in general; it is essential to have some knowledge of repositories such as svn, git etc; IDE tools such as Eclipse; build tools such as ant and maven.

Knowledge of code analysis tools will make job easier in configuration and integration, however it is not extremely vital to perform exercises given in the book. Most of the configuration steps are mentioned clearly.

Additionally, you will need access to the Internet to download plugins that you do not already have, as well as an installation of the Jenkins.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows:

A block of code is set as follows:

#run the model
model <- OneR(train_data, frisked ~ ., verbose = TRUE)
#summarize the model
summary(model)
#run the sql function from the SparkR package
SparkR::sql("SELECT sample_bin , count(*)
\FROM out_tbl group by sample_bin")

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

#note we are specifing the SparkR filter, not the dplyr filer
head(SparkR::filter(out_sd1,out_sd1$sample_bin==1),1000)

Any command-line, (including commands at the R console) input or output is written as follows:

> summary(xchurn)

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen."

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book 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.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Jenkins-Essentials-Second-Edition. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/JenkinsEssentialsSecondEdition_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at ;[email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.