OpenShift Pipelines (Tekton) - Overview

Time for some Vocabulary

Let’s get the Tekton vocabulary out of the way first. I’ll include links to the upstream documentation for each item:

There are two main components to Tekton - Pipelines & Triggers

Tekton Pipelines

Let’s cover the components of Pipelines first:

Pipelines is composed of the Tekton elements that will actually orchestrate and run your code builds, tests, and deployments. It is made up of these main components:

  1. Task
  2. ClusterTask
  3. TaskRun
  4. Pipeline
  5. PipelineRun

Here is a brief description of each, with a link to the upstream documentation:

  1. Task

    Task is the basic unit-of-work for Tekton.

    • A Task is composed of Steps
    • A Task accepts parameters which can be used by the Steps to drive logic & set the runtime environment
    • Each Step executes it’s work within a container
    • A Task runs in a Pod
      • Each container associated with a step, runs in the Task Pod
      • All of the Steps in a Task are able to share the resources of the Pod
        • ConfigMaps
        • Secrets
        • Volumes
        • etc…

    TektonTask

    Note: When you look at the documentation, take care to note that PipelineResources are deprecated. Don’t use them. I’ll be showing you how to build pipelines without them.

  2. ClusterTask

    A ClusterTask is a Task which is cluster scoped, and therefore can be used by any namespace in the cluster.

  3. TaskRun

    A TaskRun creates an instance of a Task with specified parameter values, and runs it in a Pod

  4. Pipeline

    A Pipeline composes Tasks into chains of sequential or parallel work

    • Pipelines accept parameters which can be passed to the Tasks
    • Pipelines support logic to determine whether or not a given Task should execute based on runtime conditions
    • Pipelines support Workspaces which can be attached to PVCs to provide shared state across Tasks
  5. PipelineRun

    A PipelineRun creates an instance of a Pipeline with specified parameter values, and runs it by creating a TaskRun for each Task in the appropriate order

Tekton Triggers

Triggers is the event driven side of Tekton. These elements put the C in CI/CD.

Triggers has 5 main components:

  1. TriggerTemplate
  2. TriggerBinding
  3. Trigger
  4. EventListener
  5. Interceptor

Here is a brief description of each, with a link to the upstream documentation:

  1. TriggerTemplate

    A TriggerTemplate defines the Pipeline and/or Task resources, and the parameters which are passed to them

  2. TriggerBinding

    A TriggerBinding links values from a webhook payload to parameters that are passed to a TriggerTemplate

  3. Trigger

    A Trigger is a custom resource that combines Interceptors, TriggerBindings, and TriggerTemplates into a unit

  4. EventListener

    An EventListener receives the webhook payload and passes it to one or more Triggers. The EventListener is the only component in Tekton that is a long running process. It runs as a Pod in the Namespace that it was created in.

  5. Interceptor

    An Interceptor is used to perform validation or value-add activities on a webhook payload before it is passed to the TriggerTemplate for the execution of pipelines and or tasks

Pictorial View

Here’s an overview of all of the pieces, and how they are accociated:

TektonOverview

Note: We’ll talk later about Workspaces & PVCs.

It’s Time To Write Some Pipeline Code:

Now, let’s learn by doing:

OpenShift Pipelines (Tekton) - Basics - Tasks