articles. tech. automation.

Tekton Quick Migration Guide from Jenkins

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.

Tasks

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

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

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.

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"

Avatar de jorge.senger

Deixe um comentário

O seu endereço de email não será publicado. Campos obrigatórios marcados com *

Jorge A. Senger

Software architect
Red Hat Certified Engineer
AWS Certified Architect
IBM Cloud Certified Architect