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

Declarative Pipeline syntax


In the previous section, we created a Jenkins pipeline to get a look at and feel for its various components. We utilized the pipeline script that followed a declarative syntax to define our pipeline.

The Declarative Pipeline syntax is a more simplified and structured version of the Groovy syntax, the latter being more powerful due to its programmability. In this section, we will learn about the Declarative Pipeline syntax in a bit more detail. This is important because in the upcoming chapters we will be using the same to define our CI and CD pipelines.

Basic structure of a Declarative Pipeline

In simple terms, a Declarative Pipeline is a collection of multiple node blocks (nodes), stage blocks (stages), directives, and steps. A single node block can have multiple stage blocks, and vice versa. We can also run multiple stages in parallel. Let's see each of them in detail.

The node block

A node block defines the Jenkins agent wherein its constituents (stage blocks, directives...