github.com/argoproj/argo-cd/v3@v3.2.1/docs/operator-manual/notifications/catalog.md (about) 1 # Triggers and Templates Catalog 2 ## Getting Started 3 * Install Triggers and Templates from the catalog 4 ```bash 5 kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/notifications_catalog/install.yaml 6 ``` 7 ## Triggers 8 | NAME | DESCRIPTION | TEMPLATE | 9 |------------------------|---------------------------------------------------------------|-----------------------------------------------------| 10 | on-created | Application is created. | [app-created](#app-created) | 11 | on-deleted | Application is deleted. | [app-deleted](#app-deleted) | 12 | on-deployed | Application is synced and healthy. Triggered once per commit. | [app-deployed](#app-deployed) | 13 | on-health-degraded | Application has degraded | [app-health-degraded](#app-health-degraded) | 14 | on-sync-failed | Application syncing has failed | [app-sync-failed](#app-sync-failed) | 15 | on-sync-running | Application is being synced | [app-sync-running](#app-sync-running) | 16 | on-sync-status-unknown | Application status is 'Unknown' | [app-sync-status-unknown](#app-sync-status-unknown) | 17 | on-sync-succeeded | Application syncing has succeeded | [app-sync-succeeded](#app-sync-succeeded) | 18 19 ## Templates 20 ### app-created 21 **definition**: 22 ```yaml 23 email: 24 subject: Application {{.app.metadata.name}} has been created. 25 message: Application {{.app.metadata.name}} has been created. 26 teams: 27 title: Application {{.app.metadata.name}} has been created. 28 29 ``` 30 ### app-deleted 31 **definition**: 32 ```yaml 33 email: 34 subject: Application {{.app.metadata.name}} has been deleted. 35 message: Application {{.app.metadata.name}} has been deleted. 36 teams: 37 title: Application {{.app.metadata.name}} has been deleted. 38 39 ``` 40 ### app-deployed 41 **definition**: 42 ```yaml 43 email: 44 subject: New version of an application {{.app.metadata.name}} is up and running. 45 message: | 46 {{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} is now running new version of deployments manifests. 47 slack: 48 attachments: | 49 [{ 50 "title": "{{ .app.metadata.name}}", 51 "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", 52 "color": "#18be52", 53 "fields": [ 54 { 55 "title": "Sync Status", 56 "value": "{{.app.status.sync.status}}", 57 "short": true 58 }, 59 { 60 "title": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 61 "value": {{- if .app.spec.source }} ":arrow_heading_up: {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}:arrow_heading_up: {{ $source.repoURL }}{{- end }}" {{- end }}, 62 "short": true 63 }, 64 { 65 "title": "Revision", 66 "value": "{{.app.status.sync.revision}}", 67 "short": true 68 } 69 {{range $index, $c := .app.status.conditions}} 70 , 71 { 72 "title": "{{$c.type}}", 73 "value": "{{$c.message}}", 74 "short": true 75 } 76 {{end}} 77 ] 78 }] 79 deliveryPolicy: Post 80 groupingKey: "" 81 notifyBroadcast: false 82 teams: 83 facts: | 84 [{ 85 "name": "Sync Status", 86 "value": "{{.app.status.sync.status}}" 87 }, 88 { 89 "name": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 90 "value": {{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}⬆️ {{ $source.repoURL }}{{- end }}" {{- end }} 91 }, 92 { 93 "name": "Revision", 94 "value": "{{.app.status.sync.revision}}" 95 } 96 {{range $index, $c := .app.status.conditions}} 97 , 98 { 99 "name": "{{$c.type}}", 100 "value": "{{$c.message}}" 101 } 102 {{end}} 103 ] 104 potentialAction: | 105 [{ 106 "@type":"OpenUri", 107 "name":"Operation Application", 108 "targets":[{ 109 "os":"default", 110 "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}" 111 }] 112 }, 113 { 114 "@type":"OpenUri", 115 "name":"Open Repository", 116 "targets":[{ 117 "os":"default", 118 "uri":{{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}⬆️ {{ $source.repoURL }}{{- end }}" {{- end }} 119 }] 120 }] 121 themeColor: '#000080' 122 title: New version of an application {{.app.metadata.name}} is up and running. 123 124 ``` 125 ### app-health-degraded 126 **definition**: 127 ```yaml 128 email: 129 subject: Application {{.app.metadata.name}} has degraded. 130 message: | 131 {{if eq .serviceType "slack"}}:exclamation:{{end}} Application {{.app.metadata.name}} has degraded. 132 Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}. 133 slack: 134 attachments: | 135 [{ 136 "title": "{{ .app.metadata.name}}", 137 "title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", 138 "color": "#f4c030", 139 "fields": [ 140 { 141 "title": "Health Status", 142 "value": "{{.app.status.health.status}}", 143 "short": true 144 }, 145 { 146 "title": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 147 "value": {{- if .app.spec.source }} ":arrow_heading_up: {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}:arrow_heading_up: {{ $source.repoURL }}{{- end }}" {{- end }}, 148 "short": true 149 } 150 {{range $index, $c := .app.status.conditions}} 151 , 152 { 153 "title": "{{$c.type}}", 154 "value": "{{$c.message}}", 155 "short": true 156 } 157 {{end}} 158 ] 159 }] 160 deliveryPolicy: Post 161 groupingKey: "" 162 notifyBroadcast: false 163 teams: 164 facts: | 165 [{ 166 "name": "Health Status", 167 "value": "{{.app.status.health.status}}" 168 }, 169 { 170 "name": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 171 "value": {{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}⬆️ {{ $source.repoURL }}{{- end }}" {{- end }} 172 } 173 {{range $index, $c := .app.status.conditions}} 174 , 175 { 176 "name": "{{$c.type}}", 177 "value": "{{$c.message}}" 178 } 179 {{end}} 180 ] 181 potentialAction: | 182 [{ 183 "@type":"OpenUri", 184 "name":"Open Application", 185 "targets":[{ 186 "os":"default", 187 "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}" 188 }] 189 }, 190 { 191 "@type":"OpenUri", 192 "name":"Open Repository", 193 "targets":[{ 194 "os":"default", 195 "uri":{{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}⬆️ {{ $source.repoURL }}{{- end }}" {{- end }} 196 }] 197 }] 198 themeColor: '#FF0000' 199 title: Application {{.app.metadata.name}} has degraded. 200 201 ``` 202 ### app-sync-failed 203 **definition**: 204 ```yaml 205 email: 206 subject: Failed to sync application {{.app.metadata.name}}. 207 message: | 208 {{if eq .serviceType "slack"}}:exclamation:{{end}} The sync operation of application {{.app.metadata.name}} has failed at {{.app.status.operationState.finishedAt}} with the following error: {{.app.status.operationState.message}} 209 Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true . 210 slack: 211 attachments: | 212 [{ 213 "title": "{{ .app.metadata.name}}", 214 "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", 215 "color": "#E96D76", 216 "fields": [ 217 { 218 "title": "Sync Status", 219 "value": "{{.app.status.sync.status}}", 220 "short": true 221 }, 222 { 223 "title": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 224 "value": {{- if .app.spec.source }} ":arrow_heading_up: {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}:arrow_heading_up: {{ $source.repoURL }}{{- end }}" {{- end }}, 225 "short": true 226 } 227 {{range $index, $c := .app.status.conditions}} 228 , 229 { 230 "title": "{{$c.type}}", 231 "value": "{{$c.message}}", 232 "short": true 233 } 234 {{end}} 235 ] 236 }] 237 deliveryPolicy: Post 238 groupingKey: "" 239 notifyBroadcast: false 240 teams: 241 facts: | 242 [{ 243 "name": "Sync Status", 244 "value": "{{.app.status.sync.status}}" 245 }, 246 { 247 "name": "Failed at", 248 "value": "{{.app.status.operationState.finishedAt}}" 249 }, 250 { 251 "name": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 252 "value": {{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}⬆️ {{ $source.repoURL }}{{- end }}" {{- end }} 253 } 254 {{range $index, $c := .app.status.conditions}} 255 , 256 { 257 "name": "{{$c.type}}", 258 "value": "{{$c.message}}" 259 } 260 {{end}} 261 ] 262 potentialAction: | 263 [{ 264 "@type":"OpenUri", 265 "name":"Open Operation", 266 "targets":[{ 267 "os":"default", 268 "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true" 269 }] 270 }, 271 { 272 "@type":"OpenUri", 273 "name":"Open Repository", 274 "targets":[{ 275 "os":"default", 276 "uri":{{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}{{ $source.repoURL }}⬆️ {{- end }}" {{- end }} 277 }] 278 }] 279 themeColor: '#FF0000' 280 title: Failed to sync application {{.app.metadata.name}}. 281 282 ``` 283 ### app-sync-running 284 **definition**: 285 ```yaml 286 email: 287 subject: Start syncing application {{.app.metadata.name}}. 288 message: | 289 The sync operation of application {{.app.metadata.name}} has started at {{.app.status.operationState.startedAt}}. 290 Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true . 291 slack: 292 attachments: | 293 [{ 294 "title": "{{ .app.metadata.name}}", 295 "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", 296 "color": "#0DADEA", 297 "fields": [ 298 { 299 "title": "Sync Status", 300 "value": "{{.app.status.sync.status}}", 301 "short": true 302 }, 303 { 304 "title": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 305 "value": {{- if .app.spec.source }} ":arrow_heading_up: {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}:arrow_heading_up: {{ $source.repoURL }}{{- end }}" {{- end }}, 306 "short": true 307 } 308 {{range $index, $c := .app.status.conditions}} 309 , 310 { 311 "title": "{{$c.type}}", 312 "value": "{{$c.message}}", 313 "short": true 314 } 315 {{end}} 316 ] 317 }] 318 deliveryPolicy: Post 319 groupingKey: "" 320 notifyBroadcast: false 321 teams: 322 facts: | 323 [{ 324 "name": "Sync Status", 325 "value": "{{.app.status.sync.status}}" 326 }, 327 { 328 "name": "Started at", 329 "value": "{{.app.status.operationState.startedAt}}" 330 }, 331 { 332 "name": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 333 "value": {{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}⬆️ {{ $source.repoURL }}{{- end }}" {{- end }} 334 } 335 {{range $index, $c := .app.status.conditions}} 336 , 337 { 338 "name": "{{$c.type}}", 339 "value": "{{$c.message}}" 340 } 341 {{end}} 342 ] 343 potentialAction: | 344 [{ 345 "@type":"OpenUri", 346 "name":"Open Operation", 347 "targets":[{ 348 "os":"default", 349 "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true" 350 }] 351 }, 352 { 353 "@type":"OpenUri", 354 "name":"Open Repository", 355 "targets":[{ 356 "os":"default", 357 "uri":{{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}⬆️ {{ $source.repoURL }}{{- end }}" {{- end }} 358 }] 359 }] 360 title: Start syncing application {{.app.metadata.name}}. 361 362 ``` 363 ### app-sync-status-unknown 364 **definition**: 365 ```yaml 366 email: 367 subject: Application {{.app.metadata.name}} sync status is 'Unknown' 368 message: | 369 {{if eq .serviceType "slack"}}:exclamation:{{end}} Application {{.app.metadata.name}} sync is 'Unknown'. 370 Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}. 371 {{if ne .serviceType "slack"}} 372 {{range $c := .app.status.conditions}} 373 * {{$c.message}} 374 {{end}} 375 {{end}} 376 slack: 377 attachments: | 378 [{ 379 "title": "{{ .app.metadata.name}}", 380 "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", 381 "color": "#E96D76", 382 "fields": [ 383 { 384 "title": "Sync Status", 385 "value": "{{.app.status.sync.status}}", 386 "short": true 387 }, 388 { 389 "title": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 390 "value": {{- if .app.spec.source }} ":arrow_heading_up: {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}:arrow_heading_up: {{ $source.repoURL }}{{- end }}" {{- end }}, 391 "short": true 392 } 393 {{range $index, $c := .app.status.conditions}} 394 , 395 { 396 "title": "{{$c.type}}", 397 "value": "{{$c.message}}", 398 "short": true 399 } 400 {{end}} 401 ] 402 }] 403 deliveryPolicy: Post 404 groupingKey: "" 405 notifyBroadcast: false 406 teams: 407 facts: | 408 [{ 409 "name": "Sync Status", 410 "value": "{{.app.status.sync.status}}" 411 }, 412 { 413 "name": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 414 "value": {{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}⬆️ {{ $source.repoURL }}{{- end }}" {{- end }} 415 } 416 {{range $index, $c := .app.status.conditions}} 417 , 418 { 419 "name": "{{$c.type}}", 420 "value": "{{$c.message}}" 421 } 422 {{end}} 423 ] 424 potentialAction: | 425 [{ 426 "@type":"OpenUri", 427 "name":"Open Application", 428 "targets":[{ 429 "os":"default", 430 "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}" 431 }] 432 }, 433 { 434 "@type":"OpenUri", 435 "name":"Open Repository", 436 "targets":[{ 437 "os":"default", 438 "uri":{{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}⬆️ {{ $source.repoURL }}{{- end }}" {{- end }} 439 }] 440 }] 441 title: Application {{.app.metadata.name}} sync status is 'Unknown' 442 443 ``` 444 ### app-sync-succeeded 445 **definition**: 446 ```yaml 447 email: 448 subject: Application {{.app.metadata.name}} has been successfully synced. 449 message: | 450 {{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} has been successfully synced at {{.app.status.operationState.finishedAt}}. 451 Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true . 452 slack: 453 attachments: | 454 [{ 455 "title": "{{ .app.metadata.name}}", 456 "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", 457 "color": "#18be52", 458 "fields": [ 459 { 460 "title": "Sync Status", 461 "value": "{{.app.status.sync.status}}", 462 "short": true 463 }, 464 { 465 "title": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 466 "value": {{- if .app.spec.source }} ":arrow_heading_up: {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}:arrow_heading_up: {{ $source.repoURL }}{{- end }}" {{- end }}, 467 "short": true 468 } 469 {{range $index, $c := .app.status.conditions}} 470 , 471 { 472 "title": "{{$c.type}}", 473 "value": "{{$c.message}}", 474 "short": true 475 } 476 {{end}} 477 ] 478 }] 479 deliveryPolicy: Post 480 groupingKey: "" 481 notifyBroadcast: false 482 teams: 483 facts: | 484 [{ 485 "name": "Sync Status", 486 "value": "{{.app.status.sync.status}}" 487 }, 488 { 489 "name": "Synced at", 490 "value": "{{.app.status.operationState.finishedAt}}" 491 }, 492 { 493 "name": {{- if .app.spec.source }} "Repository" {{- else if .app.spec.sources }} "Repositories" {{- end }}, 494 "value": {{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}⬆️ {{ $source.repoURL }}{{- end }}" {{- end }} 495 } 496 {{range $index, $c := .app.status.conditions}} 497 , 498 { 499 "name": "{{$c.type}}", 500 "value": "{{$c.message}}" 501 } 502 {{end}} 503 ] 504 potentialAction: | 505 [{ 506 "@type":"OpenUri", 507 "name":"Operation Details", 508 "targets":[{ 509 "os":"default", 510 "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true" 511 }] 512 }, 513 { 514 "@type":"OpenUri", 515 "name":"Open Repository", 516 "targets":[{ 517 "os":"default", 518 "uri":{{- if .app.spec.source }} "⬆️ {{ .app.spec.source.repoURL }}" {{- else if .app.spec.sources }} "{{- range $index, $source := .app.spec.sources }}{{ if $index }}\n{{ end }}⬆️ {{ $source.repoURL }}{{- end }}" {{- end }} 519 }] 520 }] 521 themeColor: '#000080' 522 title: Application {{.app.metadata.name}} has been successfully synced 523 524 ```