Argo Workflows workflow sensor
对应的sensor不会持有具体内容,而是引用template中的内容
apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
name: backendgithub
namespace: argo
spec:
template:
spec:
containers:
- name: "sensor"
image: "argoproj/sensor:v1.3.1"
imagePullPolicy: IfNotPresent
# serviceAccountName: operate-workflow-sa
dependencies:
- name: be-dep
eventSourceName: backendgithub
eventName: backendgitwebhook
triggers:
- template:
name: build-be-workflow-trigger
argoWorkflow:
group: argoproj.io
version: v1alpha1
resource: workflows
operation: submit
source:
resource:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: backendbuildkit-
namespace: argo
spec:
# serviceAccountName: operate-workflow-sa
entrypoint: main
onExit: exit-handler
imagePullSecrets:
- name: regcred
arguments:
parameters:
- name: repo
value: https://github.com/lizhe/lizhe-web-be.git
- name: branch
value: develop
- name: image
value: xxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/lizhewebbe
- name: dockercontext
value: /work/lizheweb-server
- name: dockerfile
value: dev.Dockerfile
- name: depfileyaml
value: lizhewebbe/lizhewebbe_dep.yaml
- name: projectname
value: lizhe-web-be
templates:
- name: main
dag:
tasks:
- name: clean
templateRef:
name: buildkit
template: clean
- name: clone
templateRef:
name: buildkit
template: clone
arguments:
parameters:
- name: repo
value: '{{workflow.parameters.repo}}'
- name: branch
value: '{{workflow.parameters.branch}}'
depends: clean
- name: getcommitid
templateRef:
name: buildkit
template: getcommitid
arguments: {}
depends: clone
- name: mountcommitid
templateRef:
name: buildkit
template: mountcommitid
arguments: {}
depends: getcommitid
- name: build
templateRef:
name: buildkit
template: backend
arguments: {}
depends: mountcommitid
- name: image
templateRef:
name: buildkit
template: image
arguments:
parameters:
- name: image
value: '{{workflow.parameters.image}}'
- name: dockercontext
value: '{{workflow.parameters.dockercontext}}'
- name: dockerfile
value: '{{workflow.parameters.dockerfile}}'
- name: commitid
value: '{{tasks.mountcommitid.outputs.parameters.commitid}}'
depends: build
- name: deploy
templateRef:
name: buildkit
template: deploy
arguments:
parameters:
- name: depfileyaml
value: '{{workflow.parameters.depfileyaml}}'
depends: image
onExit: deploy-exit-handler
- name: exit-handler
steps:
- - name: email
templateRef:
name: buildkit
template: exit-handler
arguments:
parameters:
- name: projectname
value: '{{workflow.parameters.projectname}}'
- name: deploy-exit-handler
steps:
- - name: clean
templateRef:
name: buildkit
template: deploy-exit-handler
volumeClaimTemplates:
- metadata:
name: work
creationTimestamp: null
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: gp2
status: {}
ttlStrategy:
secondsAfterCompletion: 1800
secondsAfterSuccess: 1800
secondsAfterFailure: 1800