argoproj / argoproj/notifications-engine

webhook alert failed

Open
#354 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
334
Forks
217
PR merge metrics
No merged PRs in 30d

Description

Version: argocd:v2.13.2

ConfigMap:
`---
apiVersion: v1
data:
context: |
argocdUrl: https://dev-argocd.evescn.com
service.webhook.feishu: >
url:
https://open.feishu.cn/open-apis/bot/v2/hook/5xxxxx
subscriptions: |
- recipients: [feishu] # 使用 Feishu 配置替代
triggers: [on-sync-running, on-deployed, on-sync-failed, on-sync-succeeded]
template.app-sync-change: |
feishu:
method: POST
body: |
{
"msg_type": "interactive",
"card": {
"header": {
"template": "blue", # 可以根据需求调整颜色
"title": {
"tag": "plain_text",
"content": "服务发版成功"
}
},
"elements": [
{
"tag": "column_set",
"flex_mode": "none",
"background_style": "grey",
"columns": [
{
"tag": "column",
"width": "weighted",
"weight": 1,
"vertical_align": "top",
"elements": [
{
"tag": "markdown",
"content": "### 服务发版成功\n- **服务名称**: {{.app.metadata.name}}\n- **同步状态**: {{.app.status.operationState.phase}}\n- **服务状态**: {{.app.status.health.status}}\n- **发版时间**: {{.app.status.operationState.startedAt}}\n- **查看详情**: [点击跳转到 ArgoCD]({{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true)"
}
]
}
]
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {
"tag": "plain_text",
"content": "查看文档"
},
"url": "https://open.feishu.cn/document",
"type": "primary"
}
]
}
]
}
}
template.app-sync-degraded: |
webhook:
feishu:
method: POST
body: |
{
"msg_type": "interactive",
"card": {
"header": {
"template": "red", # 错误时使用红色
"title": {
"tag": "plain_text",
"content": "服务发版失败"
}
},
"elements": [
{
"tag": "column_set",
"flex_mode": "none",
"background_style": "grey",
"columns": [
{
"tag": "column",
"width": "weighted",
"weight": 1,
"vertical_align": "top",
"elements": [
{
"tag": "markdown",
"content": "### 服务发版失败\n- **服务名称**: {{.app.metadata.name}}\n- **同步状态**: {{.app.status.operationState.phase}}\n- **服务状态**: {{.app.status.health.status}}\n- **发版时间**: {{.app.status.operationState.startedAt}}\n- **查看详情**: [点击跳转到 ArgoCD]({{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true)"
}
]
}
]
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {
"tag": "plain_text",
"content": "查看文档"
},
"url": "https://open.feishu.cn/document",
"type": "danger"
}
]
}
]
}
}
trigger.on-deployed: |
- description: Application is synced and healthy. Triggered once per commit.
oncePer: app.status.sync.revision
send: [app-sync-change] # template names
# trigger condition
when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'
trigger.on-health-degraded: |
- description: Application has degraded
send: [app-sync-degraded]
when: app.status.health.status == 'Degraded'
trigger.on-sync-failed: |
- description: Application syncing has failed
send: [app-sync-degraded] # template names
when: app.status.operationState.phase in ['Error', 'Failed']
trigger.on-sync-running: |
- description: Application is being synced
send: [app-sync-change] # template names
when: app.status.operationState.phase in ['Running']
trigger.on-sync-status-unknown: |
- description: Application status is 'Unknown'
send: [app-sync-degraded] # template names
when: app.status.sync.status == 'Unknown'
trigger.on-sync-succeeded: |
- description: Application syncing has succeeded
send: [app-sync-change] # template names
when: app.status.operationState.phase in ['Succeeded']
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/component: notifications-controller
app.kubernetes.io/name: argocd-notifications-controller
app.kubernetes.io/part-of: argocd
name: argocd-notifications-cm
namespace: argocd

`
Error messages:
How should I fix it
time="2025-01-21T07:46:54Z" level=error msg="failed to execute when condition: cannot fetch phase from (1:27)\n | app.status.operationState.phase in ['Succeeded']\n | ..........................^"
time="2025-01-21T07:46:54Z" level=info msg="Trigger on-sync-succeeded result: [{[0].zxM90Et6k4Elb1-fHdjtDJq0xR0 [app-sync-change-succ] false}]" resource=argocd/git2consul-dev-a
time="2025-01-21T07:46:54Z" level=error msg="failed to execute when condition: cannot fetch phase from (1:27)\n | app.status.operationState.phase in ['Error','Failed']\n | ..........................^"
time="2025-01-21T07:46:54Z" level=info msg="Trigger on-sync-failed result: [{[0].IMPe5f0U-6AWcEZDXclrRvNAb08 [app-sync-err-unhealthy] false}]" resource=argocd/git2consul-dev-a
time="2025-01-21T07:46:54Z" level=error msg="failed to execute when condition: cannot fetch phase from (1:27)\n | app.status.operationState.phase in ['Running']\n | ..........................^"
time="2025-01-21T07:46:54Z" level=info msg="Trigger on-sync-running result: [{[0].xGlbhcF_taGYrI3UsrQsINn2hl0 [app-sync-running] false}]" resource=argocd/git2consul-dev-a
time="2025-01-21T07:46:54Z" level=error msg="failed to execute when condition: cannot fetch phase from (1:27)\n | app.status.operationState.phase in ['Succeeded'] and app.status.health.status in ['Degraded','Unknown']\n | ..........................^"
time="2025-01-21T07:46:54Z" level=info msg="Trigger on-health-degraded result: [{[0].TSzMEpK33B8C0_QIDEvAxGK45tw [app-sync-unhealthy] false}]" resource=argocd/git2consul-dev-a
time="2025-01-21T07:46:54Z" level=error msg="failed to execute when condition: cannot fetch phase from (1:27)\n | app.status.operationState.phase in ['Error','Failed'] and app.status.sync.status in ['Degraded','Unknown']\n | ..........................^"
time="2025-01-21T07:46:54Z" level=info msg="Trigger on-sync-status-unknown result: [{[0].GZDysgDbpFa5JCVIFUFI3lSKBuA [app-sync-err-unhealthy] false}]" resource=argocd/git2consul-dev-a
time="2025-01-21T07:46:54Z" level=error msg="failed to execute when condition: cannot fetch phase from (1:27)\n | app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'\n | ..........................^"
time="2025-01-21T07:46:54Z" level=info msg="Trigger on-deployed result: [{[0].y7b5sbwa2Q329JYH755peeq-fBs [app-sync-healthy] false}]" resource=argocd/git2consul-dev-a

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the supplied argocd-notifications-cm configuration on Argo CD v2.13.2 and compare the trigger conditions with the reported controller logs. Trace why app.status.operationState.phase is nil; done means the conditions evaluate without errors and the configured Feishu alerts fire for the relevant application states.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.