Reputation: 11
im looking for a way to trigger a workflow using webhook json payload key for example if payload is {"action":"copy","id":"someid"}
on triggers
triggers:
template:
- "group1"
"use this template if action key is 'copy'"
- "group2"
"use this template" if action key is 'move'"
i have created a example sensor file but, argo sersor is complaining that eventSourceName used multiple times.
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
If some one could help it would be nice
Upvotes: 1
Views: 1257
Reputation: 8392
You should use a data filter in your Sensor. (Example sensor.)
It would look something like this:
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
# ...
Upvotes: 1