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...