1.

What are declarative pipelines in Jenkins?

Answer»

Jenkins has two ways of creating pipelines. One is declarative and another one is scripted. The scripted pipelines are also called as traditional pipelines, it is dependent on groovy syntax.  The declarative one is an easy one as syntax is more simplified. Declarative pipeline got introduced after JENKIN version 2.5. Declarative Pipelines are the latest offering from Jenkins that streamline the traditional groovy syntax of Jenkins pipelines (top-level pipeline) with specific use cases, for example, No semicolon can be used as a statement separator. The top-level pipeline ought to be encased inside BLOCK viz;

The regular syntax  structure for a declarative pipeline is below :

The declarative pipeline has three major sections explained below :

  • Pipeline: The section of the script where we WRITE declarative pipelines. It is an umbrella under which all other sections will reside.
  • Agent: This is the starting point of a pipeline from where it starts executing.
  • STAGE: The stage is NOTHING but steps enclosing all pipelines sections.


Discussion

No Comment Found