Fix: fix notification docs (#433)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
This commit is contained in:
parent
7f6d9e8688
commit
d50c71e00f
|
|
@ -170,28 +170,42 @@ spec:
|
|||
env: prod
|
||||
```
|
||||
|
||||
## webhook-notification
|
||||
## notification
|
||||
|
||||
### Overview
|
||||
|
||||
Send messages to the webhook address, you need to upgrade to KubeVela v1.1.6 or higher to enable `apply-object`.
|
||||
Send notifications. You can use the notification to send email, slack, ding talk and lark.
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :--------------: | :----: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| email | Object | Optional, please fulfill its from, to and content if you want to send email |
|
||||
| email.from.address | String | Required, the email address that you want to send from |
|
||||
| email.from.alias | String | Optional, the email alias to show after sending the email |
|
||||
| email.from.password | ValueOrSecret | Required, the password of the email, you can either specify it in value or use secretRef |
|
||||
| email.from.host | String | Required, the host of your email |
|
||||
| email.from.port | Int | Optional, the port of the email host, default to 587 |
|
||||
| email.to | []String | Required, the email address that you want to send to |
|
||||
| email.content.subject | String | Required, the subject of the email |
|
||||
| email.content.body | String | Required, the context body of the email |
|
||||
| slack | Object | Optional, please fulfill its url and message if you want to send Slack messages |
|
||||
| slack.url | Object | Required, the webhook address of Slack, you can choose to fill it in directly or specify it in secret |
|
||||
| slack.url.address | String | Optional, directly specify the webhook address of Slack |
|
||||
| slack.url.fromSecret.name | String | Optional, specify the webhook address of Slack from secret |
|
||||
| slack.url.fromSecret.key | String | Optional, specify the webhook address of Slack from secret, the key of the secret |
|
||||
| slack.url | ValueOrSecret | Required, the webhook address of Slack, you can choose to fill it directly in value or specify it in secret |
|
||||
| slack.message | Object | Required, the Slack messages you want to send, please follow [Slack messaging](https://api.slack.com/reference/messaging/payload) |
|
||||
| dingding | Object | Optional, please fulfill its url and message if you want to send DingTalk messages |
|
||||
| dingding.url | Object | Required, the webhook address of DingTalk, you can choose to fill it in directly or specify it in secret |
|
||||
| dingding.url.address | String | Optional, directly specify the webhook address of DingTalk |
|
||||
| dingding.url.fromSecret.name | String | Optional, specify the webhook address of DingTalk from secret |
|
||||
| dingding.url.fromSecret.key | String | Optional, specify the webhook address of DingTalk from secret, the key of the secret |
|
||||
| dingding.url | ValueOrSecret | Required, the webhook address of DingTalk, you can choose to fill it directly in value or specify it in secret |
|
||||
| dingding.message | Object | Required, the DingTalk messages you want to send, please follow [DingTalk messaging](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) | |
|
||||
| lark | Object | Optional, please fulfill its url and message if you want to send Lark messages |
|
||||
| lark.url | ValueOrSecret | Required, the webhook address of Lark, you can choose to fill it directly in value or specify it in secret |
|
||||
| lark.message | Object | Required, the Lark messages you want to send, please follow [Lark messaging](https://open.feishu.cn/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN#8b0f2a1b) | |
|
||||
|
||||
The `ValueOrSecret` format is:
|
||||
|
||||
| Name | Type | Description |
|
||||
| :--------------: | :----: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| value | String | Optional, directly get the data from value |
|
||||
| secretRef.name | String | Optional, get data from secret, the name of the secret |
|
||||
| secretRef.key | String | Optional, get data from secret, the key of the secret |
|
||||
|
||||
### Example
|
||||
|
||||
|
|
@ -217,12 +231,12 @@ spec:
|
|||
workflow:
|
||||
steps:
|
||||
- name: dingtalk-message
|
||||
type: webhook-notification
|
||||
type: notification
|
||||
properties:
|
||||
dingding:
|
||||
# the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
|
||||
url:
|
||||
address: <your dingtalk url>
|
||||
url:
|
||||
value: <url>
|
||||
message:
|
||||
msgtype: text
|
||||
text:
|
||||
|
|
@ -230,16 +244,39 @@ spec:
|
|||
- name: application
|
||||
type: apply-application
|
||||
- name: slack-message
|
||||
type: webhook-notification
|
||||
type: notification
|
||||
properties:
|
||||
slack:
|
||||
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
|
||||
url:
|
||||
fromSecret:
|
||||
name: <the secret name that stores your slack url>
|
||||
key: <the secret key that stores your slack url>
|
||||
secretRef:
|
||||
name: <secret-key>
|
||||
key: <secret-value>
|
||||
message:
|
||||
text: Workflow ended.
|
||||
lark:
|
||||
url:
|
||||
value: <lark-url>
|
||||
message:
|
||||
msg_type: "text"
|
||||
content: "{\"text\":\" Hello KubeVela\"}"
|
||||
email:
|
||||
from:
|
||||
address: <sender-email-address>
|
||||
alias: <sender-alias>
|
||||
password:
|
||||
# secretRef:
|
||||
# name: <secret-name>
|
||||
# key: <secret-key>
|
||||
value: <sender-password>
|
||||
host: <email host like smtp.gmail.com>
|
||||
port: <email port, optional, default to 587>
|
||||
to:
|
||||
- kubevela1@gmail.com
|
||||
- kubevela2@gmail.com
|
||||
content:
|
||||
subject: test-subject
|
||||
body: test-body
|
||||
```
|
||||
|
||||
## apply-object
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
---
|
||||
title: Webhook Notification
|
||||
title: Notification
|
||||
---
|
||||
|
||||
If we want to be notified before or after deploying an application, KubeVela provides integration with notification webhooks, allowing users to send notifications to DingTalk or Slack.
|
||||
If we want to be notified before or after deploying an application, KubeVela provides integration with notification webhooks, allowing users to send notifications to Email, DingTalk, Slack, Lark.
|
||||
|
||||
In this guide, you will learn how to send notifications via `webhook-notification` in workflow.
|
||||
|
||||
> Make sure the version of KubeVela is `>=v1.1.6`.
|
||||
In this guide, you will learn how to send notifications via `notification` in workflow.
|
||||
|
||||
## How to use
|
||||
|
||||
Apply the following `Application` with workflow step type of `webhook-notification`:
|
||||
Apply the following `Application` with workflow step type of `notification`:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
|
|
@ -35,7 +33,7 @@ spec:
|
|||
steps:
|
||||
- name: dingtalk-message
|
||||
# specify the workflow step type
|
||||
type: webhook-notification
|
||||
type: notification
|
||||
properties:
|
||||
dingding:
|
||||
# the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
|
||||
|
|
@ -51,13 +49,13 @@ spec:
|
|||
properties:
|
||||
component: express-server
|
||||
outputs:
|
||||
- from: app-status
|
||||
- name: app-status
|
||||
valueFrom: output.status.conditions[0].message + "工作流运行完成"
|
||||
- name: slack-message
|
||||
type: webhook-notification
|
||||
type: notification
|
||||
inputs:
|
||||
- name: app-status
|
||||
parameterKey: properties.slack.message.text
|
||||
- from: app-status
|
||||
parameterKey: slack.message.text
|
||||
properties:
|
||||
slack:
|
||||
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
|
||||
|
|
@ -74,21 +72,8 @@ spec:
|
|||
|
||||
we can see that before and after the deployment of the application, the messages can be seen in the corresponding group chat.
|
||||
|
||||
With `webhook-notification`, we can integrate with webhook notifier easily.
|
||||
With `notification`, we can integrate with webhook notifier easily.
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| :---: | :--: | :-- |
|
||||
| slack | Object | Optional, please fulfill its url and message if you want to send Slack messages |
|
||||
| slack.url | Object | Required, the webhook address of Slack, you can choose to fill it in directly or specify it in secret |
|
||||
| slack.url.address | String | Optional, directly specify the webhook address of Slack |
|
||||
| slack.url.fromSecret.name | String | Optional, specify the webhook address of Slack from secret |
|
||||
| slack.url.fromSecret.key | String | Optional, specify the webhook address of Slack from secret, the key of the secret |
|
||||
| slack.message | Object | Required, the Slack messages you want to send, please follow [Slack messaging](https://api.slack.com/reference/messaging/payload) |
|
||||
| dingding | Object | Optional, please fulfill its url and message if you want to send DingTalk messages |
|
||||
| dingding.url | Object | Required, the webhook address of DingTalk, you can choose to fill it in directly or specify it in secret |
|
||||
| dingding.url.address | String | Optional, directly specify the webhook address of DingTalk |
|
||||
| dingding.url.fromSecret.name | String | Optional, specify the webhook address of DingTalk from secret |
|
||||
| dingding.url.fromSecret.key | String | Optional, specify the webhook address of DingTalk from secret, the key of the secret |
|
||||
| dingding.message | Object | Required, the DingTalk messages you want to send, please follow [DingTalk messaging](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) |
|
||||
For details, please checkout [notification parameters](./built-in-workflow-defs##notification)
|
||||
|
|
|
|||
|
|
@ -1,270 +0,0 @@
|
|||
---
|
||||
title: Built-in Steps
|
||||
---
|
||||
|
||||
KubeVela provides some built-in workflow step definitions for better experience.
|
||||
|
||||
## apply-application
|
||||
|
||||
### Overview
|
||||
|
||||
Apply all components and traits in Application.
|
||||
|
||||
### Parameter
|
||||
|
||||
No arguments, used for custom steps before or after application applied.
|
||||
|
||||
### Example
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: first-vela-workflow
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
traits:
|
||||
- type: ingress
|
||||
properties:
|
||||
domain: testsvc.example.com
|
||||
http:
|
||||
/: 8000
|
||||
workflow:
|
||||
steps:
|
||||
- name: express-server
|
||||
type: apply-application
|
||||
```
|
||||
|
||||
## depends-on-app
|
||||
|
||||
### Overview
|
||||
|
||||
Wait for the specified Application to complete.
|
||||
|
||||
### Parameter
|
||||
|
||||
| Name | Type | Description |
|
||||
| :-------: | :----: | :------------------------------: |
|
||||
| name | string | The name of the Application |
|
||||
| namespace | string | The namespace of the Application |
|
||||
|
||||
### Example
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: first-vela-workflow
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
traits:
|
||||
- type: ingress
|
||||
properties:
|
||||
domain: testsvc.example.com
|
||||
http:
|
||||
/: 8000
|
||||
workflow:
|
||||
steps:
|
||||
- name: express-server
|
||||
type: depends-on-app
|
||||
properties:
|
||||
name: another-app
|
||||
namespace: default
|
||||
```
|
||||
|
||||
## deploy2env
|
||||
|
||||
### Overview
|
||||
|
||||
Apply Application in different policies and envs.
|
||||
|
||||
### Parameter
|
||||
|
||||
| Name | Type | Description |
|
||||
| :----: | :----: | :--------------------: |
|
||||
| policy | string | The name of the policy |
|
||||
| env | string | The name of the env |
|
||||
|
||||
### Example
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: multi-env-demo
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- name: nginx-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: nginx:1.21
|
||||
port: 80
|
||||
|
||||
policies:
|
||||
- name: env
|
||||
type: env-binding
|
||||
properties:
|
||||
created: false
|
||||
envs:
|
||||
- name: test
|
||||
patch:
|
||||
components:
|
||||
- name: nginx-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: nginx:1.20
|
||||
port: 80
|
||||
placement:
|
||||
namespaceSelector:
|
||||
name: test
|
||||
- name: prod
|
||||
patch:
|
||||
components:
|
||||
- name: nginx-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: nginx:1.20
|
||||
port: 80
|
||||
placement:
|
||||
namespaceSelector:
|
||||
name: prod
|
||||
|
||||
workflow:
|
||||
steps:
|
||||
- name: deploy-test-server
|
||||
type: deploy2env
|
||||
properties:
|
||||
policy: env
|
||||
env: test
|
||||
- name: deploy-prod-server
|
||||
type: deploy2env
|
||||
properties:
|
||||
policy: env
|
||||
env: prod
|
||||
```
|
||||
|
||||
## webhook-notification
|
||||
|
||||
### Overview
|
||||
|
||||
Send messages to the webhook address.
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :--------------: | :----: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| slack | Object | Optional, please fulfill its url and message if you want to send Slack messages |
|
||||
| slack.url | String | Required, the webhook address of Slack |
|
||||
| slack.message | Object | Required, the Slack messages you want to send, please follow [Slack messaging](https://api.slack.com/reference/messaging/payload) |
|
||||
| dingding | Object | Optional, please fulfill its url and message if you want to send DingTalk messages |
|
||||
| dingding.url | String | Required, the webhook address of DingTalk |
|
||||
| dingding.message | Object | Required, the DingTalk messages you want to send, please follow [DingTalk messaging](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) | |
|
||||
|
||||
### Example
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: first-vela-workflow
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
traits:
|
||||
- type: ingress
|
||||
properties:
|
||||
domain: testsvc.example.com
|
||||
http:
|
||||
/: 8000
|
||||
workflow:
|
||||
steps:
|
||||
- name: dingtalk-message
|
||||
type: webhook-notification
|
||||
properties:
|
||||
dingding:
|
||||
# the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
|
||||
url: xxx
|
||||
message:
|
||||
msgtype: text
|
||||
text:
|
||||
context: Workflow starting...
|
||||
- name: application
|
||||
type: apply-application
|
||||
- name: slack-message
|
||||
type: webhook-notification
|
||||
properties:
|
||||
slack:
|
||||
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
|
||||
url: xxx
|
||||
message:
|
||||
text: Workflow ended.
|
||||
```
|
||||
|
||||
## suspend
|
||||
|
||||
### Overview
|
||||
|
||||
Suspend the current workflow, we can use `vela workflow resume appname` to resume the suspended workflow.
|
||||
|
||||
> For more information of `vela workflow`, please refer to [vela cli](../../cli/vela_workflow)。
|
||||
|
||||
### Parameter
|
||||
|
||||
| Name | Type | Description |
|
||||
| :---: | :---: | :---------: |
|
||||
| - | - | - |
|
||||
|
||||
### Example
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: first-vela-workflow
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
traits:
|
||||
- type: ingress
|
||||
properties:
|
||||
domain: testsvc.example.com
|
||||
http:
|
||||
/: 8000
|
||||
workflow:
|
||||
steps:
|
||||
- name: slack-message
|
||||
type: webhook-notification
|
||||
properties:
|
||||
slack:
|
||||
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
|
||||
message:
|
||||
text: Ready to apply the application, ask the administrator to approve and resume the workflow.
|
||||
- name: manual-approval
|
||||
type: suspend
|
||||
- name: express-server
|
||||
type: apply-application
|
||||
```
|
||||
No newline at end of file
|
||||
|
|
@ -171,28 +171,42 @@ spec:
|
|||
env: prod
|
||||
```
|
||||
|
||||
## webhook-notification
|
||||
## notification
|
||||
|
||||
### 简介
|
||||
|
||||
向指定的 Webhook 发送信息,该功能在 KubeVela v1.1.6 及以上版本可使用。
|
||||
向指定的 Webhook 发送信息,支持邮件、钉钉、Slack 和飞书。
|
||||
|
||||
### 参数
|
||||
|
||||
| 参数名 | 类型 | 说明 |
|
||||
| :--------------: | :----: | :--------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| email | Object | 可选值,如果需要发送邮件,则需填写其 from、to 以及 content |
|
||||
| email.from.address | String | 必填值,发送的邮件地址 |
|
||||
| email.from.alias | String | 可选值,发送的邮件别名 |
|
||||
| email.from.password | ValueOrSecret | 必填值,发送的邮件密码,可以选择直接在 value 填写或从 secretRef 中获取 |
|
||||
| email.from.host | String | 必填值,邮件的 Host |
|
||||
| email.from.port | Int | 可选值,邮件发送的端口号,默认为 587 |
|
||||
| email.to | []String | 必填值,邮件发送的地址列表 |
|
||||
| email.content.subject | String | 必填值,邮件的标题 |
|
||||
| email.content.body | String | 必填值,邮件的内容 |
|
||||
| slack | Object | 可选值,如果需要发送 Slack 信息,则需填写其 url 及 message |
|
||||
| slack.url | Object | 必填值,Slack 的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
|
||||
| slack.url.address | String | 可选值,直接填写 Slack 的 Webhook 地址 |
|
||||
| slack.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址,secret 的名字 |
|
||||
| slack.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
|
||||
| slack.url | ValueOrSecret | 必填值,Slack 的 Webhook 地址,可以选择直接在 value 填写或从 secretRef 中获取 |
|
||||
| slack.message | Object | 必填值,需要发送的 Slack 信息,请符合 [Slack 信息规范](https://api.slack.com/reference/messaging/payload) |
|
||||
| dingding | Object | 可选值,如果需要发送钉钉信息,则需填写其 url 及 message |
|
||||
| dingding.url | Object | 必填值,钉钉的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
|
||||
| dingding.url.address | String | 可选值,直接填写钉钉的 Webhook 地址 |
|
||||
| dingding.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址,secret 的名字 |
|
||||
| dingding.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
|
||||
| dingding.url | ValueOrSecret | 必填值,钉钉的 Webhook 地址,可以选择直接在 value 填写或从 secretRef 中获取 |
|
||||
| dingding.message | Object | 必填值,需要发送的钉钉信息,请符合 [钉钉信息规范](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) |
|
||||
| lark | Object | 可选值,如果需要发送飞书信息,则需填写其 url 及 message |
|
||||
| lark.url | ValueOrSecret | 必填值,飞书的 Webhook 地址,可以选择直接在 value 填写或从 secretRef 中获取 |
|
||||
| lark.message | Object | 必填值,需要发送的飞书信息,请符合 [飞书信息规范](https://open.feishu.cn/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN#8b0f2a1b) |
|
||||
|
||||
`ValueOrSecret` 的格式为:
|
||||
|
||||
| 参数名 | 类型 | 说明 |
|
||||
| :--------------: | :----: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| value | String | 可选值,直接填写值 |
|
||||
| secretRef.name | String | 可选值,从 secret 中获取值,secret 的名称 |
|
||||
| secretRef.key | String | 可选值,从 secret 中获取值,secret 的 key |
|
||||
|
||||
### 示例
|
||||
|
||||
|
|
@ -218,12 +232,12 @@ spec:
|
|||
workflow:
|
||||
steps:
|
||||
- name: dingtalk-message
|
||||
type: webhook-notification
|
||||
type: notification
|
||||
properties:
|
||||
dingding:
|
||||
# 钉钉 Webhook 地址,请查看:https://developers.dingtalk.com/document/robots/custom-robot-access
|
||||
url:
|
||||
address: <your dingtalk url>
|
||||
value: <your dingtalk url>
|
||||
message:
|
||||
msgtype: text
|
||||
text:
|
||||
|
|
@ -231,12 +245,12 @@ spec:
|
|||
- name: application
|
||||
type: apply-application
|
||||
- name: slack-message
|
||||
type: webhook-notification
|
||||
type: notification
|
||||
properties:
|
||||
slack:
|
||||
# Slack Webhook 地址,请查看:https://api.slack.com/messaging/webhooks
|
||||
url:
|
||||
fromSecret:
|
||||
secretRef:
|
||||
name: <the secret name that stores your slack url>
|
||||
key: <the secret key that stores your slack url>
|
||||
message:
|
||||
|
|
|
|||
|
|
@ -2,15 +2,13 @@
|
|||
title: 使用 Webhook 发送通知
|
||||
---
|
||||
|
||||
在一些情况下,当我们使用工作流部署应用前后,希望能够得到部署的通知。KubeVela 提供了与 Webhook 集成的能力,支持用户在工作流中向钉钉或者 Slack 发送通知。
|
||||
在一些情况下,当我们使用工作流部署应用前后,希望能够得到部署的通知。KubeVela 提供了与 Webhook 集成的能力,支持用户在工作流中向邮件、钉钉、Slack 或者飞书发送通知。
|
||||
|
||||
本节将介绍如何在工作流中通过 `webhook-notification` 发送 Webhook 通知。
|
||||
|
||||
> 请确保你的 KubeVela 版本 `>=v1.1.6`。
|
||||
本节将介绍如何在工作流中通过 `notification` 发送 Webhook 通知。
|
||||
|
||||
## 如何使用
|
||||
|
||||
部署如下应用部署计划,在部署组件前后,都有一个 `webhook-notification` 步骤发送通知:
|
||||
部署如下应用部署计划,在部署组件前后,都有一个 `notification` 步骤发送通知:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
|
|
@ -35,12 +33,12 @@ spec:
|
|||
steps:
|
||||
- name: dingtalk-message
|
||||
# 指定步骤类型
|
||||
type: webhook-notification
|
||||
type: notification
|
||||
properties:
|
||||
dingding:
|
||||
# 钉钉 Webhook 地址,请查看:https://developers.dingtalk.com/document/robots/custom-robot-access
|
||||
url:
|
||||
address: <your dingding url>
|
||||
value: <your dingding url>
|
||||
# 具体要发送的信息详情
|
||||
message:
|
||||
msgtype: text
|
||||
|
|
@ -51,18 +49,18 @@ spec:
|
|||
properties:
|
||||
component: express-server
|
||||
outputs:
|
||||
- from: app-status
|
||||
- name: app-status
|
||||
valueFrom: output.status.conditions[0].message + "工作流运行完成"
|
||||
- name: slack-message
|
||||
type: webhook-notification
|
||||
inputs:
|
||||
- name: app-status
|
||||
parameterKey: properties.slack.message.text
|
||||
- from: app-status
|
||||
parameterKey: slack.message.text
|
||||
properties:
|
||||
slack:
|
||||
# Slack Webhook 地址,请查看:https://api.slack.com/messaging/webhooks
|
||||
url:
|
||||
fromSecret:
|
||||
secretRef:
|
||||
name: <the secret name that stores your slack url>
|
||||
key: <the secret key that stores your slack url>
|
||||
# 具体要发送的信息详情,会被 input 中的值覆盖
|
||||
|
|
@ -74,21 +72,8 @@ spec:
|
|||
|
||||
通过与 Webhook 的对接,可以看到,在工作流中的组件部署前后,都能在对应的群聊中看到相应的信息。
|
||||
|
||||
通过 `webhook-notification` ,可以使用户方便的与 Webhook 对接消息通知。
|
||||
通过 `notification` ,可以使用户方便的与 Webhook 对接消息通知。
|
||||
|
||||
## 参数说明
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| :---: | :--: | :-- |
|
||||
| slack | Object | 可选值,如果需要发送 Slack 信息,则需填写其 url 及 message |
|
||||
| slack.url | Object | 必填值,Slack 的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
|
||||
| slack.url.address | String | 可选值,直接填写 Slack 的 Webhook 地址 |
|
||||
| slack.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址,secret 的名字 |
|
||||
| slack.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
|
||||
| slack.message | Object | 必填值,需要发送的 Slack 信息,请符合 [Slack 信息规范](https://api.slack.com/reference/messaging/payload) |
|
||||
| dingding | Object | 可选值,如果需要发送钉钉信息,则需填写其 url 及 message |
|
||||
| dingding.url | Object | 必填值,钉钉的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
|
||||
| dingding.url.address | String | 可选值,直接填写钉钉的 Webhook 地址 |
|
||||
| dingding.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址,secret 的名字 |
|
||||
| dingding.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
|
||||
| dingding.message | Object | 必填值,需要发送的钉钉信息,请符合 [钉钉信息规范](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) |
|
||||
请参考 [Notification 内置步骤](built-in-workflow-defs##notification)
|
||||
|
|
|
|||
|
|
@ -68,13 +68,13 @@ spec:
|
|||
properties:
|
||||
component: express-server
|
||||
outputs:
|
||||
- from: app-status
|
||||
- name: app-status
|
||||
valueFrom: output.status.conditions[0].message + "工作流运行完成"
|
||||
- name: slack-message
|
||||
type: webhook-notification
|
||||
inputs:
|
||||
- name: app-status
|
||||
parameterKey: properties.slack.message.text
|
||||
- from: app-status
|
||||
parameterKey: slack.message.text
|
||||
properties:
|
||||
slack:
|
||||
# Slack Webhook 地址,请查看:https://api.slack.com/messaging/webhooks
|
||||
|
|
|
|||
|
|
@ -68,13 +68,13 @@ spec:
|
|||
properties:
|
||||
component: express-server
|
||||
outputs:
|
||||
- from: app-status
|
||||
- name: app-status
|
||||
valueFrom: output.status.conditions[0].message + "工作流运行完成"
|
||||
- name: slack-message
|
||||
type: webhook-notification
|
||||
inputs:
|
||||
- name: app-status
|
||||
parameterKey: properties.slack.message.text
|
||||
- from: app-status
|
||||
parameterKey: slack.message.text
|
||||
properties:
|
||||
slack:
|
||||
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
|
||||
|
|
|
|||
Loading…
Reference in New Issue