Created
August 4, 2023 07:44
-
-
Save sushaanttb/a6ea41e5123c925d6c8069c39bafb2a4 to your computer and use it in GitHub Desktop.
Template for ArgoCD webhook service, subscription trigger template and trigger condition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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