PipelineRun allows you to instantiate and execute a Pipeline on-cluster.
Overview
APipeline 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.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
APipelineRun definition supports the following fields:
Required Fields
Specifies the API version, for example
tekton.dev/v1 or tekton.dev/v1beta1.Indicates that this resource object is a
PipelineRun object.Specifies the metadata that uniquely identifies the PipelineRun object. For example, a
name.Specifies the configuration information for this PipelineRun object.
Specifies the target Pipeline (use either
pipelineRef or pipelineSpec).Embeds the Pipeline definition directly in the PipelineRun (use either
pipelineRef or pipelineSpec).Optional Fields
Specifies the desired execution parameters for the Pipeline.
Specifies a ServiceAccount object that supplies specific execution credentials for the Pipeline.
Specifies options for cancelling a PipelineRun.
Specifies a list of PipelineTaskRunSpec which allows for setting ServiceAccountName, Pod template, and Metadata for each task.
Specifies the timeout before the PipelineRun fails.
Specifies a Pod template to use as the basis for the configuration of the Pod that executes each Task.
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 targetPipeline that you want the PipelineRun to execute, either by referencing an existing Pipeline definition:
Using pipelineSpec
Or by embedding aPipeline definition directly in the PipelineRun:
Specifying Parameters
You can specifyParameters 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 parentPipelineRun will be propagated to any inlined specs without needing to be explicitly defined:
Specifying Workspaces
If yourPipeline 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 thePipeline 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 thetaskRunSpecs[].serviceAccountName field:
- v1
- v1beta1
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:- v1
- v1beta1
Configuring Failure Timeout
You can use thetimeouts field to set the PipelineRun's desired timeout value. There are three sub-fields:
Specifies the timeout for the entire PipelineRun. Defaults to the global configurable default timeout of 60 minutes.
Specifies the timeout for the cumulative time taken by non-finally Tasks.
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: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
Contains the latest observations of the PipelineRun’s state.
The time at which the PipelineRun began executing, in RFC3339 format.
The time at which the PipelineRun finished executing, in RFC3339 format.
The exact PipelineSpec used when starting the PipelineRun.
Results emitted by this PipelineRun.
A list of references to each TaskRun or Run in this PipelineRun.
Status Example
Overall Status
| status | reason | completionTime | Description |
|---|---|---|---|
| Unknown | Started | No | PipelineRun has just been picked up by the controller |
| Unknown | Running | No | PipelineRun has been validated and started to perform its work |
| Unknown | Stopping | No | PipelineRun is being stopped |
| True | Succeeded | Yes | All Tasks in the Pipeline have succeeded |
| True | Completed | Yes | All Tasks in the Pipeline completed successfully, including one or more skipped Tasks |
| False | Failed | Yes | PipelineRun failed because one of the Tasks failed |
| False | PipelineRunTimeout | Yes | PipelineRun timed out |
| False | PipelineRunCancelled | Yes | PipelineRun was cancelled successfully |
Cancelling a PipelineRun
To cancel aPipelineRun that’s currently executing, update its status:
Gracefully Cancelling a PipelineRun
To gracefully cancel aPipelineRun, set the spec.status field to CancelledRunFinally:
finally tasks to execute before the PipelineRun is cancelled.