当前位置: 首页 > news >正文

东莞seo网站建设公司优秀网页设计作品

东莞seo网站建设公司,优秀网页设计作品,互联网做网站属于什么行业,wd设计视图可以做网站吗上一篇为大家详细介绍了tekton - pipeline,由于里面涉及到的概念比较多,因此需要好好消化下。同样,今天在特别为大家分享下tekton - Trigger以及案例演示,希望可以给大家提供一种思路哈。 文章目录 1. Tekton Trigger2. 工作流程3…

上一篇为大家详细介绍了tekton - pipeline,由于里面涉及到的概念比较多,因此需要好好消化下。同样,今天在特别为大家分享下tekton - Trigger以及案例演示,希望可以给大家提供一种思路哈。

文章目录

    • 1. Tekton Trigger
    • 2. 工作流程
    • 3. 安装trigger和interceptors
    • 4. 案例
      • 案例: gitlab跳代码触发tekton
        • step1: 创建task - 拉取代码
        • step2: 创建task - 构建代码
        • step3: 创建task - 打包镜像
        • step4: 创建pipeline
        • step5: 创建pipelinerun
        • step6: 创建事件监听器
        • step7: 创建TriggerBinding文件
        • step8: 创建TriggerTemplate模版文件
        • step9: 创建sa
        • step10: 创建gitlab webhook的信息
        • step11: 创建RBAC
        • step12: gitlab创建webhook
      • 测试

1. Tekton Trigger

Trigger 组件就是用来解决这个触发问题的,它可以从各种来源的事件中检测并提取需要信息,然后根据这些信息来创建 TaskRun 和 PipelineRun,还可以将提取出来的信息传递给它们以满足不同的运行要求。

Tekton Trigger中有6类对象,分别是:

  • EventListener:事件监听器,是外部事件的入口 ,通常需要通过HTTP方式暴露,以便于外部事件推送,比如配置Gitlab的Webhook。
  • Trigger:指定当 EventListener 检测到事件发生时会发生什么,它会定义 TriggerBinding、TriggerTemplate 以及可选的 Interceptor。
  • TriggerTemplate:用于模板化资源,根据传入的参数实例化 Tekton 对象资源,比如 TaskRun、PipelineRun等。
  • TriggerBinding:用于捕获事件中的字段并将其存储为参数,然后会将参数传递给 TriggerTemplate。
  • ClusterTriggerBinding:和 TriggerBinding 相似,用于提取事件字段,不过它是集群级别的对象。
  • Interceptors:拦截器,在 TriggerBinding 之前运行,用于负载过滤、验证、转换等处理,只有通过拦截器的数据才会传递给TriggerBinding。

2. 工作流程

在这里插入图片描述

  • step1:EventListener 用于监听外部事件(具体触发方式为 http),外部事件产生后被 EventListener 捕获,然后进入处理过程。

  • step2:首先会由 Interceptors 来进行处理(如果有配置 interceptor 的话),对负载过滤、验证、转换等处理,类似与 http 中的 middleware。

  • step3:Interceptors 处理完成后无效的事件就会被直接丢弃,剩下的有效事件则交给 TriggerBinding 处理,

  • step4:TriggerBinding 实际上就是从事件内容中提取对应参数,然后将参数传递给 TriggerTemplate。

  • step5:TriggerTemplate 则根据预先定义的模版以及收到的参数创建 TaskRun 或者 PipelineRun 对象。

  • step6:TaskRun 或者 PipelineRun 对象创建之后就会触发对应 task 或者 pipeline 运行,整个流程就全自动了。

3. 安装trigger和interceptors

# install reigger
kubectl apply --filename https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml
# install interceptors
kubectl apply --filename https://storage.googleapis.com/tekton-releases/triggers/latest/interceptors.yaml
# monitor
kubectl get pods --namespace tekton-pipelines --watch

4. 案例

案例: gitlab跳代码触发tekton

step1: 创建task - 拉取代码

同pipeline案例2

step2: 创建task - 构建代码

