Open nvenkatapavan opened 4 years ago
Notification templates can be customized to leverage slack message blocks and attachments, try something similar:
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-notifications-cm
data:
config.yaml: |
context:
argocdUrl: <hostname>
triggers:
- name: on-sync-succeeded
enabled: false
- name: on-sync-failed
enabled: true
#custom
- name: on-sync-progress
condition: app.status.operationState.phase in ['Running']
template: on-sync-progress
# Custom templates
templates:
- name: on-sync-progress
title: Start syncing application {{.app.metadata.name}}.
body: |-
{{if eq .context.notificationType "slack"}}:ship-it:{{end}} The sync operation of application {{.app.metadata.name}} has started
Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true
slack:
attachments: |
[{
"title": {{toJson .app.metadata.name}},
"title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
"color": "#0DADEA",
"fields": [{
"title": "Sync Status",
"value": "{{.app.status.sync.status}}",
"short": true
}, {
"title": "Repository",
"value": "{{.app.spec.source.repoURL}}",
"short": true
}, {
"title": "Author",
"value": "{{(call .repo.GetCommitMetadata .app.status.sync.revision).Author}}",
"short": true
}, {
"title": "Message",
"value": "{{(call .repo.GetCommitMetadata .app.status.sync.revision).Message}}",
"short": true
}]
}]
If your goal is to remove the repository
field just delete it from the spec
Hi, ArgoCD notifications application sync status showing differently for title and body.
I think, title is showing application sync status and body it shows Repository sync status. We want to see only application sync status, how to remove the Repository sync status showing in body. I tried using custom template still no luck. Could someone help on fixing issue please ?
Notification on on-sync-failed :exclamation: The sync operation of application ecam has failed at 2020-06-16T17:25:18Z with the following error: one or more synchronization tasks completed unsuccessfully Sync operation details are available at: https://argocd.local?operation=true . ecam Sync Status Synced Repository https://myrepo.local
Notification on on-sync-succeeded :white_check_mark: Application corelite has been successfully synced at 2020-06-16T15:46:10Z. Sync operation details are available at: https://argocd.local?operation=true . corelite Sync Status OutOfSync Repository https://myrepo.local