Skip to content

Instantly share code, notes, and snippets.

@sushaanttb
Created August 4, 2023 07:44
Show Gist options
  • Save sushaanttb/a6ea41e5123c925d6c8069c39bafb2a4 to your computer and use it in GitHub Desktop.
Save sushaanttb/a6ea41e5123c925d6c8069c39bafb2a4 to your computer and use it in GitHub Desktop.
Template for ArgoCD webhook service, subscription trigger template and trigger condition
service.webhook.mypythonapp:
url: <your_application_base_url>
headers:
- name: Content-Type
value: application/json
subscriptions:
- recipients:
- <your_webhook_name>
triggers:
- on-status-changed
template.app-status-changed: |
webhook:
github:
method: POST
path: /webhook
body: |
{
{{if eq .app.status.operationState.phase "Running"}} "state": "pending"{{end}}
{{if eq .app.status.operationState.phase "Succeeded"}} "state": "success"{{end}}
{{if eq .app.status.operationState.phase "Error"}} "state": "error"{{end}}
{{if eq .app.status.operationState.phase "Failed"}} "state": "error"{{end}},
"description": "ArgoCD",
"target_url": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
"context": "continuous-delivery/{{.app.metadata.name}}"
}
trigger.on-status-changed:
- description: Application status has changed
send:
- app-status-changed
when: app.status.operationState.phase in ['Succeeded','Running','Error','Failed']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment