Tekton
5.16
https://tekton.dev/ 是开源的云原生的 CI/CD 系统.
- 基于 Kubernetes, 使用
kubectl
命令 - 配置文件为 Kubernets Object 格式的 yaml 文件
安装
https://tekton.dev/docs/installation
本地安装 Kubernetes cluster
例子为 Linux Debian, 安装 minikube, docker
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
minikube start --driver=docker --force
minikube kubectl -- get pods -A
alias kubectl="minikube kubectl --"
安装 Teckton Pipelines
如果容器网络连接不上, 可能会卡在这里
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
kubectl get pods --namespace tekton-pipelines --watch
运行
Tasks
https://tekton.dev/docs/getting-started/tasks/
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: hello
spec:
steps:
- name: echo
image: alpine
script: |
#!/bin/sh
echo "Hello World"
kubectl apply --filename hello-world.yaml
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: hello-task-run
spec:
taskRef:
name: hello
kubectl apply --filename hello-world-run.yaml
查看结果
kubectl get taskrun hello-task-run
kubectl logs --selector=tekton.dev/taskRun=hello-task-run
📖