Tekton Pipeline: Difference between revisions
Line 5: | Line 5: | ||
=Internal= | =Internal= | ||
* [[Tekton_Concepts#Pipeline|Tekton Concepts]] | * [[Tekton_Concepts#Pipeline|Tekton Concepts]] | ||
* [[Tekton_Task#Overview|Tekton Task]] | |||
=Overview= | =Overview= | ||
A '''pipeline''' defines a series of ordered [[Tekton_Task#Overview|tasks]]. Just like [[Tekton_Step#Overview|steps]], a task in a pipeline can use as [[#Input|input]] the [[#Output|output]] of a previously executed task. Tekton collects all the tasks, and based on the dependency relationships declared in definition of the pipeline, it orders the tasks in a [[Graph_Concepts#Directed_Acyclic_Graph_.28DAG.29|DAG]], and executes the graph in sequence. That results in the materialization of a number of task pods. The pipeline comes up with additional features, such as the capability to fan-out task execution, retry task execution or verify conditions that tasks must meet before proceeding. The pipeline is implemented as a Kubernetes custom resource. | A '''pipeline''' defines a series of ordered [[Tekton_Task#Overview|tasks]]. Just like [[Tekton_Step#Overview|steps]], a task in a pipeline can use as [[#Input|input]] the [[#Output|output]] of a previously executed task. Tekton collects all the tasks, and based on the dependency relationships declared in definition of the pipeline, it orders the tasks in a [[Graph_Concepts#Directed_Acyclic_Graph_.28DAG.29|DAG]], and executes the graph in sequence. That results in the materialization of a number of task pods. The pipeline comes up with additional features, such as the capability to fan-out task execution, retry task execution or verify conditions that tasks must meet before proceeding. The pipeline is implemented as a Kubernetes custom resource. |
Revision as of 03:01, 29 April 2022
External
- https://tekton.dev/docs/pipelines/pipelines/
- https://github.com/tektoncd/pipeline/blob/main/docs/README.md
- https://github.com/tektoncd/pipeline/blob/main/docs/pipelines.md
Internal
Overview
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. Tekton collects all the tasks, and based on the dependency relationships declared in definition of the pipeline, it orders the tasks in a DAG, and executes the graph in sequence. That results in the materialization of a number of task pods. The pipeline comes up with additional features, such as the capability to fan-out task execution, retry task execution or verify conditions that tasks must meet before proceeding. The pipeline is implemented as a Kubernetes custom resource.
Example
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
Manifest
apiVersion: tekton.dev/v1beta1 # required field kind: Pipeline # required field metadata: # required field name: <pipeline-name> # required field spec: # required field workspaces: - name: <workspace-name> params: - name: <some-string-param-name> type: string description: some description default: <some-default-value> - name: <some-array-param-name> type: array description: some description resources: tasks: # required field - name: task1-name taskRef: name: task1-ref-name - name: task2-name taskRef: name: task2-ref-name - ...
Tasks in Pipeline
The pipeline specification contains a mandatory list of tasks
. The list specifies the tasks of this pipeline and the details of their execution. The pipeline definition must reference at least one task. Each task must be specified via a valid Kubernetes name and a taskRef
.
kind: Pipeline spec: tasks: - name: task-name taskRef: name: task-ref-name bundle: docker.com/myrepo/mycatalog params: - name: param-name value: param-value matrix: - name: matrix-name value: - value1 - value2 workspaces: - name: <name> workspace: <workspace> resources: inputs: - name: input-resource-name resource: input-resource outputs: - name: output-resource-name resource: output-resource
Resources
TO PROCESS: https://tekton.dev/docs/pipelines/pipelines/#specifying-resources-in-pipelinetasks