团队¶
参数¶
团队通知服务使用团队机器人发送消息通知,需要指定以下设置:
recipientUrls
- 网络钩子网址映射,例如channelName: https://example.com
配置¶
1.打开 "团队",转到 "应用程序"。
2.找到 Incoming Webhook
microsoft 应用程序并点击它
3.按 "添加到团队 "键 -> 选择团队和频道 -> 按 "设置连接器 "键
4.输入 webhook 名称并上传镜像(可选)
5.按 "创建",然后复制 webhook 网址并将其存储在 "argocd-notifications-secret "中,并在 "argocd-notifications-cm "中对其进行定义
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
data:
service.teams: |
recipientUrls:
channelName: $channel-teams-url
apiVersion: v1
kind: Secret
metadata:
name: <secret-name>
stringData:
channel-teams-url: https://example.com
6.为团队集成创建订阅:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
notifications.argoproj.io/subscribe.on-sync-succeeded.teams: channelName
模板¶
通知模板 可以自定义,以利用团队消息部分、事实、themeColor、摘要和 potentialAction 功能。
template.app-sync-succeeded: |
teams:
themeColor: "#000080"
sections: |
[{
"facts": [
{
"name": "Sync Status",
"value": "{{.app.status.sync.status}}"
},
{
"name": "Repository",
"value": "{{.app.spec.source.repoURL}}"
}
]
}]
potentialAction: |-
[{
"@type":"OpenUri",
"name":"Operation Details",
"targets":[{
"os":"default",
"uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
}]
}]
title: Application {{.app.metadata.name}} has been successfully synced
text: Application {{.app.metadata.name}} has been successfully synced at {{.app.status.operationState.finishedAt}}.
summary: "{{.app.metadata.name}} sync succeeded"
事实领域¶
您可以使用 "facts "字段代替 "sections "字段。
template.app-sync-succeeded: |
teams:
facts: |
[{
"name": "Sync Status",
"value": "{{.app.status.sync.status}}"
},
{
"name": "Repository",
"value": "{{.app.spec.source.repoURL}}"
}]
主题颜色区域¶
您可以将主题颜色设置为信息的十六进制字符串。
template.app-sync-succeeded: |
teams:
themeColor: "#000080"
摘要栏¶
您可以设置将显示在通知和活动反馈上的信息摘要
template.app-sync-succeeded: |
teams:
summary: "Sync Succeeded"