Rocket.Chat
Parameters
The Rocket.Chat notification service configuration includes following settings:
email
- the Rocker.Chat user’s emailpassword
- the Rocker.Chat user’s passwordalias
- optional alias that should be used to post messageicon
- optional message iconavatar
- optional message avatarserverUrl
- optional Rocket.Chat server url
Configuration
- Login to your RocketChat instance
- Go to user management
- Add new user with
bot
role. Also note thatRequire password change
checkbox mus be not checked
- Copy username and password that you was created for bot user
- Create a public or private channel, or a team, for this example
my_channel
- Add your bot to this channel otherwise it won’t work
- Store email and password in argocd_notifications-secret Secret
apiVersion: v1
kind: Secret
metadata:
name: <secret-name>
stringData:
rocketchat-email: <email>
rocketchat-password: <password>
- Finally, use these credentials to configure the RocketChat integration in the
argocd-configmap
config map:
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
data:
service.rocketchat: |
email: $rocketchat-email
password: $rocketchat-password
- 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
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.
Note: Attachments structure in Rocketchat is same with Slack attachments feature.
The message attachments can be specified in attachments
string fields under rocketchat
field:
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
}]
}]