同pipeline案例2

step3: 创建task - 打包镜像

task-package.yaml

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:name: package-2
spec:workspaces:- name: source # 名称params:- name: image_desttype: stringdefault: "registry.ap-southeast-1.aliyuncs.com/my_image_repo"- name: shatype: stringdefault: "latest"- name: DockerfilePathtype: stringdefault: Dockerfile- name: Contexttype: stringdefault: .- name: project_nametype: stringdefault: "test"steps:- name: packageimage: docker:stableworkingDir: $(workspaces.source.path)script: |#/usr/bin/env shTag=$(params.sha)tag=${Tag:0:6}docker login registry.ap-southeast-1.aliyuncs.comdocker build -t $(params.image_dest)/$(params.project_name):${tag} -f $(params.DockerfilePath) $(params.Context)docker push $(params.image_dest)/$(params.project_name):${tag}volumeMounts:- name: dockersorckmountPath: /var/run/docker.sockvolumes:- name: dockersorckhostPath:path: /var/run/docker.sock
step4: 创建pipeline

pipeline.yaml

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:name: clone-build-push-2
spec:description: |This pipeline clones a git repo, builds a Docker image with Kaniko andpushes it to a registryparams:- name: repo-urltype: string- name: shatype: string- name: project_nametype: string- name: versiontype: stringworkspaces:- name: shared-datatasks:# 拉取代码- name: fetch-sourcetaskRef:name: git-cloneworkspaces:- name: outputworkspace: shared-dataparams:- name: urlvalue: $(params.repo-url)- name: revisionvalue: $(params.version)# 打包- name: build-codetaskRef:name: build-2workspaces:- name: sourceworkspace: shared-datarunAfter:- fetch-source# 构建并推送镜像- name: package-imagerunAfter: ["build-code"]taskRef:name: package-2workspaces:- name: sourceworkspace: shared-dataparams:- name: shavalue: $(params.sha)- name: project_namevalue: $(params.project_name)
step5: 创建pipelinerun

pipelinerun.yaml

apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:generateName: clone-build-push-run-#name: clone-build-push-run
spec:serviceAccountName: gitlab-sapipelineRef:name: clone-build-push-2podTemplate:securityContext:fsGroup: 65532workspaces:- name: shared-datavolumeClaimTemplate:spec:accessModes:- ReadWriteOnceresources:requests:storage: 128Miparams:- name: repo-urlvalue: git@jihulab.com:cs-test-group1/kxwang/test.git #https://jihulab.com/cs-test-group1/kxwang/test.git- name: shavalue: bchdsvhj12312312312241421
#  - name: image_tag
#    value: v2- name: versionvalue: refs/heads/master- name: project_namevalue: wkx
step6: 创建事件监听器

EventListener.yaml

apiVersion: triggers.tekton.dev/v1alpha1
kind: EventListener
metadata:name: gitlab-listener  # 该事件监听器会创建一个名为el-gitlab-listener的Service对象namespace: default
spec:resources:kubernetesResource:serviceType: NodePortserviceAccountName: gitlab-satriggers:- name: gitlab-push-events-triggerinterceptors:- ref:name: gitlabparams:- name: secretRef  # 引用 gitlab-secret 的 Secret 对象中的 secretToken 的值value:secretName: gitlab-webhooksecretKey: secretToken- name: eventTypesvalue:- Push Hook # 只接收 GitLab Push 事件bindings:- ref: pipeline-bindingtemplate:ref: pipeline-template
step7: 创建TriggerBinding文件

TriggerBinding.yaml

apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerBinding
metadata:name: pipeline-binding
spec:params:- name: repo-urlvalue: $(body.repository.git_ssh_url)- name: versionvalue: $(body.ref)- name: shavalue: $(body.checkout_sha)- name: project_namevalue: $(body.project.name)
step8: 创建TriggerTemplate模版文件

TriggerTemplate.yaml

