3.6 在Step中运行脚本
- 需要在Step中执行复杂操作时,可以使用“script”直接指定要运行的脚本
- 多行脚本,可以使用“|”启用
- script同command互斥
root@k8s-master01:~/tekton-and-argocd-in-practise/02-tekton-basics# cat 04-task-step-with-script.yaml
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: script
spec:
steps:
- name: step-with-script
image: alpine:3.15
script: |
#!/bin/sh
echo "Step with Script..."
echo "Installing necessary tooling"
sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g'