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

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

3

  1. Copy username and password that you was created for bot user
  2. Create a public or private channel, or a team, for this example my_channel
  3. Add your bot to this channel otherwise it won’t work
  4. Store email and password in argocd_notifications-secret Secret
  1. apiVersion: v1
  2. kind: Secret
  3. metadata:
  4. name: <secret-name>
  5. stringData:
  6. rocketchat-email: <email>
  7. rocketchat-password: <password>
  1. Finally, use these credentials to configure the RocketChat integration in the argocd-configmap config map:
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: <config-map-name>
  5. data:
  6. service.rocketchat: |
  7. email: $rocketchat-email
  8. password: $rocketchat-password
  1. 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

  1. apiVersion: argoproj.io/v1alpha1
  2. kind: Application
  3. metadata:
  4. annotations:
  5. 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:

  1. template.app-sync-status: |
  2. message: |
  3. Application {{.app.metadata.name}} sync is {{.app.status.sync.status}}.
  4. Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
  5. rocketchat:
  6. attachments: |
  7. [{
  8. "title": "{{.app.metadata.name}}",
  9. "title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
  10. "color": "#18be52",
  11. "fields": [{
  12. "title": "Sync Status",
  13. "value": "{{.app.status.sync.status}}",
  14. "short": true
  15. }, {
  16. "title": "Repository",
  17. "value": "{{.app.spec.source.repoURL}}",
  18. "short": true
  19. }]
  20. }]