argo-events - 通过基于 webhook 有效载荷数据键的 argo 事件触发 argo 工作流模板
问题描述
我正在寻找一种使用 webhook json 有效负载键触发工作流的方法,例如如果有效负载是 {"action":"copy","id":"someid"}
在触发器上
triggers:
template:
- "group1"
"use this template if action key is 'copy'"
- "group2"
"use this template" if action key is 'move'"
我创建了一个示例传感器文件,但是 argo sersor 抱怨 eventSourceName 使用了多次。
apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
name: testing-sensor
spec:
template:
serviceAccountName: argo
dependencies:
- name: data
eventSourceName: testhook
eventName: test
filters:
data:
- path: body.message
type: string
value:
- copy
- name: data1
eventSourceName: testhook
eventName: test
filters:
data:
- path: body.message
type: string
value:
- move
triggers:
- template:
conditions: "data"
name: group-1
- template:
conditions: "data1"
name: group-2
如果有人可以提供帮助,那就太好了
解决方案
它看起来像这样:
apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
name: data-filter
spec:
dependencies:
- name: test-dep
eventSourceName: webhook
eventName: example
filters:
data:
- path: body.action
type: string
value:
- "copy"
triggers:
- template:
name: data-workflow
k8s:
group: argoproj.io
version: v1alpha1
resource: workflows
operation: create
# ...
推荐阅读
- linux - 如何使用 sed 删除 grub 条目?
- javascript - 如何删除冒号:在我的 json.stringify 之后
- node.js - node_modules/@fullcalendar/core/main.d.ts(1196,54) 中的错误:错误 TS1144:'{' 或 ';' 预期的
- postgresql - Prisma 1 到 2 迁移问题:P4001 自省数据库为空
- angular - ngx Bootstrap Typeahead 选择后再次显示所有列表并再次聚焦
- angular - 角度通用渲染问题
- wordpress - Wordpress wp-admin css未加载
- python - 替换行中最后一个非 NaN 值
- json - 通过Powershell比较两个不同语法的Json文件
- excel - 从 VBA 中的 Excel 读取范围时获取问号(编码问题)