Skip to main content
A Pipeline is a collection of Tasks that you define and arrange in a specific order of execution as part of your continuous integration flow.

Overview

Each Task in a Pipeline executes as a Pod on your Kubernetes cluster. You can configure various execution conditions to fit your business needs.

Pipeline Configuration

A Pipeline definition supports the following fields:

Required Fields

string
required
Specifies the API version, for example tekton.dev/v1 or tekton.dev/v1beta1.
string
required
Identifies this resource object as a Pipeline object.
object
required
Specifies metadata that uniquely identifies the Pipeline object. For example, a name.
object
required
Specifies the configuration information for this Pipeline object.
array
required
Specifies the Tasks that comprise the Pipeline and the details of their execution.

Optional Fields

array
Specifies the Parameters that the Pipeline requires.
array
Specifies a set of Workspaces that the Pipeline requires.
array
Specifies the location to which the Pipeline emits its execution results.
string
Holds an informative description of the Pipeline object.
array
Specifies one or more Tasks to be executed in parallel after all other tasks have completed.

Specifying Workspaces

Workspaces allow you to specify one or more volumes that each Task in the Pipeline requires during execution:
For more information, see the Workspaces documentation.

Specifying Parameters

You can specify global parameters that you want to supply to the Pipeline at execution time. Parameters are passed to the Pipeline from its corresponding PipelineRun.

Parameter Format

Parameter names:
  • Must only contain alphanumeric characters, hyphens (-), and underscores (_)
  • Must begin with a letter or an underscore (_)

Parameter Types

Each declared parameter has a type field, which can be set to array, string, or object.

Example Pipeline with Parameters

Adding Tasks to the Pipeline

Your Pipeline definition must reference at least one Task. Each Task within a Pipeline must have a valid name and a taskRef or a taskSpec.

Using taskRef

Using taskSpec

Specifying Parameters in Tasks

You can provide parameters to Tasks:

Using the runAfter Field

If you need your Tasks to execute in a specific order within the Pipeline, use the runAfter field to indicate that a Task must execute after one or more other Tasks.

Using the retries Field

For each Task in the Pipeline, you can specify the number of times Tekton should retry its execution when it fails:

Guard Task Execution using when Expressions

To run a Task only when certain conditions are met, you can guard task execution using the when field.

Components of when Expressions

Examples

Using Results

Tasks can emit Results when they execute. A Pipeline can use these Results for two purposes:
  1. Pass the Result of a Task into the Parameters or when expressions of another
  2. Emit Results and include data from the Results of its Tasks

Passing Results Between Tasks

Emitting Results from a Pipeline

Configuring Task Timeout

You can use the timeout field in the Task spec within the Pipeline to set the timeout of the TaskRun:

Adding Finally to the Pipeline

You can specify finally tasks that should execute after all the Tasks in your Pipeline have completed:

Finally Tasks Features

  • finally tasks are executed in parallel
  • finally tasks are guaranteed to execute after all pipeline tasks complete
  • finally tasks can access execution status of pipeline tasks
  • finally tasks support when expressions

Using Execution Status in Finally Tasks

Complete Pipeline Example