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:
- Task
- ClusterTask
- TaskRun
- Pipeline
- PipelineRun
Here is a brief description of each, with a link to the upstream documentation:
-
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…
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.
-
A ClusterTask is a Task which is cluster scoped, and therefore can be used by any namespace in the cluster.
-
A TaskRun creates an instance of a Task with specified parameter values, and runs it in a Pod
-
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
-
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:
- TriggerTemplate
- TriggerBinding
- Trigger
- EventListener
- Interceptor
Here is a brief description of each, with a link to the upstream documentation:
-
A TriggerTemplate defines the Pipeline and/or Task resources, and the parameters which are passed to them
-
A TriggerBinding links values from a webhook payload to parameters that are passed to a TriggerTemplate
-
A Trigger is a custom resource that combines Interceptors, TriggerBindings, and TriggerTemplates into a unit
-
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.
-
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:
Note: We’ll talk later about Workspaces & PVCs.
It’s Time To Write Some Pipeline Code:
Now, let’s learn by doing: