This document defines PipelineRuns
and their capabilities.
On its own, a Pipeline
declares what Tasks
to
run, and the order they run in. To execute the Tasks
in the Pipeline
, you must create a PipelineRun
.
Creation of a PipelineRun
will trigger the creation of
TaskRuns
for each Task
in your pipeline.
To define a configuration file for a PipelineRun
resource, you can specify the
following fields:
-
Required:
apiVersion
- Specifies the API version, for exampletekton.dev/v1alpha1
.kind
- Specify thePipelineRun
resource object.metadata
- Specifies data to uniquely identify thePipelineRun
resource object, for example aname
.spec
- Specifies the configuration information for yourPipelineRun
resource object.pipelineRef
- Specifies thePipeline
you want to run.
-
Optional:
-
resources
- Specifies whichPipelineResources
to use for thisPipelineRun
. -
serviceAccount
- Specifies aServiceAccount
resource object that enables your build to run with the defined authentication information. -
timeout
- Specifies timeout after which thePipelineRun
will fail. -
[
nodeSelector
] - A selector which must be true for the pod to fit on a node. The selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ -
[
tolerations
] - Tolerations are applied to pods, and allow (but do not require) the pods to schedule onto nodes with matching taints. More info: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ -
[
affinity
] - The pod's scheduling constraints. More info:https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature
-
When running a Pipeline
, you will need to specify the
PipelineResources
to use with it. One Pipeline
may need to
be run with different PipelineResources
in cases such as:
- When triggering the run of a
Pipeline
against a pull request, the triggering system must specify the commitish of a gitPipelineResource
to use - When invoking a
Pipeline
manually against one's own setup, one will need to ensure that one's own GitHub fork (via the gitPipelineResource
), image registry (via the imagePipelineResource
) and Kubernetes cluster (via the clusterPipelineResource
).
Specify the PipelineResources
in the PipelineRun using the resources
section
in the PipelineRun
spec, for example:
spec:
resources:
- name: source-repo
resourceRef:
name: skaffold-git
- name: web-image
resourceRef:
name: skaffold-image-leeroy-web
- name: app-image
resourceRef:
name: skaffold-image-leeroy-app
Specifies the name
of a ServiceAccount
resource object. Use the
serviceAccount
field to run your Pipeline
with the privileges of the
specified service account. If no serviceAccount
field is specified, your
resulting TaskRuns
run using the
default
service account
that is in the
namespace
of the TaskRun
resource object.
For examples and more information about specifying service accounts, see the
ServiceAccount
reference topic.
In order to cancel a running pipeline (PipelineRun
), you need to update its
spec to mark it as cancelled. Related TaskRun
instances will be marked as
cancelled and running Pods will be deleted.
apiVersion: tekton.dev/v1alpha1
kind: PipelineRun
metadata:
name: go-example-git
spec:
# […]
status: "PipelineRunCancelled"
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License.