Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
chore: update notifications-engine (#293)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryota Sakamoto <[email protected]>
  • Loading branch information
ryota-sakamoto committed May 27, 2021
1 parent ed0ce0c commit 88205cf
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/services/email.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The Email notification service sends email notifications using SMTP protocol and
* `username` - username
* `password` - password
* `from` - from email address
* `html` - optional bool, true or false

## Example

Expand Down
1 change: 1 addition & 0 deletions docs/services/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ metadata:
* [Webhook](./webhook.md)
* [Telegram](./telegram.md)
* [Teams](./teams.md)
* [Rocket.Chat](./rocketchat.md)
96 changes: 96 additions & 0 deletions docs/services/rocketchat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Rocket.Chat

## Parameters

The Rocket.Chat notification service configuration includes following settings:

* `email` - the Rocker.Chat user's email
* `password` - the Rocker.Chat user's password
* `alias` - optional alias that should be used to post message
* `icon` - optional message icon
* `avatar` - optional message avatar
* `serverUrl` - optional Rocket.Chat server url

## Configuration

1. Login to your RocketChat instance
2. Go to user management

![2](https://user-images.githubusercontent.com/15252187/115824993-7ccad900-a411-11eb-89de-6a0c4438ffdf.png)

3. Add new user with `bot` role. Also note that `Require password change` checkbox mus be not checked

![3](https://user-images.githubusercontent.com/15252187/115825174-b4d21c00-a411-11eb-8f20-cda48cea9fad.png)

4. Copy username and password that you was created for bot user
5. Create a public or private channel, or a team, for this example `my_channel`
6. Add your bot to this channel **otherwise it won't work**
7. Store email and password in argocd_notifications-secret Secret

```yaml
apiVersion: v1
kind: Secret
metadata:
name: <secret-name>
stringData:
rocketchat-email: <email>
rocketchat-password: <password>
```
8. Finally, use these credentials to configure the RocketChat integration in the `argocd-configmap` config map:

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
data:
service.rocketchat: |
email: $rocketchat-email
password: $rocketchat-password
```

9. Create a subscription for your Rocket.Chat integration:

*Note: channel, team or user must be prefixed with # or @ elsewhere we will be interpretative destination as a room ID*

```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
notifications.argoproj.io/subscribe.on-sync-succeeded.rocketchat: #my_channel
```

## Templates

Notification templates can be customized with RocketChat [attachments](https://developer.rocket.chat/api/rest-api/methods/chat/postmessage#attachments-detail).

*Note: Attachments structure in Rocketchat is same with Slack attachments [feature](https://api.slack.com/messaging/composing/layouts).*

<!-- TODO: @sergeyshevch Need to add screenshot with RocketChat attachments -->

The message attachments can be specified in `attachments` string fields under `rocketchat` 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}}.
rocketchat:
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
}]
}]
```
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.20210507172642-597c59f3cb15
github.com/argoproj/notifications-engine v0.2.1-0.20210527032340-6e7a43362ff1
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.20210507172642-597c59f3cb15 h1:18ggmBbQfKoP2zF/M76X6eVlCUF9SZsnlc9odvEHLv4=
github.com/argoproj/notifications-engine v0.2.1-0.20210507172642-597c59f3cb15/go.mod h1:rKhm9LtebGKgLA/UtPtBeRUrrS/CT0U5az1jSfUiipw=
github.com/argoproj/notifications-engine v0.2.1-0.20210527032340-6e7a43362ff1 h1:xsnbKslPaYqedr5OXRU68raykzLx2zkLtmRo9xhDcvU=
github.com/argoproj/notifications-engine v0.2.1-0.20210527032340-6e7a43362ff1/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 88205cf

Please sign in to comment.