您现在的位置是:热点 >>正文
一篇带你创建 Tekton 流水线
热点19976368人已围观
简介...
前面我们创建的两个任务 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  带你; type: image tasks: # 添加task到流水线中 # 运行应用测试 - name: test taskRef: name:&nb创建sp;test resources: inputs: - name: repo # Task 输入名称 &nb Tsp;resource: demo-git # Pipeline 资源名称 # 构建并推送 Docker 镜像 - name: build-and-push taskRef: name: build-and-push&eknbsp; runAfter: - test # 测试任务执行之后 resources: inputs: - name:&nbstop;repo # 指定输入的git仓库资源 resource: demo-git outputs: # 指定输出的镜像资源 - name: builtImage &n nbsp; resource: harbor-image
首先我们需要定义流水线需要哪些资源,可以是输入或者输出的资源,在这里我们只有一个输入,那就是命名为 repo 的应用程序源码的 GitHub 仓库。接下来定义任务,每个任务都通过 taskRef 进行引用,并传递任务需要的输入参数。
同样直接创建这个资源对象即可:
$ kubectl apply -f test-pipeline.yaml pipeline.tekton.dev/test-pipeline流水 created
前面我们提到过和通过创建 TaskRun 去触发 Task 任务类似,我们可以通过创建一个 PipelineRun 对象来运行流水线。这里我们创建一个名为 test-pipelinerun.yaml 的 PipelineRun 对象来运行流水线,文件内容如下所示:
apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: test-pipelinerun spec: serviceAccount一篇Name: build-sa pipelineRef: name: test-pipeline resources: - name: demo-git # 指定输入的git仓库资源 resourceRef: name: demo-git&nb带你sp; - name: harbor-image # 指定输出的镜像资源 resourceRef: name: harbor-image
定义方式和 TaskRun 几乎一样,通过 serviceAccountName 属性指定 ServiceAccount 对象,pipelineRef 关联流水线对象。同样直接创建这个资源,创建后就会触发我们的流水线任务了:
$ kubectl a创建pply -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 &nb Tsp; 0 3s test-pipelinerun-test-c4r9m-pod-j7jjd 0/2 Completed 0 &nekbsp; 12s $ tkn pipelinerun describe test-pipelinerun Name: test-pipelinerun Namespace: default Pipeline Ref: &nbstop; test-pipeline Service Account: build-sa Timeout: 1h0m0s Labels: tekton.dev/pipeline=test-pipeline
Tags:
相关文章
标签: 华为 Atlas 950 SuperPoD TaiShan 灵衢 MWC2026
热点云梦级3月1日云梦级消息,在MWC2026 巴塞罗那期间,华为首次在海外展示最新的Atlas 950 SuperPoD,TaiShan 950 SuperPoD 等多个型号超节点产品和解决方案,并强调...
【热点】
阅读更多为什么投资人不担心阿里云有泡沫?
热点Fast Reading 吴泳铭表示,将在3800亿元AI基础设施的建设上,追加更大的投入。 当下资本市场的AI投资逻辑:宁愿买错,也不愿意踏空。这种对于交易资本支出的狂热是驱动阿里市值增长的原因之一...
【热点】
阅读更多标签: OpenAI Pinterest ChatGPT AI购物
热点云梦级1月6日云梦级消息,据外媒The Information预测,OpenAI或将收购Pinterest。报道称OpenAI看中的是Pinterest的用户数据,尤其是产品搜索方面的洞察。如果能拿下...
【热点】
阅读更多
热门文章
最新文章
友情链接
- 标签: 康师傅
- https://www.nonsolocap.it/cap?action=SEARCH&k=外推留痕软件【tg:seogoogle987】,XDk
- https://www.hanbat.ac.kr/search/front/Search.jsp?qt=外推留痕软件【tg:seogoogle987】BRC
- https://www.kawainter.com/catalogsearch/result/?q=外推留痕软件【tg:seogoogle987】,Twn
- https://www.youthforum.org/search-results?cx=4f5236218ab5e8ef9&ie=UTF-8&q=外推留痕软件【tg:seogoogle987】,6MT
- https://www.temu.com/search_result.html?search_key=外推留痕软件【tg:seogoogle987】RCF
- https://www.usslexington.com/?action=QUERY&s=外推留痕软件【tg:seogoogle987】,jSr
- https://m.shoppinghow.kakao.com/m/search/q/外推留痕软件【tg:seogoogle987】gEh
- https://www.paspaley.com/catalogsearch/result/?action=QUERY&q=外推留痕软件【tg:seogoogle987】,CeA
- https://www.smarty.net/search?q=外推留痕软件【tg:seogoogle987】,fVi
- https://www.wuv.edu/?s=外推留痕软件【tg:seogoogle987】,be9
- https://www.lneg.pt/en/?s=外推留痕软件【tg:seogoogle987】,I7t
- https://www.xbiao.com/search/index?tpf&wd=外推留痕软件【tg:seogoogle987】,U22
- https://www.pierreherme.com/catalogsearch/result/?q=外推留痕软件【tg:seogoogle987】,MzC
- https://www.reginatangoshoes.com/en/catalogsearch/result/index/?T=1686132113407&q=外推留痕软件【tg:seogoogle987】,qCv
- https://www.kyuhoshi.com/?s=外推留痕软件【tg:seogoogle987】,Yxn
- https://www.umc.edu/search.aspx?ID=I4gnDKRS991MFcIDDzoYze4aWSAszAm7&q=外推留痕软件【tg:seogoogle987】,oc3
- https://www.qylaws.com/search/外推留痕软件【tg:seogoogle987】,eYJ
- https://store.line.me/search/sticker/ja?q=外推留痕软件【tg:seogoogle987】sZf
- https://www.libros.unam.mx/catalogsearch/result/?cat=37&dir=asc&format=20&lit=20&manufacturer=3230&mode=list&order=year_edition&q=外推留痕软件【tg:seogoogle987】,Irk
- https://www.mesec.cz/vyhledavani/?qs=外推留痕软件【tg:seogoogle987】,r2l
- https://www.ng-slo.si/si/iskanje?cat=114&q=外推留痕软件【tg:seogoogle987】,0Pv
- https://www.impactpool.org/search/?type=79&q=外推留痕软件【tg:seogoogle987】8j9
- https://www.mdbg.net/chinese/dictionary?page=worddict&wdrst=0&wdqb=外推留痕软件【tg:seogoogle987】,Ezs
- https://www.sbaad.no/?s=外推留痕软件【tg:seogoogle987】,BEH
- https://www.teamlab.art/fr/?submit=外推留痕软件【tg:seogoogle987】,Io9
- https://www.tiktok.com/tag/外推留痕软件【tg:seogoogle987】,jFV
- https://www.rollingstone.it/?ID=DVMeu3AlmzZE1cuJ2FmgmO5TSCQRb3yh&s=外推留痕软件【tg:seogoogle987】,i74
- https://www.writingforward.com/?action=SEARCH&s=外推留痕软件【tg:seogoogle987】,Icx
- https://www.teamlab.art/zh-hans/?submit=外推留痕软件【tg:seogoogle987】,mKv
- https://www.tarleton.edu/?s=外推留痕软件【tg:seogoogle987】,jzr
- https://www.paulaschoice.hk/zh_hant/catalogsearch/result/?q=外推留痕软件【tg:seogoogle987】,VeT
- https://www.sbaad.no/search/外推留痕软件【tg:seogoogle987】,Ez4
- https://www.oprny.com/search.php?search_query=外推留痕软件【tg:seogoogle987】,4mS
- https://www.ncetm.org.uk/search?action=CHECK&q=外推留痕软件【tg:seogoogle987】,qMX
- https://www.paxnet.co.kr/search/jongmok?kwd=外推留痕软件【tg:seogoogle987】JZJ
- https://search.danawa.com/dsearch.php?query=外推留痕软件【tg:seogoogle987】y3F
- https://www.nytimes.com/search?dropmab=true&query=外推留痕软件【tg:seogoogle987】,giS
- https://www.qwant.com/?q=外推留痕软件【tg:seogoogle987】,1AX
- https://www.schenckprocess.com/search?q=外推留痕软件【tg:seogoogle987】,IlF
- https://www.tcv.org.uk/search/外推留痕软件【tg:seogoogle987】,tc5
- https://www.synonyms.com/antonyms/外推留痕软件【tg:seogoogle987】,GeO
- https://www.supersauna.de/catalogsearch/result/?q=外推留痕软件【tg:seogoogle987】,rsJ
- https://www.trockenmittel.ch/catalogsearch/result/?iC=ZM3&q=外推留痕软件【tg:seogoogle987】,Xl7
- https://www.pickett.co.uk/collections/vendors?q=外推留痕软件【tg:seogoogle987】,H60
- https://www.mynextmove.org/find/search?s=外推留痕软件【tg:seogoogle987】,TVz
- https://www.symatoys.com/search.html?ID=UyMD6aO58bPrJvQAB1I0N69KzJBZeNPC&keyword=外推留痕软件【tg:seogoogle987】,a5F
- https://www.resilienz-akademie.com/?cat=71&s=外推留痕软件【tg:seogoogle987】,0N0
- https://www.lauben.com/de/?s=外推留痕软件【tg:seogoogle987】,odj
- https://www.military-history.org/?s=外推留痕软件【tg:seogoogle987】,0sh
- https://www.maigoo.com/search/?block=&q=外推留痕软件【tg:seogoogle987】,dcN