tekton taskrun资源
tekton新课发布:https://edu.csdn.net/course/detail/35202
什么是taskrun
使用TaskRun资源对象创建并运行群集上的进程以完成操作。task只是定义了一个任务模版,taskRun才真正代表了一次实际的运行,启动taskrun才可以运行task,当然你也可以自己手动创建一个taskRun,taskRun创建出来之后,就会自动触发task描述的构建任务。taskRun只有当task的所有Step都执行完成才会运行完。
资源详解
taskRef
taskrun/taskrun-taskref.yaml
apiVersion: tekton.dev/v1beta1 kind: Task metadata:name: hello spec:steps:- name: helloimage: ubuntucommand:- echoargs:- "Hello World!" --- apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata:name: hello-run spec:taskRef:name: hello
taskSpec
taskrun/taskrun-taskSpec.yaml
apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata:generateName: taskspec- spec:taskSpec:steps:- name: helloimage: ubuntucommand:- echoargs:- "Hello World!"
serviceAccountName
task/resources/sa.yaml
apiVersion: v1 kind: ServiceAccount metadata:name: test-task-robot-git-ssh secrets:- name: registry-secret
kubectl create secret docker-registry registry-secret \--docker-server=registry.cn-beijing.aliyuncs.com \--docker-username=195446040@qq.com \--docker-password=123456 -n tekton
task/resources/res-dockerfile-examples.yaml
apiVersion: tekton.dev/v1alpha1 kind: PipelineResource metadata:name: dockerfile-examples spec:type: gitparams:- name: urlvalue: https://github.com/13567436138/tekton.git- name: revisionvalue: main
task/resources/res-my-app-image.yaml
apiVersion: tekton.dev/v1alpha1 kind: PipelineResource metadata:name: my-app-image spec:type: imageparams:- name: urlvalue: registry.cn-beijing.aliyuncs.com/hxpdocker/tekton-test
task/resources/task-example-task.yaml
apiVersion: tekton.dev/v1beta1 kind: Task metadata:name: example-task spec:params:- name: pathToDockerFiletype: stringdescription: The path to the dockerfile to builddefault: /workspace/workspace/resources:inputs:- name: workspacetype: gitoutputs:- name: builtImagetype: imagesteps:- image: docker:20.10.5command: ["docker"]imagePullPolicy: IfNotPresentargs: - build- --tag - $(resources.outputs.builtImage.url)- $(params.pathToDockerFile)volumeMounts:- name: docker-socketmountPath: /var/run/docker.sock- name: dockerfile-pushexampleimage: docker:20.10.5imagePullPolicy: IfNotPresentcommand: ["docker"]args: ["push","$(resources.outputs.builtImage.url)"]volumeMounts:- name: docker-socketmountPath: /var/run/docker.sock
task/resources/taskrun-mytaskrun.yaml
apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata:generateName: mytaskrun- spec:serviceAccountName: test-task-robot-git-sshtaskRef:name: example-taskresources:inputs:- name: workspaceresourceRef:name: dockerfile-examplesoutputs:- name: builtImageresourceRef:name: my-app-imagepodTemplate:volumes:- name: docker-sockethostPath:path: /var/run/docker.socktype: Socket
params
taskrun/taskrun-params.yaml
apiVersion: tekton.dev/v1beta1 kind: Task metadata:name: my-params-array spec:params:- name: array-paramtype: arraydefault:- a- b- csteps:- image: ubuntucommand: [echo]args:- "$(params.array-param[*])"imagePullPolicy: IfNotPresent --- apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata:generateName: params- spec:taskRef:name: my-params-arrayparams:- name: array-paramvalue: - xxx- yyy
resources
task/resources/sa.yaml
apiVersion: v1 kind: ServiceAccount metadata:name: test-task-robot-git-ssh secrets:- name: registry-secret
kubectl create secret docker-registry registry-secret \--docker-server=registry.cn-beijing.aliyuncs.com \--docker-username=195446040@qq.com \--docker-password=123456 -n tekton
task/resources/res-dockerfile-examples.yaml
apiVersion: tekton.dev/v1alpha1 kind: PipelineResource metadata:name: dockerfile-examples spec:type: gitparams:- name: urlvalue: https://github.com/13567436138/tekton.git- name: revisionvalue: main
task/resources/res-my-app-image.yaml
apiVersion: tekton.dev/v1alpha1 kind: PipelineResource metadata:name: my-app-image spec:type: imageparams:- name: urlvalue: registry.cn-beijing.aliyuncs.com/hxpdocker/tekton-test
task/resources/task-example-task.yaml
apiVersion: tekton.dev/v1beta1 kind: Task metadata:name: example-task spec:params:- name: pathToDockerFiletype: stringdescription: The path to the dockerfile to builddefault: /workspace/workspace/resources:inputs:- name: workspacetype: gitoutputs:- name: builtImagetype: imagesteps:- image: docker:20.10.5command: ["docker"]imagePullPolicy: IfNotPresentargs: - build- --tag - $(resources.outputs.builtImage.url)- $(params.pathToDockerFile)volumeMounts:- name: docker-socketmountPath: /var/run/docker.sock- name: dockerfile-pushexampleimage: docker:20.10.5imagePullPolicy: IfNotPresentcommand: ["docker"]args: ["push","$(resources.outputs.builtImage.url)"]volumeMounts:- name: docker-socketmountPath: /var/run/docker.sock
task/resources/taskrun-mytaskrun.yaml
apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata:generateName: mytaskrun- spec:serviceAccountName: test-task-robot-git-sshtaskRef:name: example-taskresources:inputs:- name: workspaceresourceRef:name: dockerfile-examplesoutputs:- name: builtImageresourceRef:name: my-app-imagepodTemplate:volumes:- name: docker-sockethostPath:path: /var/run/docker.socktype: Socket
timeout
taskrun/taskrun-timeout.yaml
apiVersion: tekton.dev/v1beta1 kind: Task metadata:name: hello spec:steps:- name: helloimage: ubuntucommand:- echoargs:- "Hello World!" --- apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata:generateName: timout-run- spec:taskRef:name: hellotimeout: 1s
podTemplate
taskrun/taskrun-podTemplate.yaml
apiVersion: tekton.dev/v1beta1 kind: Task metadata:name: hello-podtemplate spec:steps:- name: helloimage: ubuntucommand:- id --- apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata:generateName: podtemplate- spec:taskRef:name: hello-podtemplatepodTemplate:securityContext:runAsNonRoot: truerunAsUser: 1001
workspaces
task/task-workspaces.yaml
apiVersion: tekton.dev/v1beta1 kind: Task metadata:name: workspaces spec:steps:- name: write-messageimage: ubuntuscript: |#!/usr/bin/env bashset -xeif [ "$(workspaces.messages.bound)" == "true" ] ; thenecho hello! > $(workspaces.messages.path)/messagecat $(workspaces.messages.path)/messagefiworkspaces:- name: messagesdescription: |The folder where we write the message to. If no workspaceis provided then the message will not be written.optional: truemountPath: /test
task/taskrun-workspaces.yaml
apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata:generateName: workspaces- spec:taskRef:name: workspacesworkspaces:- name: messagesemptyDir: {}
tekton taskrun资源相关推荐
- tekton task资源
欢迎关注我的公众号: 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下: istio多集群探秘,部署了50次多集群后我得出的结论 istio多集群链路追踪,附实操视频 istio防故障利器,你 ...
- [OpenShift 4 - DevSecOps Workshop (16) - 使用 VSCode 编辑运行 Tekton Pipeline 资源
<OpenShift 4.x HOL教程汇总> 说明:本文已经在OpenShift 4.8环境中验证 <OpenShift 4 - DevSecOps Workshop 系列视频 & ...
- tekton pipeline资源
欢迎关注我的公众号: 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下: istio多集群探秘,部署了50次多集群后我得出的结论 istio多集群链路追踪,附实操视频 istio防故障利器,你 ...
- tekton EventListener资源
欢迎关注我的公众号: 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下: istio多集群探秘,部署了50次多集群后我得出的结论 istio多集群链路追踪,附实操视频 istio防故障利器,你 ...
- tekton TriggerTemplate资源
欢迎关注我的公众号: 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下: istio多集群探秘,部署了50次多集群后我得出的结论 istio多集群链路追踪,附实操视频 istio防故障利器,你 ...
- tekton TriggerBinding资源
欢迎关注我的公众号: 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下: istio多集群探秘,部署了50次多集群后我得出的结论 istio多集群链路追踪,附实操视频 istio防故障利器,你 ...
- 云原生 CI/CD 框架 Tekton 初体验
Tekton 是一款功能非常强大而灵活的 CI/CD 开源的云原生框架.Tekton 的前身是 Knative 项目的 build-pipeline 项目,这个项目是为了给 build 模块增加 pi ...
- 云原生Tekton之触发器Trigger
背景 前面的文章讲了tekton中pipeline的教程和使用案例,大家有没有想过,每次都要运行taskrun或者pipelineRun才能真正运行流水线.那怎么做到自动化执行taskrun和pipe ...
- Tekton系列之理论篇【二】
作者 | 乔克 博客 | https://www.coolops.cn 公众号 | 运维开发故事(ID:mygsdcsf) 上一篇文章我们介绍了Tekton的安装并且做了简单的测试,但是我们并不知其所 ...
最新文章
- 小程序大转盘红包雨营销组件
- A53 cache的架构解读
- 关于启明星辰IDS无法CONSOLE连接
- Windows—JDK安装与环境变量配置
- 安卓APP_ Fragment(5)—— Fragment + ViewPager2 模拟微信首页 (2)两者联动翻页
- 2021 程序媛跳槽记:学习计划篇(已收获字节等offer)
- C++容器删除数据时迭代器失效
- 阿里云市场联合犀思云开启云V认证 首推“严选”模式企业采购更安心
- 手机修改html离线网页内容,HTML5 离线应用之打造零请求、无流量网站的解决方法...
- 给定一段IP地址172.18.18.128/26,试为该网络做一个IP地址规划,要求开 发室1、开发室2以及制造部各为一个VLAN。
- 笔记13-1(C语言 三子棋)
- 迭代器 iter()函数与next()函数 for...in...循环的本质
- 《都挺好》一部黑码农的神剧!
- 基于Android的手机点名签到学生请假考勤系统
- 跨语言rpc框架Thrift
- 评论区抽奖程序2.0
- 补色的视觉原理(转)
- ARM NandFlash 介绍
- python与人工智能关系论文_《Python深度学习》笔记:人工智能、机器学习与深度学习关系...
- 我的智能物联网硬件之路--电子价签
热门文章
- git和远程仓库建立连接详细过程
- 岭南师范学院计算机考试题库和答案,2017年岭南师范学院第51次考全国计算机等级考试NCR报考程序...
- 查找算法【平衡二叉树】 - 平衡二叉树的创建
- 系统盘修复计算机命令,win10系统无法正常开机提示引导文件丢失使用命令修复的方法 无需U盘...
- 数据库错误:1265
- EXCEL中对一列数据每隔n行提取数据出来
- 【定义】向量与向量组
- python的range函数用法和实例
- C语言编程题:用泰勒级数求自然数e的近似值
- “8 岁学编程,做了近 40 年程序员,我总结了 15 条经验宝典”