Jenkins provides you with two ways of developing your pipeline code: Scripted and Declarative. Scripted pipelines, also known as “traditional” pipelines, are based on Groovy as their Domain-specific language. On the other hand, Declarative pipelines provide a simplified and more friendly syntax with specific statements for defining them, without needing to learn Groovy.
In this blog post we will cover all the directives available to develop your Declarative pipeline script, which will provide a clear picture on its functionality.
A valid Declarative pipeline must be defined with the “pipeline” sentence and include the next required sections:
Also, these are the available directives:
- environment (Defined at stage or pipeline level)
- input (Defined at stage level)
- options (Defined at stage or pipeline level)
We will now describe each of the listed directives/sections, starting with…