Skip to content

Instantly share code, notes, and snippets.

@taufiqpsumarna
Last active January 15, 2025 06:21
Show Gist options
  • Save taufiqpsumarna/420faefd19149979f01844b242d24650 to your computer and use it in GitHub Desktop.
Save taufiqpsumarna/420faefd19149979f01844b242d24650 to your computer and use it in GitHub Desktop.
ArgoCD mattermost notification templates
# -- The notification template is used to generate the notification content
## For more information: https://argo-cd.readthedocs.io/en/stable/operator-manual/notifications/templates/
templates:
template.app-deployed: |
message: |
πŸš€ **{{.app.metadata.name}} : Deployment Successful**
Application: **{{.app.metadata.name}}**
Repository: **{{.app.spec.source.repoURL}}**
Revision: **{{.app.status.sync.revision}}**
Status: **Healthy**
[View Application]({{.context.argocdUrl}}/applications/{{.app.metadata.name}})
mattermost:
attachments: |
[{
"title": "{{.app.metadata.name}}",
"title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
"color": "#18be52",
"fields": [{
"title": "Sync Status",
"value": "{{.app.status.sync.status}}",
"short": true
}, {
"title": "Repository",
"value": "{{.app.spec.source.repoURL}}",
"short": true
}, {
"title": "Revision",
"value": "{{.app.status.sync.revision}}",
"short": true
}]
}]
template.app-sync-failed: |
message: |
🚨 **{{.app.metadata.name}} : Sync Failed**
Application: **{{.app.metadata.name}}**
Project: **{{.app.spec.project}}**
Repository: **{{.app.spec.source.repoURL}}**
Revision: **{{.app.spec.source.targetRevision}}**
Message: {{.app.status.operationState.message}}
[View in ArgoCD]({{.context.argocdUrl}}/applications/{{.app.metadata.name}})
mattermost:
attachments: |
[{
"title": "Sync Failed: {{.app.metadata.name}}",
"title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
"color": "#ff4c4c",
"fields": [{
"title": "Project",
"value": "{{.app.spec.project}}",
"short": true
}, {
"title": "Repository",
"value": "{{.app.spec.source.repoURL}}",
"short": true
}, {
"title": "Revision",
"value": "{{.app.spec.source.targetRevision}}",
"short": true
}, {
"title": "Message",
"value": "{{.app.status.operationState.message}}",
"short": false
}]
}]
template.app-sync-succeeded: |
message: |
βœ… **{{.app.metadata.name}} : Sync Succeeded**
Application: **{{.app.metadata.name}}**
Project: **{{.app.spec.project}}**
Repository: **{{.app.spec.source.repoURL}}**
Revision: **{{.app.spec.source.targetRevision}}**
Status: **Succeeded**
[View in ArgoCD]({{.context.argocdUrl}}/applications/{{.app.metadata.name}})
mattermost:
attachments: |
[{
"title": "Sync Succeeded: {{.app.metadata.name}}",
"title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
"color": "#18be52",
"fields": [{
"title": "Project",
"value": "{{.app.spec.project}}",
"short": true
}, {
"title": "Repository",
"value": "{{.app.spec.source.repoURL}}",
"short": true
}, {
"title": "Revision",
"value": "{{.app.spec.source.targetRevision}}",
"short": true
}]
}]
template.app-sync-unknown: |
message: |
❔ **{{.app.metadata.name}} : Sync Unknown**
# Application: **{{.app.metadata.name}}**
# Project: **{{.app.spec.project}}**
# Repository: **{{.app.spec.source.repoURL}}**
# Revision: **{{.app.spec.source.targetRevision}}**
Status: **Unknown**
[View in ArgoCD]({{.context.argocdUrl}}/applications/{{.app.metadata.name}})
mattermost:
attachments: |
[{
"title": "Sync Unknown: {{.app.metadata.name}}",
"title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
"color": "#18be52",
"fields": [{
"title": "Project",
"value": "{{.app.spec.project}}",
"short": true
}, {
"title": "Repository",
"value": "{{.app.spec.source.repoURL}}",
"short": true
}, {
"title": "Revision",
"value": "{{.app.spec.source.targetRevision}}",
"short": true
}]
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment