Skip to content

Commit

Permalink
chore: update notifications-engine (argoproj-labs#326)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryota Sakamoto <[email protected]>
  • Loading branch information
ryota-sakamoto authored Aug 11, 2021
1 parent b7c05eb commit 058be17
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 3 deletions.
12 changes: 12 additions & 0 deletions catalog/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ data:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down Expand Up @@ -126,6 +128,8 @@ data:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down Expand Up @@ -198,6 +202,8 @@ data:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down Expand Up @@ -274,6 +280,8 @@ data:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down Expand Up @@ -354,6 +362,8 @@ data:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down Expand Up @@ -425,6 +435,8 @@ data:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down
12 changes: 12 additions & 0 deletions docs/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ slack:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down Expand Up @@ -152,6 +154,8 @@ slack:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down Expand Up @@ -228,6 +232,8 @@ slack:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down Expand Up @@ -308,6 +314,8 @@ slack:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down Expand Up @@ -392,6 +400,8 @@ slack:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down Expand Up @@ -467,6 +477,8 @@ slack:
{{end}}
]
}]
groupingKey: ""
notifyBroadcast: false
teams:
facts: |
[{
Expand Down
54 changes: 54 additions & 0 deletions docs/services/slack.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,57 @@ template.app-sync-status: |
}]
}]
```

The messages can be aggregated to the slack threads by grouping key which can be specified in a `groupingKey` string field under `slack` field.
`groupingKey` is used across each template and works independently on each slack channel.
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.
Furthermore, the messages can be broadcast to the channel at the specific template by `notifyBroadcast` field.

```yaml
template.app-sync-status: |
message: |
Application {{.app.metadata.name}} sync is {{.app.status.sync.status}}.
Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
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
}]
}]
# Aggregate the messages to the thread by git commit hash
groupingKey: "{{.app.status.sync.revision}}"
notifyBroadcast: false
template.app-sync-failed: |
message: |
Application {{.app.metadata.name}} sync is {{.app.status.sync.status}}.
Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
slack:
attachments: |
[{
"title": "{{.app.metadata.name}}",
"title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
"color": "#ff0000",
"fields": [{
"title": "Sync Status",
"value": "{{.app.status.sync.status}}",
"short": true
}, {
"title": "Repository",
"value": "{{.app.spec.source.repoURL}}",
"short": true
}]
}]
# Aggregate the messages to the thread by git commit hash
groupingKey: "{{.app.status.sync.revision}}"
notifyBroadcast: true
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.16

require (
github.com/argoproj/argo-cd/v2 v2.0.0-rc3
github.com/argoproj/notifications-engine v0.2.1-0.20210801151500-3203039170af
github.com/argoproj/notifications-engine v0.2.1-0.20210804121253-e4903f48f730
github.com/evanphx/json-patch v4.9.0+incompatible
github.com/ghodss/yaml v1.0.0
github.com/golang/mock v1.4.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ github.com/argoproj/argo-cd/v2 v2.0.0-rc3 h1:jBuz8qqLL0gG6Nb892x3+eP+v/wjQpkdSOl
github.com/argoproj/argo-cd/v2 v2.0.0-rc3/go.mod h1:Rw7fuyae0v8b3KMJoZp8jf5A2tBP2dQ8uWj9HTRZITo=
github.com/argoproj/gitops-engine v0.3.1 h1:wM4RUzH54sWdchD7Ws8UdAIsjk08BmjN9bLuW79xKWk=
github.com/argoproj/gitops-engine v0.3.1/go.mod h1:IBHhAkqlC+3r/wBWUitWSidQhPzlLoSTWp2htq3dyQk=
github.com/argoproj/notifications-engine v0.2.1-0.20210801151500-3203039170af h1:zEk/nOliLkkTOUnD/JEg/IaAksHfLQURlbgOHku6u90=
github.com/argoproj/notifications-engine v0.2.1-0.20210801151500-3203039170af/go.mod h1:rKhm9LtebGKgLA/UtPtBeRUrrS/CT0U5az1jSfUiipw=
github.com/argoproj/notifications-engine v0.2.1-0.20210804121253-e4903f48f730 h1:M0x22b8ILYJSvIrZFtSzqMR699n3KQmk8pIDOsCayKc=
github.com/argoproj/notifications-engine v0.2.1-0.20210804121253-e4903f48f730/go.mod h1:rKhm9LtebGKgLA/UtPtBeRUrrS/CT0U5az1jSfUiipw=
github.com/argoproj/pkg v0.2.0 h1:ETgC600kr8WcAi3MEVY5sA1H7H/u1/IysYOobwsZ8No=
github.com/argoproj/pkg v0.2.0/go.mod h1:F4TZgInLUEjzsWFB/BTJBsewoEy0ucnKSq6vmQiD/yc=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
Expand Down

0 comments on commit 058be17

Please sign in to comment.