Introduction
Building continuous delivery pipelines and similarly complex tasks in Jenkins using freestyle projects and traditional plugins can be awkward. You need to mix Parameterized Trigger, Copy Artifact, Promoted Builds, Conditional Build Step, and more just to express what should be a simple script. The Pipeline plugin (formerly known as Workflow) suite attempts to make it possible to directly write that script, what people often call a pipeline, while integrating with Jenkins features like slaves and publishers.
Features
Scripted control flow
Your whole pipeline is a single Groovy script using an embedded DSL, possibly quite short and legible; there is no need to jump between multiple job configuration screens to see what is going on. Conditions, loops, variables, parallel tasks, and so on are defined using regular language constructs. At any point you can insert a shell/batch script to do “real work” (compilation, etc.).
Useful steps
Standard DSL functions (“steps”) let you run external processes, grab slave nodes and workspaces, perform SCM checkouts, build other projects (pipeline or freestyle), wait for external conditions, and so on. Plugins can add further steps.
Pause and resume execution
If Jenkins is restarted (intentionally, or because of a crash) while your Pipeline is running, when it comes back up, execution is resumed where it left off. This applies to external processes (shell scripts) so long as the slave can be reattached, and losing the slave connection temporarily is not fatal either.
Pipelines can pause in the middle and wait for a human to approve something, or enter some information. Executors need not be consumed while the Pipeline is waiting.
Pipeline stages
Pipelines can be divided into sequential stages, not only for labeling but to throttle concurrency.
Getting started
Read the tutorial to get started writing pipelines.
There is also a DZone Refcard.
A new collection of examples, snippets, tips, and tricks is in progress.
Installation
Releases are available on the Jenkins update center. You need to be running a sufficiently recent Jenkins release: an LTS in the 1.580.x line or newer (currently 1.609.x for the latest updates), or a weekly release. See the changelog for news.
For OSS Jenkins users, install Pipeline (its dependencies will be pulled in automatically). You will need to restart Jenkins to complete installation.
CloudBees Jenkins Enterprise users get Pipeline automatically as of the 14.11 (1.580.1.1) release. Otherwise install CloudBees Pipeline from the update center. Again dependencies will be pulled in automatically, including all the OSS plugins.
For multibranch pipelines and organization folders, install Pipeline: Multibranch plus at least one SCM provider, such as GitHub Branch Source.
News & questions
- Changelog
- jenkins-workflow tag on StackOverflow
- JIRA (file issues in the
workflow-plugin
component, or other components with theworkflow
label) - User list discussions (mention
pipeline
in the subject) - #JenkinsPipeline on Twitter
Demo
See the demo overview using Docker if you want to try a complete setup quickly. In short:
docker run -p 8080:8080 -p 8081:8081 -p 8022:22 -ti jenkinsci/workflow-demo
and browse localhost:8080.
Presentations
Webinar Continuous Delivery as Code with Jenkins Workflow (Sep 2015): slides and video (demo starts at 20:30)
Jenkins Workflow: What’s Up? (JUC West) (Sep 2015): slides and video
Jenkins Office Hour on Workflow for plugin developers (Aug 2015): video
Workflow Meetup London (Mar 2015): slides
Jenkins Workflow Screencast (Jan 2015): video
Webinar Orchestrating the Continuous Delivery Process in Jenkins with Workflow (Dec 2014): video
Detailed guides
Reusing build steps from freestyle projects
Using version control from a Pipeline
Using the global Groovy class library
Development
See the contribution guide.