How to Use the Jenkins Declarative Pipeline | jenkins declarative pipeline
Jenkins[1]providesyouwithtwowaysofdevelopingyourpipelinecode:ScriptedandDeclarative.Scriptedpipelines,alsoknownas“traditional”pipelines,arebasedonGroovy[2]astheirDomain-specificlanguage.Ontheotherhand,Declarativepipelinesprovideasimplifiedandmorefriendlysyntaxwithspecificstatementsfordefiningthem,withoutneedingtolearnGroovy. Jenkinspipelinepluginversion2.5introducessupportforDeclarativepipelines.MoreinformationonhowtowriteScriptedpipelinescanbefoundatmypreviousblogpost”HowtoUsetheJenkinsScri...
Jenkins[1] provides you with two ways of developing your pipeline code: Scripted and Declarative. Scripted pipelines, also known as “traditional” pipelines, are based on Groovy[2] 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.
Jenkins pipeline plugin version 2.5 introduces support for Declarative pipelines. More information on how to write Scripted pipelines can be found at my previous blog post ”How to Use the Jenkins Scripted Pipeline”.[3][4]
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:
...