Published
- 2 min read
Tekton for CI/CD
Do you love using Github Actions ? or Gitlab CI ? for convenience ? You are missing out on these 2 key things
- Vendor Independence
- Cannot be run on your laptop, ever, impossible.
Problems with Cloud CI/CD
Vendor Independence
With github actions you are locked in to Github and really Microsoft, once you sink the cost into writing your CI/CD pipelines in Github Actions, the cost in terms of developer cost and disruption to the team to move out is high and will prevent you from moving out even if you want to.
Why would you want to move out ? What if you don’t like github ? difficult to imagine but totally possible.
Cannot be run on your laptop
Its impossible to run a github actions pipeline on your laptop. It was never designed with that in mind.
Tekton
High Level Idea
Tekton is deployed on k8s cluster and registers its own CRD (Custom Resource Definitions). This means that just like you use k8s to submit YAML files for Deployments, Statefulsets etc. you need to submit YAML files for each of Tekton Custom Resources like Pipeline, Task etc. This is a great way to reuse kubectl to create custom third party resources.
There are 10 CRDs registered by Tekton
#$ kubectl get crds
NAME CREATED AT
clustertasks.tekton.dev 2024-01-19T18:06:51Z
customruns.tekton.dev 2024-01-19T18:06:51Z
extensions.dashboard.tekton.dev 2024-01-19T18:14:00Z
pipelineruns.tekton.dev 2024-01-19T18:06:51Z
pipelines.tekton.dev 2024-01-19T18:06:51Z
resolutionrequests.resolution.tekton.dev 2024-01-19T18:06:51Z
stepactions.tekton.dev 2024-01-19T18:06:51Z
taskruns.tekton.dev 2024-01-19T18:06:51Z
tasks.tekton.dev 2024-01-19T18:06:51Z
verificationpolicies.tekton.dev 2024-01-19T18:06:51Z
Creating a Pipeine
use code hike here for 2 pane view
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: hello-pipeline
spec:
tasks:
- name: echo-hello-task
taskRef:
name: echo-hello
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: echo-hello
spec:
steps:
- name: echo
image: ubuntu
script: |
#!/bin/bash
echo "Hello, Tekton!"
Running a Pipeline
To run the pipeline -
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: hello-pipeline-run-
spec:
pipelineRef:
name: hello-pipeline