PipelineRuns

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.


Syntax

To define a configuration file for a PipelineRun resource, you can specify the
following fields:

  • Required:
    • [apiVersion][kubernetes-overview] - Specifies the API version, for example
      tekton.dev/v1alpha1.
    • [kind][kubernetes-overview] - Specify the PipelineRun resource object.
    • [metadata][kubernetes-overview] - Specifies data to uniquely identify the
      PipelineRun resource object, for example a name.
    • [spec][kubernetes-overview] - Specifies the configuration information for
      your PipelineRun resource object.
      • pipelineRef or taskSpec- Specifies the Pipeline you
        want to run.
      • trigger - Provides data about what created this PipelineRun. The only
        type at this time is manual.
  • Optional:

[kubernetes-overview]:
https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields

Resources

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 git PipelineResource 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 git PipelineResource), image
    registry (via the image PipelineResource) and Kubernetes cluster (via the
    cluster PipelineResource).

Specify the PipelineResources in the PipelineRun using the resources section
in the PipelineRun spec, for example:

  1. spec:
  2. resources:
  3. - name: source-repo
  4. resourceRef:
  5. name: skaffold-git
  6. - name: web-image
  7. resourceRef:
  8. name: skaffold-image-leeroy-web
  9. - name: app-image
  10. resourceRef:
  11. name: skaffold-image-leeroy-app

Service Account

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.

Cancelling a PipelineRun

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.

  1. apiVersion: tekton.dev/v1alpha1
  2. kind: PipelineRun
  3. metadata:
  4. name: go-example-git
  5. spec:
  6. # […]
  7. 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.