【问题标题】:Trigger argo workflow template via argo events based on webhook payload data key通过基于 webhook 有效载荷数据键的 argo 事件触发 argo 工作流模板
【发布时间】:2021-07-25 18:09:57
【问题描述】:

我正在寻找一种使用 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
         

如果有人能帮忙就好了

【问题讨论】:

    标签: argo-events


    【解决方案1】:

    您应该在传感器中使用data filter。 (Example sensor.)

    看起来像这样:

    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
    # ...
    

    【讨论】:

    • 感谢@Micheal 的回复我已经更新了我的问题你能帮我解决这个问题吗,我已经检查了 argo 传感器示例,但我找不到任何关于这种情况的信息。
    猜你喜欢
    • 2020-03-03
    • 2022-07-07
    • 2022-08-16
    • 2021-08-25
    • 2022-08-16
    • 1970-01-01
    • 2021-07-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多