Skip to content

Commit

Permalink
chore: Update notifications-engine dependency (argoproj#11479)
Browse files Browse the repository at this point in the history
* chore: update `notifications-engine`

Signed-off-by: Jocelyn Thode <[email protected]>

* chore: generate notifications docs

Signed-off-by: Jocelyn Thode <[email protected]>

Signed-off-by: Jocelyn Thode <[email protected]>
  • Loading branch information
jocelynthode authored Dec 5, 2022
1 parent 42efcb3 commit 8e57f53
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 147 deletions.
15 changes: 13 additions & 2 deletions docs/operator-manual/notifications/services/googlechat.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ You can send [simple text](https://developers.google.com/chat/reference/message-
```yaml
template.app-sync-succeeded: |
message: The app {{ .app.metadata.name }} has succesfully synced!
message: The app {{ .app.metadata.name }} has successfully synced!
```
A card message can be defined as follows:
Expand All @@ -65,7 +65,7 @@ template.app-sync-succeeded: |
sections:
- widgets:
- textParagraph:
text: The app {{ .app.metadata.name }} has succesfully synced!
text: The app {{ .app.metadata.name }} has successfully synced!
- widgets:
- keyValue:
topLabel: Repository
Expand All @@ -79,3 +79,14 @@ template.app-sync-succeeded: |
```
The card message can be written in JSON too.
## Chat Threads
It is possible send both simple text and card messages in a chat thread by specifying a unique key for the thread. The thread key can be defined as follows:
```yaml
template.app-sync-succeeded: |
message: The app {{ .app.metadata.name }} has succesfully synced!
googlechat:
threadKey: {{ .app.metadata.name }}
```
61 changes: 61 additions & 0 deletions docs/operator-manual/notifications/services/newrelic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# NewRelic

## Parameters

* `apiURL` - the api server url, e.g. https://api.newrelic.com
* `apiKey` - a [NewRelic ApiKey](https://docs.newrelic.com/docs/apis/rest-api-v2/get-started/introduction-new-relic-rest-api-v2/#api_key)

## Configuration

1. Create a NewRelic [Api Key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#user-api-key)
2. Store apiKey in `argocd-notifications-secret` Secret and configure NewRelic integration in `argocd-notifications-cm` ConfigMap

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
data:
service.newrelic: |
apiURL: <api-url>
apiKey: $newrelic-apiKey
```
```yaml
apiVersion: v1
kind: Secret
metadata:
name: <secret-name>
stringData:
newrelic-apiKey: apiKey
```
3. Copy [Application ID](https://docs.newrelic.com/docs/apis/rest-api-v2/get-started/get-app-other-ids-new-relic-one/#apm)
4. Create subscription for your NewRelic integration
```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
notifications.argoproj.io/subscribe.<trigger-name>.newrelic: <app-id>
```
## Templates
* `description` - __optional__, high-level description of this deployment, visible in the [Summary](https://docs.newrelic.com/docs/apm/applications-menu/monitoring/apm-overview-page) page and on the [Deployments](https://docs.newrelic.com/docs/apm/applications-menu/events/deployments-page) page when you select an individual deployment.
* Defaults to `message`
* `changelog` - __optional__, A summary of what changed in this deployment, visible in the [Deployments](https://docs.newrelic.com/docs/apm/applications-menu/events/deployments-page) page when you select (selected deployment) > Change log.
* Defaults to `{{(call .repo.GetCommitMetadata .app.status.sync.revision).Message}}`
* `user` - __optional__, A username to associate with the deployment, visible in the [Summary](https://docs.newrelic.com/docs/apm/applications-menu/events/deployments-page) and on the [Deployments](https://docs.newrelic.com/docs/apm/applications-menu/events/deployments-page).
* Defaults to `{{(call .repo.GetCommitMetadata .app.status.sync.revision).Author}}`

```yaml
context: |
argocdUrl: https://example.com/argocd
template.app-deployed: |
message: Application {{.app.metadata.name}} has successfully deployed.
newrelic:
description: Application {{.app.metadata.name}} has successfully deployed
```
74 changes: 41 additions & 33 deletions docs/operator-manual/notifications/services/slack.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,48 +29,56 @@ The Slack notification service configuration includes following settings:
1. Invite your slack bot to this channel **otherwise slack bot won't be able to deliver notifications to this channel**
1. Store Oauth access token in `argocd-notifications-secret` secret

apiVersion: v1
kind: Secret
metadata:
name: <secret-name>
stringData:
slack-token: <Oauth-access-token>
```yaml
apiVersion: v1
kind: Secret
metadata:
name: <secret-name>
stringData:
slack-token: <Oauth-access-token>
```
1. Define service type slack in data section of `argocd-notifications-cm` configmap:

apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
data:
service.slack: |
token: $slack-token
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
data:
service.slack: |
token: $slack-token
```

1. Add annotation in application yaml file to enable notifications for specific argocd app

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

1. Annotation with more than one trigger multiple of destinations and recipients

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
notifications.argoproj.io/subscriptions: |
- trigger: [on-scaling-replica-set, on-rollout-updated, on-rollout-step-completed]
destinations:
- service: slack
recipients: [my-channel-1, my-channel-2]
- service: email
recipients: [recipient-1, recipient-2, recipient-3 ]
- trigger: [on-rollout-aborted, on-analysis-run-failed, on-analysis-run-error]
destinations:
- service: slack
recipients: [my-channel-21, my-channel-22]
```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
notifications.argoproj.io/subscriptions: |
- trigger: [on-scaling-replica-set, on-rollout-updated, on-rollout-step-completed]
destinations:
- service: slack
recipients: [my-channel-1, my-channel-2]
- service: email
recipients: [recipient-1, recipient-2, recipient-3 ]
- trigger: [on-rollout-aborted, on-analysis-run-failed, on-analysis-run-error]
destinations:
- service: slack
recipients: [my-channel-21, my-channel-22]
```

## Templates

Expand Down
41 changes: 41 additions & 0 deletions docs/operator-manual/notifications/services/webex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Webex Teams

## Parameters

The Webex Teams notification service configuration includes following settings:

* `token` - the app token

## Configuration

1. Create a Webex [Bot](https://developer.webex.com/docs/bots)
1. Copy the bot access [token](https://developer.webex.com/my-apps) and store it in the `argocd-notifications-secret` Secret and configure Webex Teams integration in `argocd-notifications-cm` ConfigMap

``` yaml
apiVersion: v1
kind: Secret
metadata:
name: <secret-name>
stringData:
webex-token: <bot access token>
```
``` yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
data:
service.webex: |
token: $webex-token
```
1. Create subscription for your Webex Teams integration
``` yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
notifications.argoproj.io/subscribe.<trigger-name>.webex: <personal email or room id>
```
14 changes: 13 additions & 1 deletion docs/operator-manual/notifications/services/webhook.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
## Configuration
# Webhook

The webhook notification service allows sending a generic HTTP request using the templatized request body and URL.
Using Webhook you might trigger a Jenkins job, update Github commit status.

## Parameters

The Webhook notification service configuration includes following settings:

- `url` - the url to send the webhook to
- `headers` - optional, the headers to pass along with the webhook
- `basicAuth` - optional, the basic authentication to pass along with the webook
- `insecureSkipVerify` - optional bool, true or false

## Configuration

Use the following steps to configure webhook:

1 Register webhook in `argocd-notifications-cm` ConfigMap:
Expand All @@ -21,6 +32,7 @@ data:
basicAuth: #optional username password
username: <username>
password: <api-key>
insecureSkipVerify: true #optional bool
```
2 Define template that customizes webhook request method, path and body:
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/TomOnTime/utfutil v0.0.0-20180511104225-09c41003ee1d
github.com/alicebob/miniredis/v2 v2.23.1
github.com/argoproj/gitops-engine v0.7.1-0.20221108210551-e284fd71cb96
github.com/argoproj/notifications-engine v0.3.1-0.20220812180936-4d8552b0775f
github.com/argoproj/notifications-engine v0.3.1-0.20221203221941-490d98afd1d6
github.com/argoproj/pkg v0.13.7-0.20221115212233-27bd8ce31415
github.com/aws/aws-sdk-go v1.44.129
github.com/bombsimon/logrusr/v2 v2.0.1
Expand Down Expand Up @@ -137,14 +137,14 @@ require (
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/Microsoft/go-winio v0.4.17 // indirect
github.com/PagerDuty/go-pagerduty v1.5.0 // indirect
github.com/PagerDuty/go-pagerduty v1.6.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/RocketChat/Rocket.Chat.Go.SDK v0.0.0-20210112200207-10ab4d695d60 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
github.com/antonmedv/expr v1.8.9 // indirect
github.com/antonmedv/expr v1.9.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
Expand All @@ -170,7 +170,7 @@ require (
github.com/go-openapi/strfmt v0.19.3 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.4.0 // indirect
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/btree v1.0.1 // indirect
Expand Down Expand Up @@ -239,7 +239,7 @@ require (
golang.org/x/tools v0.1.12 // indirect
gomodules.xyz/envconfig v1.3.1-0.20190308184047-426f31af0d45 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
gomodules.xyz/notify v0.1.0 // indirect
gomodules.xyz/notify v0.1.1 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect
Expand Down
Loading

0 comments on commit 8e57f53

Please sign in to comment.