0

I'm facing error when the notification is triggered in argocd. I'm trying to setup github commit status when the app is deployed so I followed these docs (and they are latest) ArgoCd Notifications Here are my config manifest argocd-notifications-cm.yml

apiVersion: v1
data:
  context: |
    argocdUrl: "<argo url>"
  service.github: |
    appID: <app-id>
    installationID: <app installation id>
    privateKey: $github-privateKey
  template.app-deployed: |
    message: |
      Application {{.app.metadata.name}} is now running new version of deployments manifests.
    github:
      status:
        state: success
        label: "continuous-delivery/{{.app.metadata.name}}"
        targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
  trigger.app-deployed: |
    - when: app.status.operationState.phase in ['Succeeded']
      send:
        - app-deployed
    - when: app.status.operationState.phase in ['Running']
      send:
        - app-deployed
    - when: app.status.operationState.phase in ['Error', 'Failed']
      send:
        - app-deployed
kind: ConfigMap
...

And argocd-notification-secret does contain github-privateKey this is the application that subscribe to this app-deployed trigger

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  annotations:
    notifications.argoproj.io/subscribe.app-deployed.github: ''
  creationTimestamp: '2023-06-24T09:59:03Z'
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  destination:
    namespace: app namespace
    server: '.... sever url'
  project: preview
  sources:
    - ...............
  syncPolicy:
    automated:
      prune: true
    syncOptions:
      - CreateNamespace=true

And this config looks good to me. but I'm getting error in argocd-notifications-controller pod

{"level":"info","msg":"Trigger app-deployed result: [{[0].zxM90Et6k4Elb1-fHdjtDJq0xR0  [app-deployed] true} {[1].xGlbhcF_taGYrI3UsrQsINn2hl0  [app-deployed] false} {[2].H9WjsqG1dKYm6njOZ7yUQYOA1Wk  [app-deployed] false}]","resource":"argocd/chatwoot-pr-42","time":"2023-06-24T10:07:14Z"}
{"level":"info","msg":"Sending notification about condition 'app-deployed.[0].zxM90Et6k4Elb1-fHdjtDJq0xR0' to '{github }'","resource":"argocd/*****","time":"2023-06-24T10:07:14Z"}
{"level":"error","msg":"Recovered from panic: runtime error: index out of range [1] with length 1\ngoroutine 133 [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.20230228182525-f754726f03da/pkg/controller/controller.go:200 +0x65\npanic({0x33fe040, 0xc000e984c8})\n\t/usr/local/go/src/runtime/panic.go:884 +0x212\ngithub.com/argoproj/notifications-engine/pkg/services.gitHubService.Send({{0x55e02, 0x251f432, {0xc0001f1c00, 0x68f}, {0x0, 0x0}}, 0xc000d66480}, {{0xc0009f4140, 0x50}, 0x0, ...}, ...)\n\t/go/pkg/mod/github.com/argoproj/notifications-engine@v0.4.1-0.20230228182525-f754726f03da/pkg/services/github.go:205 +0x305\ngithub.com/argoproj/notifications-engine/pkg/api.(*api).Send(0xc000470980, 0x4?, {0xc000ea2340, 0x1, 0x4}, {{0xc001479471?, 0x4?}, {0x0?, 0x0?}})\n\t/go/pkg/mod/github.com/argoproj/notifications-engine@v0.4.1-0.20230228182525-f754726f03da/pkg/api/api.go:71 +0x43d\ngithub.com/argoproj/notifications-engine/pkg/controller.(*notificationController).processResource(0xc0002d33e0, {0x485bdd0, 0xc00052e068}, 0x2f5f260?)\n\t/go/pkg/mod/github.com/argoproj/notifications-engine@v0.4.1-0.20230228182525-f754726f03da/pkg/controller/controller.go:165 +0x7ad\ngithub.com/argoproj/notifications-engine/pkg/controller.(*notificationController).processQueueItem(0xc0002d33e0)\n\t/go/pkg/mod/github.com/argoproj/notifications-engine@v0.4.1-0.20230228182525-f754726f03da/pkg/controller/controller.go:229 +0x39a\ngithub.com/argoproj/notifications-engine/pkg/controller.(*notificationController).Run.func1()\n\t/go/pkg/mod/github.com/argoproj/notifications-engine@v0.4.1-0.20230228182525-f754726f03da/pkg/controller/controller.go:118 +0x29\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0x3?)\n\t/go/pkg/mod/k8s.io/apimachinery@v0.24.2/pkg/util/wait/wait.go:155 +0x3e\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil(0x6f99e0?, {0x480e5a0, 0xc000d64540}, 0x1, 0x0)\n\t/go/pkg/mod/k8s.io/apimachinery@v0.24.2/pkg/util/wait/wait.go:156 +0xb6\nk8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc0002d33e0?, 0x3b9aca00, 0x0, 0x1?, 0xc0000727d0?)\n\t/go/pkg/mod/k8s.io/apimachinery@v0.24.2/pkg/util/wait/wait.go:133 +0x89\nk8s.io/apimachinery/pkg/util/wait.Until(0x48345c8?, 0xc00005e020?, 0xc000416e00?)\n\t/go/pkg/mod/k8s.io/apimachinery@v0.24.2/pkg/util/wait/wait.go:90 +0x25\ncreated by github.com/argoproj/notifications-engine/pkg/controller.(*notificationController).Run\n\t/go/pkg/mod/github.com/argoproj/notifications-engine@v0.4.1-0.20230228182525-f754726f03da/pkg/controller/controller.go:117 +0xe5\n","time":"2023-06-24T10:07:14Z"}

It doesn't update the commit status. I've tried this annotation too but still doesn't work notifications.argoproj.io/subscribe.app-deployed.github: '<org owner>/<repo name>' with both annotations I end up with this error in notification controller. Can someone please confirm if the config is correct or is there anything I'm missing. I'm using latest version of argocd v2.7.6

I was trying to configure github commit status using argocd, I configured it according to docs but I'm seeing and error in argocd-notifications-controller pod and no commit status is updated on github's side.

0 Answers0