Summary
I'm configuring a webhook-forwarder layer for multiple sources and multiple targets.
so, I made all triggers use same template like this.
template.app-common: |
webhook:
forwarder:
method: POST
body: |-
{
"app": {
"metadata": {
"name": "{{.app.metadata.name}}"
},
"status": {
"health": {
"status": "{{.app.status.health.status}}"
},
"operationState": {
"operation": {
"sync": {
"revision": "{{.app.status.operationState.operation.sync.revision}}"
}
},
"finishedAt": "{{.app.status.operationState.finishedAt}}",
"message": "{{.app.status.operationState.message}}",
"phase": "{{.app.status.operationState.phase}}"
},
"sync": {
"status": "{{.app.status.sync.status}}",
"revision": "{{.app.status.sync.revision}}"
},
"conditions": [
{{range $index, $c := .app.status.conditions}}
{{if ne $index 0}},{{end}}
{
"type": "{{$c.type}}",
"message": "{{$c.message}}"
}
{{end}}
]
}
},
"context": {
"argocdUrl": "{{.context.argocdUrl}}"
}
}
trigger.on-deployed: |
- when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'
oncePer: app.status.sync.revision
send: [app-common]
trigger.on-health-degraded: |
- when: app.status.health.status == 'Degraded'
send: [app-common]
trigger.on-sync-failed: |
- when: app.status.operationState.phase in ['Error', 'Failed']
send: [app-common]
trigger.on-sync-running: |
- when: app.status.operationState.phase in ['Running']
send: [app-common]
trigger.on-sync-status-unknown: |
- when: app.status.sync.status == 'Unknown'
send: [app-common]
trigger.on-sync-succeeded: |
- when: app.status.operationState.phase in ['Succeeded']
send: [app-common]
but, in template cannot figure out that what trigger is triggering the webhook.
I want to get trigger name in template something like this..
template.app-common: |
webhook:
forwarder:
method: POST
body: |-
{
"app": {
"metadata": {
"name": "{{.app.metadata.name}}",
"trigger": "{{.triggerName}}" // on-sync-failed, on-sync-succeeded ....
},
Use Cases
this feature will be useful when managing a custom webhook template.
Message from the maintainers:
Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.
enhancement