Chapter 3. Pipeline Execution Flow
Working with the legacy Jenkins web interface and items such as Freestyle jobs, our ability to control the flow of processing was limited. Typically, this would take the form of job chaining—having jobs kick off other jobs when they completed. Or we might include post-build processing to always do things like send notifications no matter whether the job finished successfully or not.
Beyond that basic functionality, we could also add the Conditional BuildStep plugin to define more complex flows of build steps based on single or multiple conditions. But even that was limited, compared to the ways we can direct the execution flow when writing programs.
In this chapter, we’ll explore the different constructs provided by the Jenkins pipeline DSL for controlling the execution flow in pipelines. We’ll start with specifying properties to trigger jobs and how to accept input.
Then we’ll look at how to keep things moving through constructs including timeouts, retries, and running tasks in parallel. We’ll also look at the constructs available to map the Conditional BuildStep functionality into pipelines.
Finally, we’ll see how to use pipeline methods to emulate the post-build processing functionality of traditional Jenkins jobs. Along the way, we’ll see how things differ for Scripted and Declarative Pipelines.
Let’s get started with defining the properties for triggering jobs.
Triggering Jobs
To specify triggering events for pipeline code, there are three ...
Get Jenkins 2: Up and Running now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.