1"use strict";(self.webpackChunkkubevela_io=self.webpackChunkkubevela_io||[]).push([[4507],{25726:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/manual-trigger-8361fea9230d5f56d649dca15a33f1db.png"},28453:(e,r,t)=>{t.d(r,{R:()=>o,x:()=>a});var i=t(96540);const n={},s=i.createContext(n);function o(e){const r=i.useContext(s);return i.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function a(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:o(e.components),i.createElement(s.Provider,{value:r},e.children)}},39029:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/dockerhub-trigger-3fe092950e8c89580780e6d5ddbbff0f.png"},41974:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/dockerhub-trigger-newtrigger-c5069e4c7ce9c10d2970f66d2292c903.png"},44111:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/acr-trigger-newtrigger-e90baae3b3d802bdd7d5686a34c671cf.png"},44480:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/dockerhub-trigger-dockerhubrecord-a979f6ff14b771e6c12996c7c77463bb.png"},60257:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/jfrog-trigger-newtrigger-21a9620c3b53de4dd57b1a088731d62d.png"},61533:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>a,default:()=>g,frontMatter:()=>o,metadata:()=>i,toc:()=>d});const i=JSON.parse('{"id":"how-to/dashboard/trigger/overview","title":"Integrate with CI system","description":"Integrate with CI system by Triggers","source":"@site/versioned_docs/version-v1.8/how-to/dashboard/trigger/overview.md","sourceDirName":"how-to/dashboard/trigger","slug":"/how-to/dashboard/trigger/overview","permalink":"/docs/v1.8/how-to/dashboard/trigger/overview","draft":false,"unlisted":false,"editUrl":"https://github.com/kubevela/kubevela.io/edit/main/docs/how-to/dashboard/trigger/overview.md","tags":[],"version":"v1.8","lastUpdatedBy":"qiaozp","lastUpdatedAt":1691049875000,"frontMatter":{"title":"Integrate with CI system","description":"Integrate with CI system by Triggers"},"sidebar":"docs","previous":{"title":"GitOps with FluxCD","permalink":"/docs/v1.8/end-user/gitops/fluxcd"},"next":{"title":"Unified Declarative CI/CD","permalink":"/docs/v1.8/tutorials/s2i"}}');var n=t(74848),s=t(28453);const o={title:"Integrate with CI system",description:"Integrate with CI system by Triggers"},a=void 0,c={},d=[{value:"Use declarative workflow with CI steps",id:"use-declarative-workflow-with-ci-steps",level:2},{value:"Use triggers to integrated with CI system.",id:"use-triggers-to-integrated-with-ci-system",level:2},{value:"Custom Trigger",id:"custom-trigger",level:3},{value:"Execute workflow",id:"execute-workflow",level:4},{value:"Approve workflow",id:"approve-workflow",level:4},{value:"Terminate workflow",id:"terminate-workflow",level:4},{value:"Rollback workflow",id:"rollback-workflow",level:4},{value:"Harbor Trigger",id:"harbor-trigger",level:3},{value:"ACR Trigger",id:"acr-trigger",level:3},{value:"DockerHub Trigger",id:"dockerhub-trigger",level:3},{value:"JFrog Trigger",id:"jfrog-trigger",level:3}];function l(e){const r={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",img:"img",li:"li",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.p,{children:"In KubeVela, you can choose to directly use declarative workflow with CI steps, such as: build code, push image, etc. Alternatively, you can choose to use triggers to integrate with external CI systems, such as Jenkins, image registry, etc."}),"\n",(0,n.jsx)(r.h2,{id:"use-declarative-workflow-with-ci-steps",children:"Use declarative workflow with CI steps"}),"\n",(0,n.jsxs)(r.p,{children:["KubeVela v1.7+ provide built-in step for image building, please refer to ",(0,n.jsx)(r.a,{href:"/docs/v1.8/tutorials/s2i",children:"Unified Declarative CI/CD"})," for details."]}),"\n",(0,n.jsx)(r.h2,{id:"use-triggers-to-integrated-with-ci-system",children:"Use triggers to integrated with CI system."}),"\n",(0,n.jsxs)(r.p,{children:["You can use triggers from ",(0,n.jsx)(r.a,{href:"/docs/v1.8/reference/addons/velaux",children:"VelaUX addon"})," to integrate with different CI systems. In VelaUX, a default trigger will be automatically generated after an application created, you can also delete it and create a new one. The architecture and supported platforms are described
1in the following picture, they're:"]}),"\n",(0,n.jsxs)(r.ul,{children:["\n",(0,n.jsxs)(r.li,{children:[(0,n.jsx)(r.a,{href:"#custom-trigger",children:"Custom"}),", refer to ",(0,n.jsx)(r.a,{href:"/docs/v1.8/tutorials/jenkins",children:"Jenkins CI"})," guide for a real world use case."]}),"\n",(0,n.jsx)(r.li,{children:(0,n.jsx)(r.a,{href:"#ACR-trigger",children:"ACR"})}),"\n",(0,n.jsxs)(r.li,{children:[(0,n.jsx)(r.a,{href:"#Harbor-trigger",children:"Harbor"}),", refer to ",(0,n.jsx)(r.a,{href:"/docs/v1.8/tutorials/trigger",children:"Harbor Integration"})," guide for a real world use case."]}),"\n",(0,n.jsx)(r.li,{children:(0,n.jsx)(r.a,{href:"#DockerHub-trigger",children:"DockerHub"})}),"\n",(0,n.jsx)(r.li,{children:(0,n.jsx)(r.a,{href:"#JFrog-trigger",children:"JFrog"})}),"\n"]}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"trigger",src:t(66519).A+"",width:"2682",height:"1614"})}),"\n",(0,n.jsx)(r.h3,{id:"custom-trigger",children:"Custom Trigger"}),"\n",(0,n.jsx)(r.p,{children:"Custom triggers will provide a webhook URL, which you can use to integrate with your CI tool using the specified request body."}),"\n",(0,n.jsxs)(r.p,{children:["The default trigger is a custom trigger, click ",(0,n.jsx)(r.code,{children:"Manual Trigger"})," to get more info of this trigger:"]}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"manual-trigger",src:t(25726).A+"",width:"1640",height:"882"})}),"\n",(0,n.jsxs)(r.p,{children:["Webhook URL is the address of this trigger, you can see request body in ",(0,n.jsx)(r.code,{children:"Curl Command"})," example:"]}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-json",children:' {\n // required, the upgrade of this deployment\n "upgrade": {\n // key is the name of application\n "<application-name>": {\n // the fields that need to be patched\n "image": "<image-name>"\n }\n },\n // optional, the code info of this deployment\n "codeInfo": {\n "commit": "<commit-id>",\n "branch": "<branch>",\n "user": "<user>",\n }\n }\n'})}),"\n",(0,n.jsxs)(r.p,{children:[(0,n.jsx)(r.code,{children:"upgrade"})," is the key of the object that need to be patched, ",(0,n.jsx)(r.code,{children:"<application-name>"})," is the name of application. ",(0,n.jsx)(r.code,{children:"image"})," is the field that need to be patched. You can also add more fields in ",(0,n.jsx)(r.code,{children:"<application-name>"}),"."]}),"\n",(0,n.jsxs)(r.p,{children:["In ",(0,n.jsx)(r.code,{children:"codeInfo"}),", you can add some code infos of this deployment like commit id, branch or user."]}),"\n",(0,n.jsx)(r.p,{children:"Below is an example of using Custom Trigger in Gitlab CI, we use env in this example:"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-shell",children:'webhook-request:\n stage: request\n before_script:\n - apk add --update curl && rm -rf /var/cache/apk/*\n script:\n - |\n curl -X POST -H "Content-Type: application/json" -d \'{"upgrade":{"\'"$APP_NAME"\'":{"image":"\'"$BUILD_IMAGE"\'"}},"codeInfo":{"user":"\'"$CI_COMMIT_AUTHOR"\'","commit":"\'"$CI_COMMIT_SHA"\'","branch":"\'"$CI_COMMIT_BRANCH"\'"}}\' $WEBHOOK_URL\n'})}),"\n",(0,n.jsx)(r.p,{children:"After CI have executed this step, we can see that application is deployed successfully in VelaUX. We can also see some relative code infos of this deployment."}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"gitlab-trigger",src:t(93185).A+"",width:"2328",height:"1138"})}),"\n",(0,n.jsxs)(r.p,{children:["You can refer to ",(0,n.jsx)(r.a,{href:"/docs/v1.8/tutorials/jenkins",children:"Jenkins CI"})," guide for a real use case about custom trigger."]}),"\n",(0,n.jsx)(r.p,{children:"Apart from this, Custom Triggers also supports some other type of actions, they are :"}),"\n",(0,n.jsx)(r.h4,{id:"execute-workflow",children:"Execute workflow"}),"\n",(0,n.jsx)(r.p,{children:"Integrate Custom Triggers into your CI tool to execute a workflow. This action behaves the same as the default custom trigger with no action provided. The request body for executing a workflow using Custom Triggers is as follows:"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-json",children:' {\n "action":"execute"\n // required, the upgrade of this deployment\n "upgrade": {\n // key is the name of application\n "<application-name>": {\n // the fields that need to be patched\n "image": "<image-name>"\n }\n },\n // optional, the code info of this deployment\n "codeInfo": {\n "commit": "<commit-id>",\n "branch": "<branch>",\n "user": "<user>",\n }\n }\n'})}),"\n",(0,n.jsx)(r.h4,{id:"approve-workflow",children:"Approve workflow"}),"\n",(0,n.jsxs)(r.p,{children:["During the ",(0,n.jsx)(r.code,{children:"suspending"})," phase of a workflow step, the CI tool can approve the workflow by calling the Custom Trigger with the following request body:"]}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-json",children:' {\n "action":"approve",\n // optional, name of the suspending step\n "step":"suspend"\n }\n'})}),"\n",(0,n.jsx)(r.h4,{id:"terminate-workflow",children:"Terminate workflow"}),"\n",(0,n.jsxs)(r.p,{children:["If a workflow step is in the ",(0,n.jsx)(r.code,{children:"suspending"})," phase, the CI tool can terminate the workflow by calling the Custom Trigger with the following request body:"]}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-json",children:' {\n "action":"terminate",\n // optional, name of the suspending step\n "step":"suspend"\n }\n'})}),"\n",(0,n.jsx)(r.h4,{id:"rollback-workflow",children:"Rollback workflow"}),"\n",(0,n.jsxs)(r.p,{children:["If a workflow step is in the ",(0,n.jsx)(r.code,{children:"suspending"})," phase, the CI tool can initiate a rollback of an application workflow to the latest revision by calling the Custom Trigger with the following request body:"]}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-json",children:' {\n "action":"rollback",\n // optional, name of the suspending step\n "step":"suspend"\n }\n'})}),"\n",(0,n.jsx)(r.h3,{id:"harbor-trigger",children:"Harbor Trigger"}),"\n",(0,n.jsx)(r.p,{children:"Harbor Trigger can be integrated
1with Harbor image registry."}),"\n",(0,n.jsxs)(r.p,{children:["You can refer to ",(0,n.jsx)(r.a,{href:"/docs/v1.8/tutorials/trigger",children:"Harbor Image Registry"})," guide for the end to end tutorial."]}),"\n",(0,n.jsx)(r.h3,{id:"acr-trigger",children:"ACR Trigger"}),"\n",(0,n.jsx)(r.p,{children:"ACR Trigger can be integrated with ACR image registry."}),"\n",(0,n.jsx)(r.p,{children:"We can start with creating a new ACR trigger. The Payload Type is ACR, and the Execution Workflow is the workflow you want to deploy in the trigger."}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"alt",src:t(44111).A+"",width:"1562",height:"1392"})}),"\n",(0,n.jsx)(r.p,{children:"After creating the trigger, we can setup this trigger in ACR:"}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"alt",src:t(91150).A+"",width:"1996",height:"712"})}),"\n",(0,n.jsx)(r.p,{children:"After configuring the trigger, we can see the new deploy revisions when a new image is pushed to the registry."}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"alt",src:t(61948).A+"",width:"1244",height:"1646"})}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"alt",src:t(67335).A+"",width:"2045",height:"468"})}),"\n",(0,n.jsx)(r.h3,{id:"dockerhub-trigger",children:"DockerHub Trigger"}),"\n",(0,n.jsx)(r.p,{children:"DockerHub Trigger can be integrated with DockerHub."}),"\n",(0,n.jsx)(r.p,{children:"We can start with creating a new DockerHub trigger. The Payload Type is DockerHub, and the Execution Workflow is the workflow you want to deploy in the trigger."}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"alt",src:t(41974).A+"",width:"1560",height:"848"})}),"\n",(0,n.jsx)(r.p,{children:"After creating the trigger, we can setup this trigger in DockerHub:"}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"alt",src:t(39029).A+"",width:"2452",height:"786"})}),"\n",(0,n.jsx)(r.p,{children:"After configuring the trigger, we can see the new deploy revisions when a new image is pushed to the registry."}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"alt",src:t(44480).A+"",width:"2434",height:"660"})}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"alt",src:t(99688).A+"",width:"3020",height:"538"})}),"\n",(0,n.jsx)(r.h3,{id:"jfrog-trigger",children:"JFrog Trigger"}),"\n",(0,n.jsx)(r.p,{children:"jFrog Trigger can be integrated with JFrog Artifactory."}),"\n",(0,n.jsx)(r.p,{children:"We can start with creating a new jFrog trigger. The Payload Type is jFrog, and the Execution Workflow is the workflow you want to deploy in the trigger."}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"alt",src:t(60257).A+"",width:"1556",height:"860"})}),"\n",(0,n.jsx)(r.p,{children:"After creating the trigger, we can setup this trigger in jFrog:"}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.img,{alt:"alt",src:t(76228).A+"",width:"2520",height:"1520"})}),"\n",(0,n.jsx)(r.p,{children:"After configuring the trigger, we can see the new deploy revisions when a new image is pushed to the registry."}),"\n",(0,n.jsxs)(r.p,{children:["Note: jFrog webhook callback has no jFrog address, KubeVela will recognize the request header ",(0,n.jsx)(r.code,{children:"X-jFrogURL"})," as jFrog address and use it in application ",(0,n.jsx)(r.code,{children:"image"})," field."]})]})}function g(e={}){const{wrapper:r}={...(0,s.R)(),...e.components};return r?(0,n.jsx)(r,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}},61948:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/acr-trigger-acrrecord-0ce59eca57f0502eeeb400dc2fa8be68.png"},66519:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/trigger-560576bceb55ac40295dbb6af6e1c896.jpg"},67335:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/acr-trigger-revisions-73076829d1ee5a56648380381f1c0741.png"},76228:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/jfrog-trigger-80f70a626e34d20421dce8fa376aba7c.png"},91150:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/acr-trigger-ff30870e9bb413a28cf96b8604853988.png"},93185:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/gitlab-trigger-89a8a953cfbe5dcf1ed118ca20f3c71e.png"},99688:(e,r,t)=>{t.d(r,{A:()=>i});const i=t.p+"assets/images/dockerhub-trigger-revisions-92f0c9aa21ee7c7bf587575583d916b0.png"}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.