When Using Jenkins, What Are the Differences between a Declarative Pipeline and a Scripted Pipeline?

Question
In the context of Jenkinsfiles, there are two types of pipelines: declarative and scripted.  What are the differences between these two types?

Answer
1.  The syntax of the two is one difference.  While both are based on Groovy, Declarative Pipeline syntax is more simple (according to this posting).  Declarative Pipeline syntax follows more of an declarative paradigm whereas Scripted Pipeline syntax follows more of a imperative paradigm (according to this posting).

2.  The Scripted Pipeline is more like a "general purpose DSL" (according to this posting).  Thus Scripted Pipelines are more complex, flexible and powerful than Declarative Pipelines.

3.  The Declarative Pipeline is easier to learn how to use (according to this posting).

4.  The Declarative pipeline uses three reserved words that the Scripted does not: pipeline, agent, and steps (according to this posting).

5.  The Scripted pipeline uses the reserved word "node" that the Declarative pipeline does not use (according to this site).

Leave a comment

Your email address will not be published. Required fields are marked *