Jenkins Pipeline

Jenkins Pipeline is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins. Pipeline provides an extensible set of tools for modeling simple-to-complex delivery pipelines "as code" via thePipeline DSL.[1]

Declarative and scripted (edit based on the comment):

  • Declarative pipelines is a new extension of the pipeline DSL (it is basically a pipeline script with only one step, a pipeline step with arguments (called directives), these directives should follow a specific syntax. The point of this new format is that it is more strict and therefor should be easier for those new to pipelines, allow for graphical editing and much more.

  • Scripted pipelines is the fallback for advanced requirements.

Remember Agent is for declarative pipelines and node is for scripted pipelines.

Typically, this "Pipeline as Code" would be written to aJenkinsfileand checked into a project’s source control repository, for example:

Difference between Declarative and Scripted Pipeline.

Why Pipeline?

Jenkins is, fundamentally, an automation engine which supports a number of automation patterns. Pipeline adds a powerful set of automation tools onto Jenkins, supporting use cases that span from simple continuous integration to comprehensive continuous delivery pipelines. By modeling a series of related tasks, users can take advantage of the many features of Pipeline:

  • Code: Pipelines are implemented in code and typically checked into source control, giving teams the ability to edit, review, and iterate upon their delivery pipeline.

  • Durable: Pipelines can survive both planned and unplanned restarts of the Jenkins master.

  • Pausable: Pipelines can optionally stop and wait for human input or approval before continuing the Pipeline run.

  • Versatile: Pipelines support complex real-world continuous delivery requirements, including the ability to fork/join, loop, and perform work in parallel.

  • Extensible: The Pipeline plugin supports custom extensions to its DSL[1]and multiple options for integration with other plugins.

Reference: https://jenkins.io/doc/book/pipeline/

Global Shared Libraries

There are several places where Shared Libraries can be defined, depending on the use-case._Manage Jenkins » Configure System » Global Pipeline Libraries_as many libraries as necessary can be configured.

Since these libraries will be globally usable, any Pipeline in the system can utilize functionality implemented in these libraries.

These libraries are considered "trusted:" they can run any methods in Java, Groovy, Jenkins internal APIs, Jenkins plugins, or third-party libraries. This allows you to define libraries which encapsulate individually unsafe APIs in a higher-level wrapper safe for use from any Pipeline. Beware thatanyone able to push commits to this SCM repository could obtain unlimited access to Jenkins. You need the_Overall/RunScripts_permission to configure these libraries (normally this will be granted to Jenkins administrators).

Folder-level Shared Libraries

Any Folder created can have Shared Libraries associated with it. This mechanism allows scoping of specific libraries to all the Pipelines inside of the folder or subfolder. Folder-based libraries are not considered "trusted:" they run in the Groovy sandbox just like typical Pipelines. https://jenkins.io/doc/book/pipeline/shared-libraries/

results matching ""

    No results matching ""