argoproj / argoproj/notifications-engine
Add support for github service notifications with multi source apps
- Dominant language
- Go
- Stars
- 334
- Forks
- 217
- PR merge metrics
- No merged PRs in 30d
Description
As described in this [issue](https://github.com/argoproj/argo-cd/issues/15617), it looks like the github notification service has not implemented the support for multi source applications and it's returning an out of range error as it's only considering the repoURL inside single source definition (that is "" when using multi source)
error:
`Index out of range [1] with length 1\ngoroutine 189 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x65\ngithub.com/argoproj/notifications-engine/pkg/controller.(*notificationController).processQueueItem.func1()\n\t/go/pkg/mod/github.com/argoproj/notifications-engine@v0.4.1-0.20230620204159-3446d4ae8520/pkg/controller/controller.go:258 +0x65\npanic({0x3788a00, 0xc000c6cc48})\n\t/usr/local/go/src/runtime/panic.go:890 +0x263\ngithub.com/argoproj/notifications-engine/pkg/services.gitHubService.Send({{{0x3211380, 0xc0019cbdf8}, {0x3211380, 0xc0019cbe08}, {0xc00075e000, 0x68f}, {0x0, 0x0}}, 0xc0004ce600}, {{0xc00037f3a0, ...}, ...}, ...)\n\t/go/pkg/mod/github.com/argoproj/notifications-engine@v0.4.1-0.20230620204159-3446d4ae8520/pkg/services/github.go:280 +0x6c9\ngithub.com/argoproj/notifications-engine/pkg/api.`
It looks like it's working with a **[fixed repoUrl template](https://github.com/argoproj/notifications-engine/blob/master/pkg/services/github.go#L64)**
In our case, we are using `three different sources with 2 repositories:`
- One using a helm chart from first repository
- Another one using a ref to another repository to pick chart value files
- A third one to apply manifests
Something like:
```yaml
sources:
- repoURL: 'https://artifactory/chart'
chart: chart-name
targetRevision: 'branch'
helm:
valueFiles:
- $values/folder/values.yaml
- $values/folder/values2.yaml
- repoURL: 'repo2'
targetRevision: 'branch'
ref: values
- repoURL: 'repo2'
targetRevision: 'branch'
path: 'manifests-path'
```
So our app revisions looks like
```json
[
"2.2.3",
"b9cc369644fe34f7a85942266ae0b1fcb26b1de1",
"b9cc369644fe34f7a85942266ae0b1fcb26b1de1"
]
```
I've been playing a bit with the code and managed to extract the repository from multi source by modifying the template but the main problem I found is... to which repository do you send the github update with a setup like this without extending the application spec to be able to configure the target notification repository? (or similar)
Is there any plan to adapt this service to be able to inspect multi source repo urls and revisions?
Thanks in advance
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the fixed repoUrl template in pkg/services/github.go around line 64 and trace the GitHub service Send path identified near line 280. Reproduce the out-of-range failure with the multi-source application shape and inspect how repository URLs and revisions are selected. Done means multi-source applications are handled without the panic, with the target notification repository behavior defined and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100