I am trying to use ArgoCD notification to my Teams channel, but it isn't sending notification. So, I followed documentation here
I created an Incoming Webhook in teams and get URL
I set it to argocd-notification secrets:
apiVersion: v1 kind: Secret metadata: name: argocd-notifications-secret stringData: channel-teams-url: mywebhookurl type: Opaque
Then I set up config map:
apiVersion: v1 kind: ConfigMap metadata: name: argocd-notifications-cm data: context: | argocdUrl: https://20.204.207.96 trigger.on-health-degraded: | when: app.status.health.status == 'Degraded' send: [app-on-health-degraded] trigger.on-deployed: | when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy' oncePer: app.status.sync.revision send: [app-sync-succeeded] service.teams: | recipientUrls: ArgoCD: $channel-teams-url template.app-on-health-degraded: | email: subject: Application {{.app.metadata.name}} has degraded. message: | Application {{.app.metadata.name}} has degraded. Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}. teams: facts: | [{ "name": "Sync Status", "value": "{{.app.status.sync.status}}" }, { "name": "Repository", "value": "{{.app.spec.source.repoURL}}" } {{range $index, $c := .app.status.conditions}} {{if not $index}},{{end}} {{if $index}},{{end}} { "name": "{{$c.type}}", "value": "{{$c.message}}", } {{end}} ] potentialAction: | [{ "@type":"OpenUri", "name":"Open Application", "targets":[{ "os":"default", "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}" }] }, { "@type":"OpenUri", "name":"Open Repository", "targets":[{ "os":"default", "uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}" }] }] title: Application {{.app.metadata.name}} has degraded. template.app-sync-succeeded: | teams: facts: | [{ "name": "Sync Status", "value": "{{.app.status.sync.status}}" }, { "name": "Repository", "value": "{{.app.spec.source.repoURL}}" }, { "name": "Revision", "value": "{{.app.status.sync.revision}}" } {{range $index, $c := .app.status.conditions}} {{if not $index}},{{end}} {{if $index}},{{end}} { "name": "{{$c.type}}", "value": "{{$c.message}}", } {{end}} ] potentialAction: |- [{ "@type":"OpenUri", "name":"Operation Application", "targets":[{ "os":"default", "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}" }] }, { "@type":"OpenUri", "name":"Open Repository", "targets":[{ "os":"default", "uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}" }] }] title: New version of an application {{.app.metadata.name}} is up and running.
Then I subscribe it from application:
apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: dreambook-argo-application namespace: argocd annotations: notifications.argoproj.io/subscribe.on-sync-running.teams: ArgoCD notifications.argoproj.io/subscribe.on-deployed.teams: ArgoCD notifications.argoproj.io/subscribe.on-health-degraded: ArgoCD spec: project: default source: repoURL: myrepo url targetRevision: HEAD path: dev/deployment destination: server: https://kubernetes.default.svc namespace: myns syncPolicy: automated: prune: true selfHeal: true syncOptions: - Validate=false - Prune=true - SelfHeal=true
So, my channel in Teams is ArgoCD:
So, after CI/CD I am not getting any notification. Does anyone have this problem?
I'm not sure if you applied your secret with a namespace flag or not, but make sure it's in the same namespace as the other resources.
If that is not the issue I'll just assume that the notification controller is not able to send the message due to missing text. The official notification template has this missing for the teams templates.
You can find that out by getting the logs of the argocd notification-controller. Notification controller should be an already running pod in your respective namespace (from what it seems to me, probably at argocd).
Just keep watching the pod logs and sync the application in argocd, you should get some logs that indicate that a message was attempted to send. In case it somewhere says
Then the solution is to add another text field in the template. A working template of mine looks like this: