Tekton Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(26 intermediate revisions by the same user not shown)
Line 8: Line 8:
=Overview=
=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 is implemented as a set of Kubernetes [[Kubernetes_Custom_Resources#Overview|Custom Resources]]. It has several components: [[#Tekton_Pipelines|Tekton Pipelines]], [[#Tekton_CLI|Tekton CLI]] and [[#Tekton_Catalog|Tekton Catalog]]. Once deployed, Tekton can be accessed via [[#Tekton_CLI|Tekton CLI]] commands or API calls. Tekton is part of the [https://cd.foundation/ CD Foundation], a [https://www.linuxfoundation.org/projects/ Linux Foundation] project.
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 is implemented as a set of Kubernetes [[Kubernetes_Custom_Resources#Overview|Custom Resources]]. It has several components: [[#Tekton_Pipelines|Tekton Pipelines]], [[#Tekton_CLI|Tekton CLI]] and [[#Tekton_Catalog|Tekton Catalog]]. Once deployed, Tekton can be accessed via [[#Tekton_CLI|Tekton CLI]] commands or API calls. Tekton is part of the [https://cd.foundation/ CD Foundation], a [https://www.linuxfoundation.org/projects/ Linux Foundation] project.
=Tekton Runtime Model=
[[#Tekton_Pipelines|Tekton Pipelines]] tracks the state of a [[Tekton_Pipeline#Overview|pipeline]] using [[Kubernetes_Labels_and_Annotations#Annotations|Kubernetes annotations]], which are projected inside each [[Tekton_Step#Step_Container|step container]] in the form of files with the [[Kubernetes_Downward_API_Concepts#Overview|Kubernetes Downward API]].  The step container entrypoint binary watches these projected files and will only start the command the step is supposed to execute only if a specific annotation appears as file. For more details see: {{Internal|Tekton_Labels_and_Annotations#Overview|Tekton Labels and Annotations}}
In addition, Tekton Pipelines schedules some containers to run automatically before and after the step containers to support built-in features such as the retrieval of input resources and the uploading the outputs to wherever they are supposed to go.


=Task=
=Task=
Line 43: Line 47:
{{Internal|Tekton Workspaces#Overview|Workspaces}}
{{Internal|Tekton Workspaces#Overview|Workspaces}}


=Resource=
=<span id='Input_Resource'></span><span id='Output_Resource'></span><span id='PipelineResource'></span><span id='Input'></span><span id='Output'></span>Resource=
<font color=darkkhaki>
{{Internal|Tekton Resource#Overview|Resources}}
* Understand the relationship between Resources and PipelineResources.
* Understand transition from PipelineResources to Tasks, read https://tekton.dev/docs/pipelines/migrating-v1alpha1-to-v1beta1/#replacing-pipelineresources-with-tasks
* Parse https://tekton.dev/docs/pipelines/resources/ and map it on the new implementation.
</font>
 
Resources are used to share data between [[Tekton_Step#Overview|steps]] and [[#Task|tasks]], and depending on which direction they are looked at, the can be [[#Input|input]] or [[#Output|output]] resources. Resources are connected to [[#Task|tasks]] and [[#Pipeline|pipelines]] by [[#TaskRun|taskRuns]] and [[#PipelineRun|pipelineRuns]], respectively. A run must include the actual addresses of resources, such as the URLs of repositories, its task or pipeline needs.
 
Example of resources:
* git repository
* a pull request
* a container image
* a Kubernetes cluster
* storage: an object, a directory, etc.
* a [[CloudEvents|CloudEvent]]
==<span id='Input'></span>Input Resource==
The input is defined relative to a [[Tekton_Step#Overview|step]]. Examples of input resources are: git repository.
==<span id='Output'></span>Output Resource==
The output is defined relative to a [[Tekton_Step#Overview|step]]. Examples of output resources: container image.
==<tt>PipelineResource</tt>==
Deprecated. Defines locations for [[#Input|inputs]] ingested and [[#Output|outputs]] produced by the [[Tekton_Step#Overview|steps]] in [[Tekton_Task#Overview|tasks]]. Also see [[Tekton_Task#Resources|Task Resources]].
 
<font color=darkkhaki>
TO PROCESS:
* The <code>from</code> field: https://tekton.dev/docs/pipelines/pipelines/#using-the-from-field
* https://tekton.dev/docs/pipelines/resources/
</font>


=Result=
=Result=
{{External|https://tekton.dev/docs/results/}}
{{Internal|Tekton_Results#Overview|Results}}
Tekton Results aims to help users logically group CI/CD workload history and separate out long term result storage away from the Pipeline controller.


<font color=darkkhaki>TO PROCESS:
* Using Results in Pipelines: https://tekton.dev/docs/pipelines/pipelines/#using-results
* Consuming task execution results in finally: https://tekton.dev/docs/pipelines/pipelines/#consuming-task-execution-results-in-finally
</font>
=Building Block=
Tekton documentation refers to "building blocks". <font color=darkkhaki>Those are ... </font>
=LimitRange=
<font color=darkkhaki>TO PROCESS:
* https://tekton.dev/docs/pipelines/taskruns/#specifying-limitrange-values
* https://kubernetes.io/docs/concepts/policy/limit-range/
* https://tekton.dev/docs/pipelines/limitrange/
</font>
=<span id='Event'></span>Events=
=<span id='Event'></span>Events=
{{Internal|Tekton Events|Events}}
{{Internal|Tekton Events|Events}}
Line 93: Line 58:
=<span id='Bundle'></span>Bundles=
=<span id='Bundle'></span>Bundles=
{{Internal|Tekton Bundle#Overview|Bundles}}
{{Internal|Tekton Bundle#Overview|Bundles}}
=Conditions=
{{External|https://tekton.dev/docs/pipelines/conditions/}}
Conditions are deprecated, use <code>[[Tekton_Pipeline#Conditional_Execution_with_when|when]]</code> expressions instead.
=Parameters=
=Parameters=
{{Internal|Tekton_Parameters|Parameters}}
{{Internal|Tekton_Parameters|Parameters}}
=<span id='LimitRange'></span>Resource Management=
This section contains a discussion on [[Tekton_Resource_Management#LimitRange|LimitRange]].
{{Internal|Tekton Resource Management#Overview|Resource Management}}
=Security=
=Security=
{{Internal|Tekton_Security|Security}}
{{Internal|Tekton_Security|Security}}
=Metrics=
=Metrics=
{{Internal|Tekton Metrics#Overview|Tekton Metrics}}
=Hermetic Builds=
{{External|https://tekton.dev/docs/pipelines/hermetic/}}
=Conditions=
{{External|https://tekton.dev/docs/pipelines/conditions/}}
Conditions are deprecated, use <code>[[Tekton_Pipeline#Conditional_Execution_with_when|when]]</code> expressions instead.
=Programming Model=
<font color=darkkhaki>
<font color=darkkhaki>
TO PROCESS: https://tekton.dev/docs/pipelines/metrics/
Process Task Authoring Recommendations: https://github.com/tektoncd/catalog/blob/main/recommendations.md
</font>
==<span id='Variable_Substitution'><span>Variables==
<font color=darkkhaki>TO PROCESS:
* https://tekton.dev/docs/pipelines/variables/
* https://tekton.dev/docs/pipelines/tasks/#using-variable-substitution
* Variables available in a Task https://tekton.dev/docs/pipelines/variables/#variables-available-in-a-task
* Variables available in a Pipeline https://tekton.dev/docs/pipelines/variables/#variables-available-in-a-pipeline
* Fields that accept variable substitutions: https://tekton.dev/docs/pipelines/variables/#fields-that-accept-variable-substitutions
* Using variable substitution in pipelines: https://tekton.dev/docs/pipelines/pipelines/#using-variable-substitution
</font>
</font>


=Tekton Runtime Model=
==Code Examples==
[[#Tekton_Pipelines|Tekton Pipelines]] tracks the state of a [[#Pipeline|pipeline]] using [[Kubernetes_Labels_and_Annotations#Annotations|Kubernetes annotations]], which are projected inside each [[Tekton_Step#Step_Container|step container]] in the form of files with the [[Kubernetes_Downward_API_Concepts|Kubernetes Downward API]]. The step container entrypoint binary watches these projected files and will only start the command the step is supposed to execute only if a specific annotation appears as file.  
<font color=darkkhaki>
 
* Code Examples: https://tekton.dev/docs/pipelines/tasks/#code-examples
In addition, Tekton Pipelines schedules some containers to run automatically before and after the step containers to support built-in features such as the retrieval of input resources and the uploading the outputs to wherever they are supposed to go.
* Code Examples: https://github.com/tektoncd/pipeline/tree/main/examples
 
* TaskRun code examples: https://tekton.dev/docs/pipelines/taskruns/#code-examples
<font color=darkkhaki>TO PROCESS: Labels and Annotations: https://tekton.dev/docs/pipelines/labels/</font>
* https://github.com/tektoncd/pipeline/blob/release-v0.35.x/examples/v1beta1/taskruns/run-steps-as-non-root.yaml
* Pipeline code examples: https://github.com/tektoncd/pipeline/tree/main/examples
* Variable substitution: https://tekton.dev/docs/pipelines/tasks/#using-variable-substitution
Start the list here:
* How to do this
* How to do that
</font>


=Playground=
{{External|https://github.com/ovidiuf/playground/tree/master/tekton}}
=Tekton Components=
=Tekton Components=
==Tekton Pipelines==
==Tekton Pipelines==
Line 123: Line 114:


==Tekton CLI==
==Tekton CLI==
{{External|https://github.com/tektoncd/cli/blob/main/README.md}}
{{Internal|Tekton_CLI#Overview|Tekton CLI}}
Tekton CLI provides the command interface called <code>tkn</code>.
 
<font color=darkkhaki>
TO PROCESS:
* https://tekton.dev/docs/cli/
* https://github.com/tektoncd/cli/tree/main/docs
</font>
===Tekton CLI Operations===
* [[Tekton_Operations#Tekton_CLI_Installation|Installation]]


==Tekton API==
==Tekton API==
Line 138: Line 120:


==Tekton Catalog==
==Tekton Catalog==
{{External|https://tekton.dev/docs/catalog/}}
{{Internal|Tekton_Catalog#Overview|Tekton Catalog}}
{{External|https://github.com/tektoncd/catalog/blob/v1beta1/README.md}}
Tekton Catalog is a repository of community-contributed Tekton [[#Building_Block|building blocks]].


==Tekton Hub==
==Tekton Hub==
{{External|https://hub.tekton.dev}}
{{Internal|Tekton_Hub#Overview|Tekton Hub}}
{{External|https://github.com/tektoncd/hub/blob/main/README.md}}
Tekton Hub is a web GUI to access [[#Tekton_Catalog|Tekton Catalog]].


==Tekton Triggers==
==<span id='Trigger'></span>Tekton Triggers==
{{External|https://github.com/tektoncd/triggers/blob/main/README.md}}
{{Internal|Tekton_Triggers#Overview|Tekton Triggers}}
Tekton Triggers provide [[#Trigger|triggers]], which allow instantiating pipelines based on events (a PR merge, etc.)
 
<font color=darkkhaki>TO PROCESS: https://tekton.dev/docs/triggers/</font>


==Tekton Dashboard==
==Tekton Dashboard==
{{External|https://github.com/tektoncd/dashboard/blob/main/README.md}}
{{Internal|Tekton_Dashboard#Overview|Tekton Dashboard}}
{{External|https://tekton.dev/docs/dashboard/}}
Tekton Dashboard is the web GUI that displays information about pipeline execution.


==Tekton Operator==
==Tekton Operator==
{{External|https://tekton.dev/docs/operator/}}
{{Internal|Tekton_Operator#Overview|Tekton Operator}}
{{External|https://github.com/tektoncd/operator/blob/main/README.md}}
Tekton Operator is the implementation of the [[Kubernetes Operators Concepts|Kubernetes Operator pattern]] that assists with the operation of the Tekton projects.


==HA Support==
==HA Support==
{{Internal|Tekton_Operations#HA_Support|Tekton Operations &#124; HA Support}}
{{Internal|Tekton_Operations#HA_Support|Tekton Operations &#124; HA Support}}
=Programming Model=
<font color=darkkhaki>
Process Task Authoring Recommendations: https://github.com/tektoncd/catalog/blob/main/recommendations.md
</font>
==<span id='Variable_Substitution'><span>Variables==
<font color=darkkhaki>TO PROCESS:
* https://tekton.dev/docs/pipelines/variables/
* https://tekton.dev/docs/pipelines/tasks/#using-variable-substitution
* Variables available in a Task https://tekton.dev/docs/pipelines/variables/#variables-available-in-a-task
* Variables available in a Pipeline https://tekton.dev/docs/pipelines/variables/#variables-available-in-a-pipeline
* Fields that accept variable substitutions: https://tekton.dev/docs/pipelines/variables/#fields-that-accept-variable-substitutions
* Using variable substitution in pipelines: https://tekton.dev/docs/pipelines/pipelines/#using-variable-substitution
</font>
==Code Examples==
<font color=darkkhaki>TO PROCESS:
* Code Examples: https://tekton.dev/docs/pipelines/tasks/#code-examples
* Code Examples: https://github.com/tektoncd/pipeline/tree/main/examples
* TaskRun code examples: https://tekton.dev/docs/pipelines/taskruns/#code-examples
* https://github.com/tektoncd/pipeline/blob/release-v0.35.x/examples/v1beta1/taskruns/run-steps-as-non-root.yaml
* Pipeline code examples: https://github.com/tektoncd/pipeline/tree/main/examples
* Variable substitution: https://tekton.dev/docs/pipelines/tasks/#using-variable-substitution
Start the list here:
* How to do this
* How to do that
</font>
=Hermetic Builds=
{{External|https://tekton.dev/docs/pipelines/hermetic/}}
=Playground=
{{External|https://github.com/ovidiuf/playground/tree/master/tekton}}

Latest revision as of 05:45, 29 April 2022

External

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 is implemented as a set of Kubernetes Custom Resources. It has several components: Tekton Pipelines, Tekton CLI and Tekton Catalog. Once deployed, Tekton can be accessed via Tekton CLI commands or API calls. Tekton is part of the CD Foundation, a Linux Foundation project.

Tekton Runtime Model

Tekton Pipelines tracks the state of a pipeline using Kubernetes annotations, which are projected inside each step container in the form of files with the Kubernetes Downward API. The step container entrypoint binary watches these projected files and will only start the command the step is supposed to execute only if a specific annotation appears as file. For more details see:

Tekton Labels and Annotations

In addition, Tekton Pipelines schedules some containers to run automatically before and after the step containers to support built-in features such as the retrieval of input resources and the uploading the outputs to wherever they are supposed to go.

Task

Task

ClusterTask

A task is available in a certain namespace, while a ClusterTask is available across the entire cluster. A ClusterTask behaves identically to a task. When declaring a ClusterTask in the pipeline definition, the kind sub-field of the taskRef should be explicitly set to ClusterTask. If not specified, kind defaults to Task.

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
[...]
spec:
  tasks:
    - name: some-cluster-task
      taskRef:
        name: some-task
        kind: ClusterTask
 ...

Custom Task and Run

Custom Task and Run

Step

Step

TaskRun

Include discussion on pod templates:

TaskRun

Pipeline

Pipeline

PipelineRun

PipelineRun

Workspaces

Workspaces

Resource

Resources

Result

Results

Events

Events

Bundles

Bundles

Parameters

Parameters

Resource Management

This section contains a discussion on LimitRange.

Resource Management

Security

Security

Metrics

Tekton Metrics

Hermetic Builds

https://tekton.dev/docs/pipelines/hermetic/

Conditions

https://tekton.dev/docs/pipelines/conditions/

Conditions are deprecated, use when expressions instead.

Programming Model

Process Task Authoring Recommendations: https://github.com/tektoncd/catalog/blob/main/recommendations.md

Variables

TO PROCESS:

Code Examples

Start the list here:

  • How to do this
  • How to do that

Playground

https://github.com/ovidiuf/playground/tree/master/tekton

Tekton Components

Tekton Pipelines

https://github.com/tektoncd/pipeline/blob/main/docs/README.md

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

Tekton API

Tekton APIs are currently available for Pipelines and Triggers allow you to programmatically interact with the Tekton components.

Tekton Catalog

Tekton Catalog

Tekton Hub

Tekton Hub

Tekton Triggers

Tekton Triggers

Tekton Dashboard

Tekton Dashboard

Tekton Operator

Tekton Operator

HA Support

Tekton Operations | HA Support