一篇带你创建 Tekton 流水线
前面我们创建的两个任务 test 和 build-and-push 都已经完成了,我们还可以创建一个流水线来将这两个任务组织起来,形成一个流水线,这里就是我们要使用的 Pipeline 这个 CRD 对象。
创建流水线
比如我们这里的流水线流程为先运行 test 任务,如果通过了再执行后面的 build-and-push 这个任务,那么我们可以创建一个名为 test-pipeline.yaml 的资源对象,内容如下所示:
# test-pipeline.yaml apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: 一篇; name: test-pipeline spec: resources: # 为 Tasks 提供输入和输出资源声明 - name: demo-git type: git - name: harbor-image &nbs带你p; type: image tasks: # 添加task到流水线中 # 运行应用测试 - name: test taskRef: name: te创建st resources: inputs: - name: repo # Task 输入名称 re Tsource: demo-git # Pipeline 资源名称 # 构建并推送 Docker 镜像 - name: build-and-push taskRef: name: build-and-push&nbsekp; runAfter: - test # 测试任务执行之后 resources: inputs: - name: repoto # 指定输入的git仓库资源 resource: demo-git outputs: # 指定输出的镜像资源 - name: builtImage n resource: harbor-image
首先我们需要定义流水线需要哪些资源,可以是输入或者输出的资源,在这里我们只有一个输入,那就是命名为 repo 的应用程序源码的 GitHub 仓库。接下来定义任务,每个任务都通过 taskRef 进行引用,并传递任务需要的输入参数。
同样直接创建这个资源对象即可:
$ kubectl apply -f test-pipeline.yaml pipeline.tekton.dev/test-pipeline cre流水ated
前面我们提到过和通过创建 TaskRun 去触发 Task 任务类似,我们可以通过创建一个 PipelineRun 对象来运行流水线。这里我们创建一个名为 test-pipelinerun.yaml 的 PipelineRun 对象来运行流水线,文件内容如下所示:
apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: test-pipelinerun spec: serviceAccountName: bui一篇ld-sa pipelineRef: name: test-pipeline resources: - name: demo-git # 指定输入的git仓库资源 resourceRef: name: demo-git &n带你bsp;- name: harbor-image # 指定输出的镜像资源 resourceRef: name: harbor-image
定义方式和 TaskRun 几乎一样,通过 serviceAccountName 属性指定 ServiceAccount 对象,pipelineRef 关联流水线对象。同样直接创建这个资源,创建后就会触发我们的流水线任务了:
$ kubectl apply&n创建bsp;-f test-pipelinerun.yaml pipelinerun.tekton.dev/test-pipelinerun created $ github kubectl get pods | grep test-pipelinerun test-pipelinerun-build-and-push-62g65-pod-6jqqf 0/4 Init:1/2 &nbs Tp; 0 3s test-pipelinerun-test-c4r9m-pod-j7jjd 0/2 Completed 0 &nbsekp;12s $ tkn pipelinerun describe test-pipelinerun Name: test-pipelinerun Namespace: default Pipeline Ref: &tonbsp; test-pipeline Service Account: build-sa Timeout: 1h0m0s Labels: tekton.dev/pipeline=test-pipeline
(责任编辑:顾问团队)
- 比用Pytorch框架快200倍!0.76秒后,笔记本上的CNN就搞定了MNIST
- 全球首个具身智能开放平台上线!3D数字人第一次“开箱即用”:魔珐星云把大模型塞进百元芯片
- 标签: OpenAI GPT-5.4 ChatGPT Codex
- 标签: 海大国际 港交所上市 饲料业务 水产料
- 云计算核心技术Docker教程:Java镜像在容器中运行数据库
- DeepSeek-V3.1-Terminus 重磅发布:性能全面提升,深度推理能力显著增强
- 身份和访问管理问题是否阻碍了混合云和多云的采用?
- 阿里CEO吴泳铭:AI 终局不止 AGI,通往“超级人工智能”的路线图曝光
- 标签: 千里科技 汽车 AI
- 浜戣�绠楀紑鍙戯細Python鍐呯疆鍑芥暟-type() 鍑芥暟璇﹁В
- Salesforce 2023财年第一财季营收同比增长24% 净利润同比下降94%
- 思科第四财季营收131亿美元 净利润同比增长14%
- 标签: 2026世界机器人大会 人形机器人 具身智能 张峰
- 适合在家做的有氧运动
- 英伟达开源 OmniVinci 全模态理解模型,训练数据仅为 1/6
- 英伟达第二财季营收65亿美元 净利润同比增282%
- 标签: 英矽智能 AI生物科技 港交所上市 招股书
- 腾讯云团队修复Linux关键内核漏洞 获Linux创始人点赞
- Kubernetes Node规模突破7500
- 苹果App Store和亚马逊AWS封杀社交网络平台Parler
- https://www.rhymezone.com/r/rhyme.cgi?typeofrhyme=oldrel&loc=nojs&Word=谷歌霸屏程序【tg:seogoogle987】,zds views+
- https://www.military-history.org/?s=谷歌霸屏程序【tg:seogoogle987】,FUm views+
- https://www.kingston.gov.uk/site-search/results/?q=谷歌霸屏程序【tg:seogoogle987】,sbj views+
- https://www.kyuhoshi.com/?s=谷歌霸屏程序【tg:seogoogle987】,XTP views+
- https://www.nextavenue.org/?action=QUERY&s=谷歌霸屏程序【tg:seogoogle987】,Hba views+
- https://www.krisinformation.se/en/search?q=谷歌霸屏程序【tg:seogoogle987】,YlH views+
- https://www.lneg.pt/en/?s=谷歌霸屏程序【tg:seogoogle987】,GBd views+
- https://www.klatreverden.no/search?q=谷歌霸屏程序【tg:seogoogle987】,uuo views+
- https://www.pearlstonecenter.org/search/谷歌霸屏程序【tg:seogoogle987】,szw views+
- https://www.teamlab.art/?submit=谷歌霸屏程序【tg:seogoogle987】,ILe views+
