Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Index out of range when sending github commit status update #372

Open
IvanovOleg opened this issue Dec 12, 2021 · 1 comment
Open

Index out of range when sending github commit status update #372

IvanovOleg opened this issue Dec 12, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@IvanovOleg
Copy link

Summary

It seems like argocd notifications 1.2 has a bug when it tries to send github commit status update. I am not sure when exactly it happened (argocd 2.2 update or notifications 1.2), but with argocd 1.6 and notifications 1.1 it was fine. I am using the following configuration (tokens and url were substituted):

argocd-notifications:
  logLevel: debug
  nameOverride: "argo-argocd-notifications"
  argocdUrl: https://my.awesome.com
  secret:
    items:
      slack-token: ""
      github-privateKey: ""
  notifiers:
    service.slack: |
      token: $slack-token
    service.github: |
      appID: 145596
      installationID: 20164370
      privateKey: $github-privateKey
  templates:
    template.github-commit-status-error: |
      message: |
        Application is {{.app.status.health.status}}.
      github:
        status:
          state: error
          label: "continuous-delivery/{{.app.metadata.name}}"
          targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
    template.github-commit-status-failure: |
      message: |
        Application is {{.app.status.sync.status}}.
      github:
        status:
          state: failure
          label: "continuous-delivery/{{.app.metadata.name}}"
          targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
    template.github-commit-status-pending: |
      message: |
        Application is {{.app.status.sync.status}}.
      github:
        status:
          state: pending
          label: "continuous-delivery/{{.app.metadata.name}}"
          targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
    template.github-commit-status-success: |
      message: |
        Application is {{.app.status.health.status}}.
      github:
        status:
          state: success
          label: "continuous-delivery/{{.app.metadata.name}}"
          targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
  triggers:
    defaultTriggers: |
      - on-sync-status
    trigger.on-sync-status: |
      - when: app.status.operationState.phase in ['Succeeded', 'Unknown', 'Running'] and app.status.health.status in ['Progressing', 'Suspended']
        send: [github-commit-status-pending]
      - when: app.status.operationState.phase in ['Running'] and app.status.health.status == 'Healthy'
        send: [github-commit-status-success]
      - when: app.status.operationState.phase == 'Failed'
        send: [github-commit-status-failed]
      - when: app.status.health.status == 'Degraded'
        send: [github-commit-status-error]

Diagnostics

What Kubernetes provider are you using?
AWS EKS 1.21

What version of Argo CD and Argo CD Notifications are you running?
v2.2.0-rc1+8840688

# Paste the logs from the notification controller

time="2021-12-12T22:39:20Z" level=info msg="Sending notification about condition 'on-sync-status.[3].zoG5zUjYGjimkwCGgIQGjx1hO5s' to '{github }'" resource=argo/my-project-pr-66
time="2021-12-12T22:39:20Z" level=error msg="Recovered from panic: runtime error: index out of range [1] with length 1\ngoroutine 93 [running]:\nruntime/debug.Stack(0xc000b691d8, 0x2019820, 0xc000a65968)\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x9f\ngithub.com/argoproj/notifications-engine/pkg/controller.(*notificationController).processQueueItem.func1(0xc00055aa20, 0x1dfc160, 0xc000a99590)\n\t/go/pkg/mod/github.com/argoproj/[email protected]/pkg/controller/controller.go:200 +0x8c\npanic(0x2019820, 0xc000a65968)\n\t/usr/local/go/src/runtime/panic.go:965 +0x1b9\ngithub.com/argoproj/notifications-engine/pkg/services.gitHubService.Send(0x238bc, 0x133af12, 0xc000b79c00, 0x68a, 0x0, 0x0, 0xc00015f8c0, 0xc0006b0360, 0x19, 0x0, ...)\n\t/go/pkg/mod/github.com/argoproj/[email protected]/pkg/services/github.go:193 +0x41c\ngithub.com/argoproj/notifications-engine/pkg/api.(*api).Send(0xc000694480, 0xc000b1aa80, 0xc000096dc0, 0x1, 0x4, 0xc00014b8b3, 0x6, 0x0, 0x0, 0x4, ...)\n\t/go/pkg/mod/github.com/argoproj/[email protected]/pkg/api/api.go:71 +0x478\ngithub.com/argoproj/notifications-engine/pkg/controller.(*notificationController).processResource(0xc00055aa20, 0x24ee508, 0xc00012abe0, 0xc00057acb0, 0x17, 0xc00057acb0, 0x0)\n\t/go/pkg/mod/github.com/argoproj/[email protected]/pkg/controller/controller.go:165 +0x76d\ngithub.com/argoproj/notifications-engine/pkg/controller.(*notificationController).processQueueItem(0xc00055aa20, 0x203001)\n\t/go/pkg/mod/github.com/argoproj/[email protected]/pkg/controller/controller.go:229 +0x48a\ngithub.com/argoproj/notifications-engine/pkg/controller.(*notificationController).Run.func1()\n\t/go/pkg/mod/github.com/argoproj/[email protected]/pkg/controller/controller.go:118 +0x36\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc000a99790)\n\t/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:155 +0x5f\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil(0xc000a99790, 0x2482680, 0xc000aa0ab0, 0x1, 0x0)\n\t/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:156 +0x9b\nk8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc000a99790, 0x3b9aca00, 0x0, 0x1, 0x0)\n\t/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:133 +0x98\nk8s.io/apimachinery/pkg/util/wait.Until(0xc000a99790, 0x3b9aca00, 0x0)\n\t/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:90 +0x4d\ncreated by github.com/argoproj/notifications-engine/pkg/controller.(*notificationController).Run\n\t/go/pkg/mod/github.com/argoproj/[email protected]/pkg/controller/controller.go:117 +0x115\n"

Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

@IvanovOleg IvanovOleg added the bug Something isn't working label Dec 12, 2021
@IvanovOleg
Copy link
Author

IvanovOleg commented Dec 20, 2021

I have the same error after update to ArgoCD 2.2.1 and ArgoCD Notifications 1.2.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant