
Tekton is the standard CI/CD tool for Kubernetes environments. For the DevOps folks that are familiar with Jenkins CI/CDs (my case), it might take some time to get used to it. However, it makes a lot of sense to use Tekton simply because it is cloud native and built using Kubernetes resources.
Tekton components
Tekton is based on the following components:
- Pipeline resources
Any input or output object used by the Pipeline - Pipeline run
A Pipeline instance, that defines the input based on the resources and expected output - Pipeline
A series of ordered tasks - Tasks
A series of ordered steps
Pipeline resources
Any input or output object used by the Pipeline.
A resource object can be a container image created by the pipeline or a git repo used to build such image.
Jenkins equivalent for Pipeline Resources would be the Git respositories that are configured in the project, as well as any artifact defined to ouput the build results. A jar file for instance.

Tasks
Build steps to compile code, execute tests or create container images.

Tasks are the same as build steps in Jenkins. Those can be defined in the JenkinsFile or within a pipeline configuration.

Tasks are defined in Tekton using a custom resource as following:
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: hello
spec:
steps:
- name: echo
image: alpine
script: |
#!/bin/sh
echo "Hello World"
Pipeline
Defines the steps of the CI/CD process by using pre-defined tasks on each step

A Tekton Pipeline would be the same as a Pipeline Script in Jenkins or a declarative JenkinsFile used to define a list of build steps.

The following example shows how a Tekton Pipeline can be declared through a custom resource:
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: hello-goodbye
spec:
params:
- name: username
type: string
tasks:
- name: hello
taskRef:
name: hello
- name: goodbye
runAfter:
- hello
taskRef:
name: goodbye
params:
- name: username
value: $(params.username)
Pipeline Run
Defines parameters and resources for a pipeline execution.

If you ever had to run a Jenkins job with parameters, that’s what a Pipeline Run in Tekton does. It defines some variables and other attributes that will used during the pipeline execution.

This is a sample resource for a Pipeline Run:
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: hello-goodbye-run
version: 1.0.1
spec:
pipelineRef:
name: hello-goodbye
params:
- name: username
value: "Tekton"
Deixe um comentário