Jenkins Pipeline (or simply "Pipeline" with a capital "P") is a suite of plugins
which supports implementing and integrating
continuous delivery pipelines
into
Jenkins.
A
continuous delivery (CD) pipeline
is an automated expression of your process
for getting software from version control right through to your users and
customers. Every change to your software (committed in source control) goes
through a complex process on its way to being released. This process involves
building the software in a reliable and repeatable manner, as well as
progressing the built software (called a "build") through multiple stages of
testing and deployment.
Pipeline provides an extensible set of tools for modeling simple-to-complex
delivery pipelines "as code" via the
Pipeline domain-specific language (DSL) syntax.
The definition of a Jenkins Pipeline is written into a text file (called a
Jenkinsfile
) which in turn can be committed to a project’s
source control repository.
This is the foundation of "Pipeline-as-code"; treating the CD pipeline a part of
the application to be versioned and reviewed like any other code.
Creating a
Jenkinsfile
and committing it to source control provides a number
of immediate benefits:
-
Automatically creates a Pipeline build process for all branches and pull
requests.
-
Code review/iteration on the Pipeline (along with the remaining source code).
-
Audit trail for the Pipeline.
-
Single source of truth
for the Pipeline, which can be viewed and edited by multiple
members of the project.
While the syntax for defining a Pipeline, either in the web UI or with a
Jenkinsfile
is the same, it is generally considered best practice to define
the 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 and
Scripted.
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 a
Jenkinsfile
, however, are common to both Declarative and Scripted Pipeline.
Read more about how these two types of syntax differ in Pipeline concepts
and Pipeline syntax overview below.