argoproj / argoproj/notifications-engine
Support multiple github organization configurations
- Dominant language
- Go
- Stars
- 334
- Forks
- 217
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
Is there any way of configuring multiple GitHub organization notifications?
For a simple GitHub organization we can use the following configurations as described in the [documentation](https://argo-cd.readthedocs.io/en/stable/operator-manual/notifications/services/github/):
```
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-notifications-cm
data:
service.github: |
appID:
installationID:
privateKey: $github-privateKey
enterpriseBaseURL:
```
Then create the **github-privateKey** secret with the private key from the GitHub app.
WIth the mentioned template below and a set of triggers like:
```
trigger.github-trigger: |
- when: app.status.operationState != nil and app.status.operationState.phase in ['Running']
description: Application is being synced
send: [app-deployed]
oncePer: app.status.operationState?.syncResult?.revision
- when: app.status.operationState != nil and app.status.operationState.phase in ['Succeeded']
description: Application syncing has succeeded
send: [app-deployed]
oncePer: app.status.operationState?.syncResult?.revision
- when: app.status.operationState != nil and app.status.operationState.phase in ['Error', 'Failed']
description: Application syncing has failed
send: [app-deployed]
oncePer: app.status.operationState?.syncResult?.revision
```
We can add the following notification to trigger a notification:
```
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
notifications.argoproj.io/subscribe.github-trigger.github: ""
```
Is there any change for example to configure the services like:
```
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-notifications-cm
data:
service.github-organization1: |
appID:
installationID:
privateKey: $github-privateKey-organization1
enterpriseBaseURL:
service.github-organization2: |
appID:
installationID:
privateKey: $github-privateKey-organization2
enterpriseBaseURL:
```
The private keys should be saved accordingly in the `argocd-notifications-secret`:
```
apiVersion: v1
kind: Secret
metadata:
name:
stringData:
github-privateKey-organization1: |
-----BEGIN RSA PRIVATE KEY-----
(snip)
-----END RSA PRIVATE KEY-----
github-privateKey-organization2: |
-----BEGIN RSA PRIVATE KEY-----
(snip)
-----END RSA PRIVATE KEY-----
```
And then the annotations could be used like:
```
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
notifications.argoproj.io/subscribe.github-trigger.github-organization1: ""
notifications.argoproj.io/subscribe.github-trigger.github-organization2: ""
```
The end of the annotation would have the name of the configured service.
I'm not sure how the implementation is done on the notifications controller side, but maybe updating this to check if the service starts with `github`, and can have anything else in front of it.
https://github.com/argoproj/notifications-engine/blob/master/pkg/services/services.go#L27
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with pkg/services/services.go at the linked service lookup, then trace how GitHub service configuration and annotation subscriptions are resolved. Check the existing service-related tests and configuration documentation before defining the behavior; done means separate GitHub organization configurations can be selected through distinct service names and subscriptions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, go, kubernetes
- Domain
- backend, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100