diff --git a/catalog/install.yaml b/catalog/install.yaml index db044fb8..78ab9fd8 100644 --- a/catalog/install.yaml +++ b/catalog/install.yaml @@ -1,5 +1,42 @@ apiVersion: v1 data: + template.app-deployed: | + body: | + {{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} is now running new version of deployments manifests. + slack: + 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 + } + {{range $index, $c := .app.status.conditions}} + {{if not $index}},{{end}} + {{if $index}},{{end}} + { + "title": "{{$c.type}}", + "value": "{{$c.message}}", + "short": true + } + {{end}} + ] + }] + title: New version of an application {{.app.metadata.name}} is up and running. template.app-health-degraded: | body: | {{if eq .serviceType "slack"}}:exclamation:{{end}} Application {{.app.metadata.name}} has degraded. @@ -122,7 +159,7 @@ data: - description: Application is synced and healthy. Triggered once per commit. oncePer: app.status.sync.revision send: - - app-sync-succeeded + - app-deployed when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy' trigger.on-health-degraded: | - description: Application has degraded diff --git a/catalog/templates/app-deployed.yaml b/catalog/templates/app-deployed.yaml new file mode 100644 index 00000000..2bb500eb --- /dev/null +++ b/catalog/templates/app-deployed.yaml @@ -0,0 +1,36 @@ +title: "New version of an application {{.app.metadata.name}} is up and running." +body: | + {{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} is now running new version of deployments manifests. +slack: + 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 + } + {{range $index, $c := .app.status.conditions}} + {{if not $index}},{{end}} + {{if $index}},{{end}} + { + "title": "{{$c.type}}", + "value": "{{$c.message}}", + "short": true + } + {{end}} + ] + }] diff --git a/catalog/triggers/on-deployed.yaml b/catalog/triggers/on-deployed.yaml index fb558865..7ee14188 100644 --- a/catalog/triggers/on-deployed.yaml +++ b/catalog/triggers/on-deployed.yaml @@ -1,4 +1,4 @@ - when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy' description: Application is synced and healthy. Triggered once per commit. - send: [app-sync-succeeded] + send: [app-deployed] oncePer: app.status.sync.revision \ No newline at end of file diff --git a/docs/catalog.md b/docs/catalog.md index 420783fe..6eb1d490 100644 --- a/docs/catalog.md +++ b/docs/catalog.md @@ -2,7 +2,7 @@ ## Triggers | NAME | DESCRIPTION | TEMPLATE | |------------------------|---------------------------------------------------------------|-----------------------------------------------------| -| on-deployed | Application is synced and healthy. Triggered once per commit. | [app-sync-succeeded](#app-sync-succeeded) | +| on-deployed | Application is synced and healthy. Triggered once per commit. | [app-deployed](#app-deployed) | | on-health-degraded | Application has degraded | [app-health-degraded](#app-health-degraded) | | on-sync-failed | Application syncing has failed | [app-sync-failed](#app-sync-failed) | | on-sync-running | Application is being synced | [app-sync-running](#app-sync-running) | @@ -10,6 +10,14 @@ | on-sync-succeeded | Application syncing has succeeded | [app-sync-succeeded](#app-sync-succeeded) | ## Templates +### app-deployed +**title**: `New version of an application {{.app.metadata.name}} is up and running.` + +**body**: +``` +{{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} is now running new version of deployments manifests. + +``` ### app-health-degraded **title**: `Application {{.app.metadata.name}} has degraded.`