Concepts

Technical Information and Architecture

This document is a work in progress.

Overview

Tekton is an open-source Kubernetes native CI/CD (Continuous Integration andDelivery/Deployment) solution. It allows developers to build, test, anddeploy across destinations using a Kubernetes cluster of their own.

The Tekton project, at this moment, consists of 4 components:

  • Pipelines: Basic building blocks (tasks and pipelines) of a CI/CD workflow
  • Triggers: Event triggers for a CI/CD workflow
  • CLI: Command-line interface for CI/CD workflow management
  • Dashboard: General-purpose, web-based UI for Pipelines

Pipelines, of all the components, provides the core functionality ofTekton and sets the foundation for the other components. Installation ofTriggers, CLI, and Dashboard is optional; you may set them up in conjunctionwith Pipelines to create the CI/CD workflow that works best for your teamand project.

In addition, the project provides a service, Tekton Catalog,which features common blocks of CI/CD workflows that one may mix and matchin their own project.

Concept model

Steps, Tasks, and Pipelines

A step is an operation in a CI/CD workflow, such as running some unit testsfor a Python web app, or the compilation of a Java program. Tekton performseach step with a container image you provide. For example, you may use theofficial Go image to compile a Go programin the same manner as you would on your local workstation (go build).

A task is a collection of steps in order. Tekton runs a task inthe form of a Kubernetes pod,where each step becomes a running container in the pod. This design allows youto set up a shared environment for a number of related steps; for example,you may mount a Kubernetes volumein a task, which will be accessible inside each step of the task.

A pipeline is a collection of tasks in order. Tekton collects all thetasks, connects them in a directed acyclic graph (DAG), and executes the graphin sequence. In other words, it creates a number of Kubernetes pods andensures that each pods complete running successfully as desired. Tekton grantsdevelopers full control of the process: one may set up a fan-in/fan-outscenario of task completion, ask Tekton to retry automatically shoulda flaky test exists, or specify a condition that a task must meet beforeproceeding.

Tasks and pipelines are specified as custom resourcesin a Kubernetes cluster.

Tasks and Pipelines

Input and output resources

Each task and pipeline may have its own inputs and outputs, known asinput and output resources in Tekton. A compliation task, for example, mayhave a git repository as input and a container image as output: the taskclones the source code from the repository, runs some tests, and at lastbuilds the source code into an executable container image.

Tekton supports many different types of resources, including:

  • git: A git repository
  • Pull Request: A specific pull request in a git repository
  • Image: A container image
  • Cluster: A Kubernetes cluster
  • Storage: An object or directory in a blob store, such as Google Cloud Storage
  • CloudEvent: A CloudEvent

Resources are specified as custom resourcesin a Kubernetes cluster.

Resources

TaskRuns and PipelineRuns

A pipelineRun, as its name implies, is a specific execution of a pipeline.For example, you may ask Tekton to run your CI/CD workflow twice a day, andeach execution will become a pipelineRun resource trackable in yourKubernetes cluster. You can view the status of your CI/CD workflow, includingthe specifics of each task execution with pipelineRuns.

Similarly, a taskRun is a specific execution of a task. TaskRunsare also available when you choose to run a task outside a pipeline, withwhich you may view the specifics of each step execution in a task.

TaskRuns and pipelineRuns connect resources with tasks andpipelines. A run must include the actual addresses of resources, such asthe URLs of repositories, its task or pipeline needs. This design allowsdevelopers to reuse tasks and pipelines for different inputs and outputs.

You may create taskRuns or pipelineRuns manually, which triggersTekton to run a task or a pipeline immediately. Alternately, one may ask aTekton component, such as Tekton Triggers, to create a run automatically ondemand; for example, you may want to run a pipeline every time a new pullrequest is checked into your git repository.

Runs

TaskRuns and pipelineRuns are specified as custom resourcesin a Kubernetes cluster.

How Tekton works

Loosely speaking, at its core, Tekton Pipelines functions by wrapping eachof your steps. More specifically, Tekton Pipelines injects an entrypointbinary in step containers, which executes the command you specify whenthe system is ready.

Tekton Pipelines tracks the state of your pipeline usingKubernetes Annotations.These annotations are projected inside each step container in the formof files with theKubernetes Downward API.The entrypoint binary watches the projected files closely, and will onlystart the provided command if a specific annotation appears as files. Forexample, when you ask Tekton to run two steps consecutively in a task,the entrypoint binary injected into the second step container willwait idly until the the annotations report that the first step containerhas successfully completes.

In addition, Tekton Pipelines schedules some containers to run automaticallybefore and after your step containers, so as to support specific built-infeatures, such as the retrieval of input resources and the uploading ofoutputs to blob storage solutions. You can track their running statuses aswell via taskRuns and pipelineRuns. The system also performs a numberof other operations to set up the environment before running the stepcontainers; for more information, see Tasks and Pipelines.

What’s next

Learn more about Tekton Pipelines in Tasks and Pipelines.