tekton从入门到跑路-2-用一个pipeline串起多个ta

2021-02-04  本文已影响0人  万州客

这是tekton的基本功能了,这里作一下演示,还没有涉及到具体编译,而只是简单的echo。

一,第一个task定义
task-hello.yaml

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: hello-tekton
spec:
  steps:
    - name: hello-tekton
      image: rancher/library-busybox:1.31.1
      command:
        - echo
      args:
        - "Hello Tekton!"

二,第二个task定义
task-goodby.yaml

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: tekton-goodbye
spec:
  steps:
    - name: tekton-goodbye
      image: rancher/library-busybox:1.31.1
      command:
        - echo
      args:
        - "Goodbye Tekton!"
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: hello-goodbye
spec:
  tasks:
  - name: hello
    taskRef:
      name: hello-tekton
  - name: goodbye
    runAfter:
     - hello
    taskRef:
      name: tekton-goodbye
[root@localhost tekton]# tkn pipeline start hello-goodbye
PipelineRun started: hello-goodbye-run-lrq6d

In order to track the PipelineRun progress run:
tkn pipelinerun logs hello-goodbye-run-lrq6d -f -n default
[root@localhost tekton]# tkn pipelinerun logs hello-goodbye-run-lrq6d -f -n default
[hello : hello-tekton] Hello Tekton!

[goodbye : tekton-goodbye] Goodbye Tekton!
2021-02-04 10_42_48-214 - root@localhost_~_tekton - Xshell 6 (Free for Home_School).png
上一篇 下一篇

猜你喜欢

热点阅读