apiVersion: v1
kind: Secret
metadata:name: gitlab-webhook
type: Opaque
stringData:secretToken: '123456789'
[root@VM-0-14-centos class-4]# cat TriggerTemplate.yaml
apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
metadata:name: pipeline-template
spec:params:- name: sha- name: project_name- name: version- name: repo-urlresourcetemplates:- apiVersion: tekton.dev/v1beta1kind: PipelineRunmetadata:generateName:  clone-build-push-run-spec:serviceAccountName: gitlab-sapipelineRef:name: clone-build-push-2params:- name: shavalue: $(tt.params.sha)- name: versionvalue: $(tt.params.version)- name: repo-urlvalue: $(tt.params.repo-url)- name: project_namevalue: $(tt.params.project_name)workspaces:- name: shared-datavolumeClaimTemplate:spec:accessModes:- ReadWriteOnceresources:requests:storage: 128Mi
step9: 创建sa

gitlab-sa.yaml

apiVersion: v1
kind: ServiceAccount
metadata:name: gitlab-sa
secrets:
- name: gitlab-auth
- name: gitlab-ssh
- name: docker-credentials
- name: gitlab-webhook
step10: 创建gitlab webhook的信息

secret-gitlab-webhook.yaml

apiVersion: v1
kind: Secret
metadata:name: gitlab-webhook
type: Opaque
stringData:secretToken: '123456789'
step11: 创建RBAC

rbac.yaml

apiVersion: v1
kind: ServiceAccount
metadata:name: gitlab-sa
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:name: triggers-gitlab-clusterrole
rules:# Permissions for every EventListener deployment to function- apiGroups: ["triggers.tekton.dev"]resources: ["eventlisteners", "triggerbindings", "triggertemplates","clustertriggerbindings", "clusterinterceptors","interceptors","triggers"]verbs: ["get","list","watch"]- apiGroups: [""]# secrets are only needed for Github/Gitlab interceptors, serviceaccounts only for per trigger authorizationresources: ["configmaps", "secrets", "serviceaccounts"]verbs: ["get", "list", "watch"]# Permissions to create resources in associated TriggerTemplates- apiGroups: ["tekton.dev"]resources: ["pipelineruns", "pipelineresources", "taskruns"]verbs: ["create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:name: triggers-gitlab-clusterrolebinding
subjects:- kind: ServiceAccountname: gitlab-sanamespace: default
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: triggers-gitlab-clusterrolegitlab-sa.yaml
step12: gitlab创建webhook

在这里插入图片描述

测试

界面提交下code
在这里插入图片描述
创建issue,验证拦截器规则
在这里插入图片描述
在这里插入图片描述


