Tekton Concepts
Internal
Overview
Tekton is a cloud-native solution for building CI/CD pipelines. Tekton installs and runs as an extension on your Kubernetes cluster and uses the well-established Kubernetes resource model. Tekton workloads execute inside Kubernetes containers. It has several components: Tekton Pipelines, Tekton CLI and Tekton Catalog. Tekton is part of the CD Foundation, a Linux Foundation project. It is implemented as a set of Kubernetes Custom Resources. Once deployed, Tekton can be accessed via Tekton CLI commands or API calls.
Tekton Domain Model
Task
A task defines a series of ordered steps, which are executed in order in which they are declared. The output of a step can be used as the input of the next step. Each task executes in its own Kubernetes pod, so by default, tasks within a pipeline do not share data. To make tasks share data, they must be explicitly configured to make their outputs available to the next task, and to ingest the outputs of a previously executed task, as inputs.
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: hello
spec:
steps:
- name: echo
image: alpine
script: |
#!/bin/sh
echo "Hello World"
Task Operations
Step
A step is an operation in a CI/CD workflow. An example is Java compilation or execution of unit tests. Each step is performed within a container image provided when the step is defined. A step processes a set of inputs and produces a set of outputs. Steps do not exist in isolation, they are part of tasks.
TaskRun
A task run (or taskRun) instantiates a specific task to execute on a particular set of inputs and produce a particular set of outputs, within specific conditions (for example, build flags).
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: hello-task-run
spec:
taskRef:
name: hello
TaskRun Operations
Pipeline
A pipeline defines a series of ordered tasks. Just like steps, a task in a pipeline can use as input the output of a previously executed task.
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: task1
spec:
steps:
- name: echo
image: alpine
script: |
#!/bin/sh
echo "this is Task 1 output"
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: task2
spec:
steps:
- name: echo
image: alpine
script: |
#!/bin/sh
echo "this is Task 2 output"
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: simple-pipeline
spec:
tasks:
- name: task1
taskRef:
name: task1
- name: task2
runAfter:
- task1
taskRef:
name: task2
PipelineRun
A pipeline run (or pipelineRun) instantiates a specific pipeline to execute on a particular set of inputs and produce a particular set of outputs.
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: simple-pipeline-run
spec:
pipelineRef:
name: simple-pipeline
PipelineRun Operations
Trigger
Implemented as part of the Tekton Triggers component.
Input
The input is defined relative to a step.
Output
The output is defined relative to a step.
Tekton Components
Tekton Pipelines
Tekton Pipelines is the component that implements the core functionality of Tekton and sets the foundation for other components. It is implemented as a set of Kubernetes Custom Resources.
Tekton Pipeline Runtime
Tekton Pipelines Controller
Tekton Pipelines Webhook
Tekton Pipeline Operations
Tekton CLI
Tekton CLI provides the command interface called tkn
.
Tekton CLI Operations
Tekton API
Tekton APIs are currently available for Pipelines and Triggers allow you to programmatically interact with the Tekton components.
Tekton Catalog
Tekton Catalog is a repository of community-contributed Tekton building blocks.
Tekton Hub
Tekton Hub is a web GUI to access Tekton Catalog.
Tekton Triggers
Tekton Triggers provide triggers, which allow instantiating pipelines based on events (a PR merge, etc.)
Tekton Dashboard
Tekton Dashboard is the web GUI that displays information about pipeline execution.
Tekton Operator
Tekton Operator is the implementation of the Kubernetes Operator pattern that assists with the operation of the Tekton projects.
Building Block
Tekton documentation refers to "building blocks". Those are ...