Skip to main content
A PipelineRun allows you to instantiate and execute a Pipeline on-cluster.

Overview

A Pipeline specifies one or more Tasks in the desired order of execution. A PipelineRun executes the Tasks in the Pipeline in the order they are specified until all Tasks have executed successfully or a failure occurs.
A PipelineRun automatically creates corresponding TaskRuns for every Task in your Pipeline.
The Status field tracks the current state of a PipelineRun, and can be used to monitor progress. This field contains the status of every TaskRun, as well as the full PipelineSpec used to instantiate this PipelineRun, for full auditability.

PipelineRun Configuration

A PipelineRun definition supports the following fields:

Required Fields

string
required
Specifies the API version, for example tekton.dev/v1 or tekton.dev/v1beta1.
string
required
Indicates that this resource object is a PipelineRun object.
object
required
Specifies the metadata that uniquely identifies the PipelineRun object. For example, a name.
object
required
Specifies the configuration information for this PipelineRun object.
object
Specifies the target Pipeline (use either pipelineRef or pipelineSpec).
object
Embeds the Pipeline definition directly in the PipelineRun (use either pipelineRef or pipelineSpec).

Optional Fields

array
Specifies the desired execution parameters for the Pipeline.
string
Specifies a ServiceAccount object that supplies specific execution credentials for the Pipeline.
string
Specifies options for cancelling a PipelineRun.
array
Specifies a list of PipelineTaskRunSpec which allows for setting ServiceAccountName, Pod template, and Metadata for each task.
object
Specifies the timeout before the PipelineRun fails.
object
Specifies a Pod template to use as the basis for the configuration of the Pod that executes each Task.
array
Specifies a set of workspace bindings which must match the names of workspaces declared in the pipeline being used.

Specifying the Target Pipeline

Using pipelineRef

You must specify the target Pipeline that you want the PipelineRun to execute, either by referencing an existing Pipeline definition:

Using pipelineSpec

Or by embedding a Pipeline definition directly in the PipelineRun:

Specifying Parameters

You can specify Parameters that you want to pass to the Pipeline during execution:
You must specify all the Parameters that the Pipeline expects. Parameters that have default values specified in Pipeline are not required to be provided by PipelineRun.

Propagated Parameters

When using an inlined spec, parameters from the parent PipelineRun will be propagated to any inlined specs without needing to be explicitly defined:

Specifying Workspaces

If your Pipeline specifies one or more Workspaces, you must map those Workspaces to the corresponding physical volumes in your PipelineRun definition:

Using volumeClaimTemplate

You can also create a PersistentVolumeClaim from a template:

Specifying ServiceAccount

You can execute the Pipeline in your PipelineRun with a specific set of credentials by specifying a ServiceAccount object name:

Mapping ServiceAccount to Tasks

If you require more granularity in specifying execution credentials, use the taskRunSpecs[].serviceAccountName field:

Specifying Pod Template

You can specify a Pod template configuration that will serve as the configuration starting point for the Pod in which the container images specified in your Tasks will execute:

Configuring Failure Timeout

You can use the timeouts field to set the PipelineRun's desired timeout value. There are three sub-fields:
string
Specifies the timeout for the entire PipelineRun. Defaults to the global configurable default timeout of 60 minutes.
string
Specifies the timeout for the cumulative time taken by non-finally Tasks.
string
The timeout for the cumulative time taken by finally Tasks.

Timeout Example

Constraint

All three sub-fields are optional, and will be automatically processed according to the following constraint:
Each timeout field is a duration conforming to Go’s ParseDuration format. For example, valid values are 1h30m, 1h, 1m, and 60s.

PipelineRun Status

Status Fields

array
Contains the latest observations of the PipelineRun’s state.
string
The time at which the PipelineRun began executing, in RFC3339 format.
string
The time at which the PipelineRun finished executing, in RFC3339 format.
object
The exact PipelineSpec used when starting the PipelineRun.
array
Results emitted by this PipelineRun.
array
A list of references to each TaskRun or Run in this PipelineRun.

Status Example

Overall Status

Cancelling a PipelineRun

To cancel a PipelineRun that’s currently executing, update its status:

Gracefully Cancelling a PipelineRun

To gracefully cancel a PipelineRun, set the spec.status field to CancelledRunFinally:
This allows the finally tasks to execute before the PipelineRun is cancelled.

Complete PipelineRun Example