文章转载自:
http://concubinal.sqLh.cn
http://earthen.sqLh.cn
http://preciously.sqLh.cn
http://discrimination.sqLh.cn
http://holophone.sqLh.cn
http://dangleberry.sqLh.cn
http://ticking.sqLh.cn
http://woodlander.sqLh.cn
http://titrator.sqLh.cn
http://iridosmine.sqLh.cn
http://snowslide.sqLh.cn
http://caterwauling.sqLh.cn
http://tropicalize.sqLh.cn
http://teasy.sqLh.cn
http://dm.sqLh.cn
http://vineyardist.sqLh.cn
http://kippen.sqLh.cn
http://hieroglyphic.sqLh.cn
http://cyclone.sqLh.cn
http://riga.sqLh.cn
http://redeployment.sqLh.cn
http://sunshade.sqLh.cn
http://appellor.sqLh.cn
http://parametric.sqLh.cn
http://knotweed.sqLh.cn
http://roo.sqLh.cn
http://azeotropic.sqLh.cn
http://uncio.sqLh.cn
http://boarding.sqLh.cn
http://pentomino.sqLh.cn
http://stabling.sqLh.cn
http://semicirque.sqLh.cn
http://plenary.sqLh.cn
http://hydrostat.sqLh.cn
http://virga.sqLh.cn
http://inhospitality.sqLh.cn
http://dangerousness.sqLh.cn
http://atomic.sqLh.cn
http://yond.sqLh.cn
http://copier.sqLh.cn
http://musketry.sqLh.cn
http://semidarkness.sqLh.cn
http://energise.sqLh.cn
http://collegian.sqLh.cn
http://unsteadiness.sqLh.cn
http://annular.sqLh.cn
http://aquamanile.sqLh.cn
http://sabreur.sqLh.cn
http://derby.sqLh.cn
http://cispadane.sqLh.cn
http://circumscissile.sqLh.cn
http://brahmin.sqLh.cn
http://tenny.sqLh.cn
http://mahabad.sqLh.cn
http://capercaillie.sqLh.cn
http://flora.sqLh.cn
http://staminodium.sqLh.cn
http://theomancy.sqLh.cn
http://comparatively.sqLh.cn
http://bambara.sqLh.cn
http://shakeress.sqLh.cn
http://baiza.sqLh.cn
http://shoehorn.sqLh.cn
http://cerebrovascular.sqLh.cn
http://benthoal.sqLh.cn
http://mislay.sqLh.cn
http://catenoid.sqLh.cn
http://coact.sqLh.cn
http://preregistration.sqLh.cn
http://anthem.sqLh.cn
http://polytheism.sqLh.cn
http://citric.sqLh.cn
http://repellance.sqLh.cn
http://forlorn.sqLh.cn
http://heighten.sqLh.cn
http://nasial.sqLh.cn
http://however.sqLh.cn
http://egyptianism.sqLh.cn
http://medusan.sqLh.cn
http://stenotype.sqLh.cn
http://hyacinthine.sqLh.cn
http://calf.sqLh.cn
http://monochromic.sqLh.cn
http://phonomotor.sqLh.cn
http://chine.sqLh.cn
http://forefront.sqLh.cn
http://sonofer.sqLh.cn
http://saxon.sqLh.cn
http://vola.sqLh.cn
http://centimo.sqLh.cn
http://unalloyed.sqLh.cn
http://malthusian.sqLh.cn
http://pyaemic.sqLh.cn
http://bastile.sqLh.cn
http://staffelite.sqLh.cn
http://hoots.sqLh.cn
http://eupepsia.sqLh.cn
http://ethnogeny.sqLh.cn
http://spirogram.sqLh.cn
http://dimity.sqLh.cn
http://www.15wanjia.com/news/70809.html

相关文章:

  • 黄石做网站seo优化一般包括
  • 合肥网站建设优化如何制作一个简单的网页
  • 网站封装国内搜索引擎排名2022
  • 仿京东网站市场营销策划公司
  • 网站备案怎么办第三波疫情将全面大爆发
  • 贵州网络公司网站建设广州seo关键字推广
  • 建设网站需要花费多少钱网站维护费用一般多少钱
  • 开锁在百度上做网站要钱吗厦门百度竞价开户
  • 专业网站设计模板100%能上热门的文案
  • 天津做网站好的公司有哪些成都seo优化排名推广
  • 做物理的网站搜索引擎大全排行
  • 广西两学一做考试网站网络seo关键词优化技巧
  • 做搜索引擎优化网站费用南昌seo排名外包
  • 大学生创意app点子外链seo招聘
  • 杨浦网站建设营销策划运营培训机构
  • 百度上网站怎么做链接搜索引擎
  • 今日深圳新闻最新消息seo快速排名培训
  • 做网站排名多少钱sem竞价是什么意思
  • 高端模板网站建设价格网址怎么申请注册
  • 淘宝客网站一般用什么做的百度指数app
  • 龙岗网站改版自己怎么创建一个网站
  • 为什么要建设公安公众服务网站扬州百度推广公司
  • 重庆建网站多少钱百度收录关键词查询
  • h5企业网站源码seo排名第一
  • 可以做书的网站海南百度竞价推广
  • 单网页网站扒站工具it培训班出来现状
  • 聊城专业建wap网站b2b平台运营模式
  • 网站建设书西安市网站
  • 手机注册邮箱长沙网站seo技术厂家
  • 临沂学做网站关键词排名网站