Book Image

Learning Continuous Integration with Jenkins - Second Edition

By : Nikhil Pathania
Book Image

Learning Continuous Integration with Jenkins - Second Edition

By: Nikhil Pathania

Overview of this book

In past few years, agile software development has seen tremendous growth. There is a huge demand for software delivery solutions that are fast yet flexible to numerous amendments. As a result, Continuous Integration (CI) and Continuous Delivery (CD) methodologies are gaining popularity. This book starts off by explaining the concepts of CI and its significance in the Agile. Next, you'll learn how to configure and set up Jenkins in many different ways. The book exploits the concept of "pipeline as code" and various other features introduced in the Jenkins 2.x release to their full potential. We also talk in detail about the new Jenkins Blue Ocean interface and the features that help to quickly and easily create a CI pipeline. Then we dive into the various features offered by Jenkins one by one, exploiting them for CI and CD. Jenkins' core functionality and flexibility allows it to fit in a variety of environments and can help streamline the development process for all stakeholders. Next, you'll be introduced to CD and will learn how to achieve it using Jenkins. Through this book's wealth of best practices and real-world tips, you'll discover how easy it is to implement CI and CD using Jenkins.
Table of Contents (18 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

Preface

In the past few years, the agile model of software development has seen a considerable amount of growth around the world. There is massive demand for a software delivery solution that is fast and flexible to frequent amendments, especially in the e-commerce sector. As a result, the Continuous Integration and Continuous Delivery methodologies are gaining popularity.

Whether small or big, all types of project gain benefits, such as early issue detection, avoiding lousy code into production, and faster delivery, which leads to an increase in productivity.

This book, Learning Continuous Integration with Jenkins Second Edition, serves as a step-by-step guide to setting up a Continuous Integration, Continuous Delivery, and Continuous Deployment system using hands-on examples. The book is 20% theory and 80% practical. It starts by explaining the concept of Continuous Integration and its significance in the Agile world, with a complete chapter dedicated to this. Users then learn to configure and set up Jenkins, followed by implementing Continuous Integration and Continuous Delivery using Jenkins. There is also a small chapter on Continuous Deployment, which talks primarily about the difference between Continuous Delivery and Continuous Deployment.

 

What this book covers

Chapter 1, Concepts of Continuous Integration, gives an account of how some of the most popular and widely used software development methodologies gave rise to Continuous Integration. This is followed by a detailed explanation of the various requirements and best practices to achieve Continuous Integration.

Chapter 2, Installing Jenkins, is a step-by-step guide all about installing Jenkins across various platforms, including Docker.

Chapter 3, The New Jenkins, provides an overview of how the new Jenkins 2.x looks and feels, with an in-depth explanation of its essential constituents. It also introduces readers to the new features added in Jenkins 2.x.

Chapter 4, Configuring Jenkins, focuses on accomplishing some basic Jenkins administration tasks.

Chapter 5, Distributed Builds, explores how to implement a build farm using Docker. It also talks about adding standalone machines as Jenkins slaves.

Chapter 6, Installing SonarQube and Artifactory, covers installing and configuring SonarQube and Artifactory for CI.

Chapter 7, Continuous Integration Using Jenkins, takes you through a Continuous Integration design and the means to achieve it using Jenkins, in collaboration with some other DevOps tools.

Chapter 8, Continuous Delivery Using Jenkins, outlines a Continuous Delivery design and the means to achieve it using Jenkins, in collaboration with some other DevOps tools.

Chapter 9, Continuous Deployment Using Jenkins, explains the difference between Continuous Delivery and Continuous Deployment. It also features a step-by-step guide to implementing Continuous Deployment using Jenkins.

AppendixSupporting Tools and Installation Guide, takes you through the steps required to make your Jenkins server accessible over the internet and the installation guide for Git.

What you need for this book

To be able to follow everything described in the book, you will need a machine with the following configurations:

  • Operating systems:
    • Windows 7/8/10
    • Ubuntu 14 and later
  • Hardware requirements:
    • A machine with a minimum 4 GB memory and a multicore processor
  • Other requirements:
    • A GitHub account (public or private)

Who this book is for

This book is aimed at readers with little or no previous experience with Agile or Continuous Integration and Continuous Delivery. It serves as a great starting point for anyone who is new to this field and would like to leverage the benefits of Continuous Integration and Continuous Delivery to increase productivity and reduce delivery time.

Build and release engineers, DevOps engineers, (Software Configuration Management) SCM engineers, developers, testers, and project managers can all benefit from this book.

Readers who are already using Jenkins for Continuous Integration can learn to take their project to the next level, which is Continuous Delivery.

The current edition of the book is a complete reboot of its predecessor. Readers of the first edition can take advantage of some of the new stuff discussed in the current edition, such as Pipeline as Code, Multibranch Pipelines, Jenkins Blue Ocean, distributed build farms using Docker, and more.

Conventions

In this book, you will find a number of text styles 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: "This will download a .hpi file on your system."

A block of code is set as follows:

stage ('Performance Testing'){
    sh '''cd /opt/jmeter/bin/
    ./jmeter.sh -n -t $WORKSPACE/src/pt/Hello_World_Test_Plan.jmx -l
    $WORKSPACE/test_report.jtl''';
    step([$class: 'ArtifactArchiver', artifacts: '**/*.jtl'])
}

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

stage ('Performance Testing'){
    sh '''cd /opt/jmeter/bin/
    ./jmeter.sh -n -t $WORKSPACE/src/pt/Hello_World_Test_Plan.jmx -l
    $WORKSPACE/test_report.jtl''';
    step([$class: 'ArtifactArchiver', artifacts: '**/*.jtl'])
}

The extra "\" used in some of the commands is used to only indicate that the command continues in the next line. Any command-line input or output is written as follows:

   cd /tmp
   wget https://archive.apache.org/dist/tomcat/tomcat-8/ \
   v8.5.16/bin/apache-tomcat-8.5.16.tar.gz

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "From the Jenkins dashboard, click on the Manage Jenkins | Plugin Manager | Available tab."

Note

Warnings or important notes appear 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 email [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 emailed directly to you. You can download the code files by following these steps:

  1. Log in or register to our website using your email 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/Learning-Continuous-Integration-with-Jenkins-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/LearningContinuousIntegrationwithJenkinsSecondEdition_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.