Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Commit 058be17

Browse files
chore: update notifications-engine (#326)
Signed-off-by: Ryota Sakamoto <sakamo.ryota+github@gmail.com>
1 parent b7c05eb commit 058be17

File tree

5 files changed

+81
-3
lines changed

5 files changed

+81
-3
lines changed

catalog/install.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ data:
5050
{{end}}
5151
]
5252
}]
53+
groupingKey: ""
54+
notifyBroadcast: false
5355
teams:
5456
facts: |
5557
[{
@@ -126,6 +128,8 @@ data:
126128
{{end}}
127129
]
128130
}]
131+
groupingKey: ""
132+
notifyBroadcast: false
129133
teams:
130134
facts: |
131135
[{
@@ -198,6 +202,8 @@ data:
198202
{{end}}
199203
]
200204
}]
205+
groupingKey: ""
206+
notifyBroadcast: false
201207
teams:
202208
facts: |
203209
[{
@@ -274,6 +280,8 @@ data:
274280
{{end}}
275281
]
276282
}]
283+
groupingKey: ""
284+
notifyBroadcast: false
277285
teams:
278286
facts: |
279287
[{
@@ -354,6 +362,8 @@ data:
354362
{{end}}
355363
]
356364
}]
365+
groupingKey: ""
366+
notifyBroadcast: false
357367
teams:
358368
facts: |
359369
[{
@@ -425,6 +435,8 @@ data:
425435
{{end}}
426436
]
427437
}]
438+
groupingKey: ""
439+
notifyBroadcast: false
428440
teams:
429441
facts: |
430442
[{

docs/catalog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ slack:
7272
{{end}}
7373
]
7474
}]
75+
groupingKey: ""
76+
notifyBroadcast: false
7577
teams:
7678
facts: |
7779
[{
@@ -152,6 +154,8 @@ slack:
152154
{{end}}
153155
]
154156
}]
157+
groupingKey: ""
158+
notifyBroadcast: false
155159
teams:
156160
facts: |
157161
[{
@@ -228,6 +232,8 @@ slack:
228232
{{end}}
229233
]
230234
}]
235+
groupingKey: ""
236+
notifyBroadcast: false
231237
teams:
232238
facts: |
233239
[{
@@ -308,6 +314,8 @@ slack:
308314
{{end}}
309315
]
310316
}]
317+
groupingKey: ""
318+
notifyBroadcast: false
311319
teams:
312320
facts: |
313321
[{
@@ -392,6 +400,8 @@ slack:
392400
{{end}}
393401
]
394402
}]
403+
groupingKey: ""
404+
notifyBroadcast: false
395405
teams:
396406
facts: |
397407
[{
@@ -467,6 +477,8 @@ slack:
467477
{{end}}
468478
]
469479
}]
480+
groupingKey: ""
481+
notifyBroadcast: false
470482
teams:
471483
facts: |
472484
[{

docs/services/slack.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,57 @@ template.app-sync-status: |
9191
}]
9292
}]
9393
```
94+
95+
The messages can be aggregated to the slack threads by grouping key which can be specified in a `groupingKey` string field under `slack` field.
96+
`groupingKey` is used across each template and works independently on each slack channel.
97+
When multiple applications will be updated at the same time or frequently, the messages in slack channel can be easily read by aggregating with git commit hash, application name, etc.
98+
Furthermore, the messages can be broadcast to the channel at the specific template by `notifyBroadcast` field.
99+
100+
```yaml
101+
template.app-sync-status: |
102+
message: |
103+
Application {{.app.metadata.name}} sync is {{.app.status.sync.status}}.
104+
Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
105+
slack:
106+
attachments: |
107+
[{
108+
"title": "{{.app.metadata.name}}",
109+
"title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
110+
"color": "#18be52",
111+
"fields": [{
112+
"title": "Sync Status",
113+
"value": "{{.app.status.sync.status}}",
114+
"short": true
115+
}, {
116+
"title": "Repository",
117+
"value": "{{.app.spec.source.repoURL}}",
118+
"short": true
119+
}]
120+
}]
121+
# Aggregate the messages to the thread by git commit hash
122+
groupingKey: "{{.app.status.sync.revision}}"
123+
notifyBroadcast: false
124+
template.app-sync-failed: |
125+
message: |
126+
Application {{.app.metadata.name}} sync is {{.app.status.sync.status}}.
127+
Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
128+
slack:
129+
attachments: |
130+
[{
131+
"title": "{{.app.metadata.name}}",
132+
"title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
133+
"color": "#ff0000",
134+
"fields": [{
135+
"title": "Sync Status",
136+
"value": "{{.app.status.sync.status}}",
137+
"short": true
138+
}, {
139+
"title": "Repository",
140+
"value": "{{.app.spec.source.repoURL}}",
141+
"short": true
142+
}]
143+
}]
144+
# Aggregate the messages to the thread by git commit hash
145+
groupingKey: "{{.app.status.sync.revision}}"
146+
notifyBroadcast: true
147+
```

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.16
44

55
require (
66
github.com/argoproj/argo-cd/v2 v2.0.0-rc3
7-
github.com/argoproj/notifications-engine v0.2.1-0.20210801151500-3203039170af
7+
github.com/argoproj/notifications-engine v0.2.1-0.20210804121253-e4903f48f730
88
github.com/evanphx/json-patch v4.9.0+incompatible
99
github.com/ghodss/yaml v1.0.0
1010
github.com/golang/mock v1.4.4

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ github.com/argoproj/argo-cd/v2 v2.0.0-rc3 h1:jBuz8qqLL0gG6Nb892x3+eP+v/wjQpkdSOl
9393
github.com/argoproj/argo-cd/v2 v2.0.0-rc3/go.mod h1:Rw7fuyae0v8b3KMJoZp8jf5A2tBP2dQ8uWj9HTRZITo=
9494
github.com/argoproj/gitops-engine v0.3.1 h1:wM4RUzH54sWdchD7Ws8UdAIsjk08BmjN9bLuW79xKWk=
9595
github.com/argoproj/gitops-engine v0.3.1/go.mod h1:IBHhAkqlC+3r/wBWUitWSidQhPzlLoSTWp2htq3dyQk=
96-
github.com/argoproj/notifications-engine v0.2.1-0.20210801151500-3203039170af h1:zEk/nOliLkkTOUnD/JEg/IaAksHfLQURlbgOHku6u90=
97-
github.com/argoproj/notifications-engine v0.2.1-0.20210801151500-3203039170af/go.mod h1:rKhm9LtebGKgLA/UtPtBeRUrrS/CT0U5az1jSfUiipw=
96+
github.com/argoproj/notifications-engine v0.2.1-0.20210804121253-e4903f48f730 h1:M0x22b8ILYJSvIrZFtSzqMR699n3KQmk8pIDOsCayKc=
97+
github.com/argoproj/notifications-engine v0.2.1-0.20210804121253-e4903f48f730/go.mod h1:rKhm9LtebGKgLA/UtPtBeRUrrS/CT0U5az1jSfUiipw=
9898
github.com/argoproj/pkg v0.2.0 h1:ETgC600kr8WcAi3MEVY5sA1H7H/u1/IysYOobwsZ8No=
9999
github.com/argoproj/pkg v0.2.0/go.mod h1:F4TZgInLUEjzsWFB/BTJBsewoEy0ucnKSq6vmQiD/yc=
100100
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=

0 commit comments

Comments
 (0)