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

Commit b7c05eb

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

File tree

5 files changed

+36
-36
lines changed

5 files changed

+36
-36
lines changed

bot/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (s *server) updateSubscription(service string, recipient string, subscribe
106106
return "", err
107107
}
108108
oldAnnotations := copyStringMap(obj.GetAnnotations())
109-
annotations := subscriptions.Annotations(obj.GetAnnotations())
109+
annotations := subscriptions.NewAnnotations(obj.GetAnnotations())
110110
if subscribe {
111111
annotations.Subscribe(opts.Trigger, service, recipient)
112112
} else {
@@ -139,7 +139,7 @@ func (s *server) listSubscriptions(service string, recipient string) (string, er
139139
}
140140
var apps []string
141141
for _, app := range appList.Items {
142-
if subscriptions.Annotations(app.GetAnnotations()).Has(service, recipient) {
142+
if subscriptions.NewAnnotations(app.GetAnnotations()).Has(service, recipient) {
143143
apps = append(apps, fmt.Sprintf("%s/%s", app.GetNamespace(), app.GetName()))
144144
}
145145
}
@@ -149,7 +149,7 @@ func (s *server) listSubscriptions(service string, recipient string) (string, er
149149
}
150150
var appProjs []string
151151
for _, appProj := range appProjList.Items {
152-
if subscriptions.Annotations(appProj.GetAnnotations()).Has(service, recipient) {
152+
if subscriptions.NewAnnotations(appProj.GetAnnotations()).Has(service, recipient) {
153153
appProjs = append(appProjs, fmt.Sprintf("%s/%s", appProj.GetNamespace(), appProj.GetName()))
154154
}
155155
}

controller/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (c *notificationController) alterDestinations(obj v1.Object, destinations s
7474
}
7575

7676
if proj := getAppProj(app, c.appProjInformer); proj != nil {
77-
destinations.Merge(subscriptions.Annotations(proj.GetAnnotations()).GetDestinations(cfg.DefaultTriggers, cfg.ServiceDefaultTriggers))
77+
destinations.Merge(subscriptions.NewAnnotations(proj.GetAnnotations()).GetDestinations(cfg.DefaultTriggers, cfg.ServiceDefaultTriggers))
7878
destinations.Merge(settings.GetLegacyDestinations(proj.GetAnnotations(), cfg.DefaultTriggers, cfg.ServiceDefaultTriggers))
7979
}
8080
return destinations

docs/services/slack.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,43 @@ The Slack notification service configuration includes following settings:
2222
![3](https://user-images.githubusercontent.com/426437/73604310-4d495b80-4543-11ea-8576-09cd91aea0e5.png)
2323
1. Scroll back to the top, click 'Install App to Workspace' button and confirm the installation.
2424
![4](https://user-images.githubusercontent.com/426437/73604311-4d495b80-4543-11ea-9155-9d216b20ec86.png)
25-
1. Once installation is completed copy the OAuth token.
25+
1. Once installation is completed copy the OAuth token.
2626
![5](https://user-images.githubusercontent.com/426437/73604312-4d495b80-4543-11ea-832b-a9d9d5e4bc29.png)
2727

2828
1. Create a public or private channel, for this example `my_channel`
2929
1. Invite your slack bot to this channel **otherwise slack bot won't be able to deliver notifications to this channel**
30-
8. Store Oauth access token in `argocd-notifications-secret` secret
31-
32-
```yaml
33-
apiVersion: v1
34-
kind: Secret
35-
metadata:
36-
name: <secret-name>
37-
stringData:
38-
slack-token: <Oauth-access-token>
39-
```
30+
1. Store Oauth access token in `argocd-notifications-secret` secret
4031

41-
9. Define service type slack in data section of `argocd-notifications-cm` configmap:
32+
```yaml
33+
apiVersion: v1
34+
kind: Secret
35+
metadata:
36+
name: <secret-name>
37+
stringData:
38+
slack-token: <Oauth-access-token>
39+
```
40+
41+
1. Define service type slack in data section of `argocd-notifications-cm` configmap:
4242
service
43-
```yaml
44-
apiVersion: v1
45-
kind: ConfigMap
46-
metadata:
47-
name: <config-map-name>
48-
data:
49-
service.slack: |
50-
token: $slack-token
51-
```
43+
```yaml
44+
apiVersion: v1
45+
kind: ConfigMap
46+
metadata:
47+
name: <config-map-name>
48+
data:
49+
service.slack: |
50+
token: $slack-token
51+
```
5252

53-
10. Add annotation in application yaml file to enable notifications for specific argocd app
53+
1. Add annotation in application yaml file to enable notifications for specific argocd app
5454

55-
```yaml
56-
apiVersion: argoproj.io/v1alpha1
57-
kind: Application
58-
metadata:
59-
annotations:
60-
notifications.argoproj.io/subscribe.on-sync-succeeded.slack: my_channel
61-
```
55+
```yaml
56+
apiVersion: argoproj.io/v1alpha1
57+
kind: Application
58+
metadata:
59+
annotations:
60+
notifications.argoproj.io/subscribe.on-sync-succeeded.slack: my_channel
61+
```
6262

6363
## Templates
6464

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.20210729153923-a15e78044105
7+
github.com/argoproj/notifications-engine v0.2.1-0.20210801151500-3203039170af
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.20210729153923-a15e78044105 h1:V5cNAPIxNMYr6EIL2dRSZa5qCsqkXa+KknuZXYb9JIg=
97-
github.com/argoproj/notifications-engine v0.2.1-0.20210729153923-a15e78044105/go.mod h1:rKhm9LtebGKgLA/UtPtBeRUrrS/CT0U5az1jSfUiipw=
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=
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)