Jenkins Pipeline (or simply "Pipeline" with a capital "P") is a suite of pluginswhich supports implementing and integrating continuous delivery pipelines intoJenkins.
A continuous delivery (CD) pipeline is an automated expression of your processfor getting software from version control right through to your users andcustomers. Every change to your software (committed in source control) goesthrough a complex process on its way to being released. This process involvesbuilding the software in a reliable and repeatable manner, as well asprogressing the built software (called a "build") through multiple stages oftesting and deployment.
Pipeline provides an extensible set of tools for modeling simple-to-complexdelivery pipelines "as code" via thePipeline domain-specific language (DSL) syntax.[1]
The definition of a Jenkins Pipeline is written into a text file (called aJenkinsfile
) which in turn can be committed to a project’ssource control repository.[2]This is the foundation of "Pipeline-as-code"; treating the CD pipeline as a part ofthe application to be versioned and reviewed like any other code.
Creating a Jenkinsfile
and committing it to source control provides a numberof immediate benefits:
Automatically creates a Pipeline build process for all branches and pullrequests.
Code review/iteration on the Pipeline (along with the remaining source code).
Audit trail for the Pipeline.
Single source of truth[3]for the Pipeline, which can be viewed and edited by multiplemembers of the project.
While the syntax for defining a Pipeline, either in the web UI or with aJenkinsfile
is the same, it is generally considered best practice to definethe Pipeline in a Jenkinsfile
and check that in to source control.
Declarative versus Scripted Pipeline syntax
A Jenkinsfile
can be written using two types of syntax — Declarative andScripted.
Declarative and Scripted Pipelines are constructed fundamentally differently.Declarative Pipeline is a more recent feature of Jenkins Pipeline which:
provides richer syntactical features over Scripted Pipeline syntax, and
is designed to make writing and reading Pipeline code easier.
Many of the individual syntactical components (or "steps") written into aJenkinsfile
, however, are common to both Declarative and Scripted Pipeline.Read more about how these two types of syntax differ in Pipeline conceptsand Pipeline syntax overview below.