Skip to content

Commit

Permalink
fix: upgrade notifications-engine (argoproj#16354)
Browse files Browse the repository at this point in the history
* fix: upgrade notifications-engine

Signed-off-by: Gilad Salmon <gilad.salmon@gmail.com>

* update notification-engine version

Signed-off-by: pashakostohrys <pavel@codefresh.io>

* go mod tidy

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* use correct go version in codeql

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* silly

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* make notifications-docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Gilad Salmon <gilad.salmon@gmail.com>
Signed-off-by: pashakostohrys <pavel@codefresh.io>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: pasha-codefresh <pavel@codefresh.io>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
3 people authored and Julien Fuix committed Feb 6, 2024
1 parent 8abe77e commit 953902d
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 28 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ jobs:

# CodeQL runs on ubuntu-latest and windows-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0

# Use correct go version. https://github.com/github/codeql-action/issues/1842#issuecomment-1704398087
- name: Setup Golang
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.0.0
with:
go-version-file: go.mod

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
6 changes: 3 additions & 3 deletions docs/operator-manual/notifications/services/awssqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

This notification service is capable of sending simple messages to AWS SQS queue.

* `queue` - name of the queue you are intending to send messages to. Can be overwriten with target destination annotation.
* `queue` - name of the queue you are intending to send messages to. Can be overridden with target destination annotation.
* `region` - region of the sqs queue can be provided via env variable AWS_DEFAULT_REGION
* `key` - optional, aws access key must be either referenced from a secret via variable or via env variable AWS_ACCESS_KEY_ID
* `secret` - optional, aws access secret must be either referenced from a secret via variableor via env variable AWS_SECRET_ACCESS_KEY
* `secret` - optional, aws access secret must be either referenced from a secret via variable or via env variable AWS_SECRET_ACCESS_KEY
* `account` optional, external accountId of the queue
* `endpointUrl` optional, useful for development with localstack

Expand Down Expand Up @@ -63,7 +63,7 @@ stringData:
### Minimal configuration using AWS Env variables
Ensure following list of enviromental variable is injected via OIDC, or other method. And assuming SQS is local to the account.
Ensure following list of environment variables are injected via OIDC, or other method. And assuming SQS is local to the account.
You may skip usage of secret for sensitive data and omit other parameters. (Setting parameters via ConfigMap takes precedent.)
Variables:
Expand Down
9 changes: 7 additions & 2 deletions docs/operator-manual/notifications/services/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The GitHub notification service changes commit status using [GitHub Apps](https:
## Configuration

1. Create a GitHub Apps using https://github.com/settings/apps/new
2. Change repository permissions to enable write commit statuses and/or deployments
2. Change repository permissions to enable write commit statuses and/or deployments and/or pull requests comments
![2](https://user-images.githubusercontent.com/18019529/108397381-3ca57980-725b-11eb-8d17-5b8992dc009e.png)
3. Generate a private key, and download it automatically
![3](https://user-images.githubusercontent.com/18019529/108397926-d4a36300-725b-11eb-83fe-74795c8c3e03.png)
Expand Down Expand Up @@ -76,11 +76,16 @@ template.app-deployed: |
logURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
requiredContexts: []
autoMerge: true
pullRequestComment:
content: |
Application {{.app.metadata.name}} is now running new version of deployments manifests.
See more here: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true
```
**Notes**:
- If the message is set to 140 characters or more, it will be truncated.
- If `github.repoURLPath` and `github.revisionPath` are same as above, they can be omitted.
- Automerge is optional and `true` by default for github deployments to ensure the requested ref is up to date with the default branch.
Setting this option to `false` is required if you would like to deploy older refs in your default branch.
For more information see the [Github Deployment API Docs](https://docs.github.com/en/rest/deployments/deployments?apiVersion=2022-11-28#create-a-deployment).
For more information see the [GitHub Deployment API Docs](https://docs.github.com/en/rest/deployments/deployments?apiVersion=2022-11-28#create-a-deployment).
- If `github.pullRequestComment.content` is set to 65536 characters or more, it will be truncated.
21 changes: 12 additions & 9 deletions docs/operator-manual/notifications/services/googlechat.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,27 @@ A card message can be defined as follows:
```yaml
template.app-sync-succeeded: |
googlechat:
cards: |
cardsV2: |
- header:
title: ArgoCD Bot Notification
sections:
- widgets:
- textParagraph:
- decoratedText:
text: The app {{ .app.metadata.name }} has successfully synced!
- widgets:
- keyValue:
- decoratedText:
topLabel: Repository
content: {{ call .repo.RepoURLToHTTPS .app.spec.source.repoURL }}
- keyValue:
text: {{ call .repo.RepoURLToHTTPS .app.spec.source.repoURL }}
- decoratedText:
topLabel: Revision
content: {{ .app.spec.source.targetRevision }}
- keyValue:
text: {{ .app.spec.source.targetRevision }}
- decoratedText:
topLabel: Author
content: {{ (call .repo.GetCommitMetadata .app.status.sync.revision).Author }}
text: {{ (call .repo.GetCommitMetadata .app.status.sync.revision).Author }}
```
All [Card fields](https://developers.google.com/chat/api/reference/rest/v1/cards#Card_1) are supported and can be used
in notifications. It is also possible to use the previous (now deprecated) `cards` key to use the legacy card fields,
but this is not recommended as Google has deprecated this field and recommends using the newer `cardsV2`.

The card message can be written in JSON too.

Expand All @@ -86,7 +89,7 @@ It is possible send both simple text and card messages in a chat thread by speci

```yaml
template.app-sync-succeeded: |
message: The app {{ .app.metadata.name }} has succesfully synced!
message: The app {{ .app.metadata.name }} has successfully synced!
googlechat:
threadKey: {{ .app.metadata.name }}
```
14 changes: 9 additions & 5 deletions docs/operator-manual/notifications/services/slack.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ If you want to send message using incoming webhook, you can use [webhook](./webh

The Slack notification service configuration includes following settings:

* `token` - the app token
* `apiURL` - optional, the server url, e.g. https://example.com/api
* `username` - optional, the app username
* `icon` - optional, the app icon, e.g. :robot_face: or https://example.com/image.png
* `insecureSkipVerify` - optional bool, true or false
| **Option** | **Required** | **Type** | **Description** | **Example** |
| -------------------- | ------------ | -------------- | --------------- | ----------- |
| `apiURL` | False | `string` | The server URL. | `https://example.com/api` |
| `channels` | False | `list[string]` | | `["my-channel-1", "my-channel-2"]` |
| `icon` | False | `string` | The app icon. | `:robot_face:` or `https://example.com/image.png` |
| `insecureSkipVerify` | False | `bool` | | `true` |
| `signingSecret` | False | `string` | | `8f742231b10e8888abcd99yyyzzz85a5` |
| `token` | **True** | `string` | The app's OAuth access token. | `xoxb-1234567890-1234567890123-5n38u5ed63fgzqlvuyxvxcx6` |
| `username` | False | `string` | The app username. | `argocd` |

## Configuration

Expand Down
2 changes: 1 addition & 1 deletion docs/operator-manual/notifications/services/teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ template.app-sync-succeeded: |

### summary field

You can set a summary of the message that will be shown on Notifcation & Activity Feed
You can set a summary of the message that will be shown on Notification & Activity Feed

![](https://user-images.githubusercontent.com/6957724/116587921-84c4d480-a94d-11eb-9da4-f365151a12e7.jpg)

Expand Down
15 changes: 12 additions & 3 deletions docs/operator-manual/notifications/services/webhook.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
# 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.
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
- `basicAuth` - optional, the basic authentication to pass along with the webhook
- `insecureSkipVerify` - optional bool, true or false
- `retryWaitMin` - Optional, the minimum wait time between retries. Default value: 1s.
- `retryWaitMax` - Optional, the maximum wait time between retries. Default value: 5s.
- `retryMax` - Optional, the maximum number of retries. Default value: 3.

## Retry Behavior

The webhook service will automatically retry the request if it fails due to network errors or if the server returns a 5xx status code. The number of retries and the wait time between retries can be configured using the `retryMax`, `retryWaitMin`, and `retryWaitMax` parameters.

The wait time between retries is between `retryWaitMin` and `retryWaitMax`. If all retries fail, the `Send` method will return an error.

## Configuration

Expand Down Expand Up @@ -67,7 +76,7 @@ metadata:
## Examples
### Set Github commit status
### Set GitHub commit status
```yaml
apiVersion: v1
Expand Down
11 changes: 9 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/argoproj/argo-cd/v2

go 1.19
go 1.21

toolchain go1.21.0

require (
code.gitea.io/sdk/gitea v0.15.1
Expand All @@ -12,7 +14,7 @@ require (
github.com/alicebob/miniredis/v2 v2.30.4
github.com/antonmedv/expr v1.15.2
github.com/argoproj/gitops-engine v0.7.1-0.20231102154024-c0c2dd1f6f48
github.com/argoproj/notifications-engine v0.4.1-0.20230905144632-9dcecdc3eebf
github.com/argoproj/notifications-engine v0.4.1-0.20231027194313-a8d185ecc0a9
github.com/argoproj/pkg v0.13.7-0.20230626144333-d56162821bd1
github.com/aws/aws-sdk-go v1.44.317
github.com/bmatcuk/doublestar/v4 v4.6.0
Expand Down Expand Up @@ -126,11 +128,16 @@ require (
github.com/aws/aws-sdk-go-v2/service/sts v1.18.0 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/tidwall/gjson v1.14.4 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
go.opencensus.io v0.24.0 // indirect
google.golang.org/api v0.132.0 // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
gopkg.in/retry.v1 v1.0.3 // indirect
Expand Down
Loading

0 comments on commit 953902d

Please sign in to comment.