Docs: fix workflow docs (#273)

This commit is contained in:
Tianxin Dong 2021-09-14 22:00:16 +08:00 committed by GitHub
parent 45516efbdc
commit 7b80a8aaf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 43 additions and 23 deletions

View File

@ -86,6 +86,8 @@ spec:
policy:
numerical:
order: asc
# add more commit message
commitMessage: "Image: {{range .Updated.Images}}{{println .}}{{end}}"
```
Apply the file to the cluster and check the `Application` in clusters, we can see that the `git-app` automatically pulls the config from Git Repository and apply the application to the cluster:
@ -126,7 +128,7 @@ func main() {
Commit the change to the Git Repository, we can see that our CI pipelines has built the image and push it to the image registry.
KubeVela will then listening to the image registry and update the `Application` in Git Repository with the latest image tag. We can see that there is a commit form `kubevelabot`, the commit message is `Update image automatically.`
KubeVela will then listening to the image registry and update the `Application` in Git Repository with the latest image tag. We can see that there is a commit form `kubevelabot`, the commit message is always with a prefix `Update image automatically.` You can use format like `{{range .Updated.Images}}{{println .}}{{end}}` to specify the image name in the `commitMessage` field.
![alt](../resources/gitops-commit.png)

View File

@ -19,7 +19,7 @@ We can write `valueFrom` in the following ways:
### Inputs
Inputs is made of `name` and `parameterKey`. Input uses `name` to reference output, `parameterKey` is a expression that assigns the value of the input to the corresponding field.
Inputs is made of `from` and `parameterKey`. Input uses `from` to reference output, `parameterKey` is a expression that assigns the value of the input to the corresponding field.
eg.

View File

@ -48,23 +48,31 @@ spec:
properties:
dingding:
# the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
url: xxx
url: <your dingding url>
# specify the message details
message:
msgtype: text
text:
context: Workflow starting...
content: Workflow starting...
- name: application
type: apply-application
type: apply-component
properties:
component: express-server
outputs:
- from: app-status
exportKey: output.status.conditions[0].message + "工作流运行完成"
- name: slack-message
type: webhook-notification
inputs:
- name: app-status
parameterKey: properties.slack.message.text
properties:
slack:
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
url: xxx
# specify the message details
message:
text: Workflow ended.
url: <your slack url>
# specify the message details, will be filled by the input value
# message:
# text: condition message + Workflow ended.
```
## Expected outcome

View File

@ -120,7 +120,7 @@ spec:
type: helm
properties:
repoType: helm
repoUrl: https://charts.bitnami.com/bitnami
url: https://charts.bitnami.com/bitnami
chart: tomcat
version: "9.2.20"
workflow:
@ -141,7 +141,7 @@ spec:
properties:
slack:
# the address of your slack webhook, please refer to: https://api.slack.com/messaging/webhooks
url: slack url
url: <your slack url>
```
Apply the Application to the cluster and you can see that all resources have been successfully applied and Slack has received the messages of the Deployment status.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

After

Width:  |  Height:  |  Size: 237 KiB

View File

@ -88,6 +88,8 @@ spec:
policy:
numerical:
order: asc
# 追加提交信息
commitMessage: "Image: {{range .Updated.Images}}{{println .}}{{end}}"
```
将上述文件部署到集群中后,查看集群中的应用,可以看到,应用 `git-app` 自动拉取了 Git 仓库中的应用配置并部署到了集群中:
@ -128,7 +130,7 @@ func main() {
提交该改动至代码仓库,可以看到,我们配置的 CI 流水线开始构建镜像并推送至镜像仓库。
而 KubeVela 会通过监听镜像仓库,根据最新的镜像 Tag 来更新代码仓库中的 `Application`。此时,可以看到代码仓库中有一条来自 `kubevelabot` 的提交,提交信息`Update image automatically.`
而 KubeVela 会通过监听镜像仓库,根据最新的镜像 Tag 来更新代码仓库中的 `Application`。此时,可以看到代码仓库中有一条来自 `kubevelabot` 的提交,提交信息均带有 `Update image automatically.` 前缀。你也可以通过 `{{range .Updated.Images}}{{println .}}{{end}}``commitMessage` 字段中追加你所需要的信息。
![alt](../resources/gitops-commit.png)

View File

@ -19,7 +19,7 @@ outputs 由 `name` 和 `valueFrom` 组成。`name` 声明了这个 output 的名
### Inputs
inputs 由 `name` 和 `parameterKey` 组成。`name` 声明了这个 input 从哪个 output 中取值,`parameterKey` 为一个表达式,将会把 input 取得的值赋给对应的字段。
inputs 由 `from` 和 `parameterKey` 组成。`from` 声明了这个 input 从哪个 output 中取值,`parameterKey` 为一个表达式,将会把 input 取得的值赋给对应的字段。
如:
1. 指定 inputs:

View File

@ -48,23 +48,31 @@ spec:
properties:
dingding:
# 钉钉 Webhook 地址请查看https://developers.dingtalk.com/document/robots/custom-robot-access
url: xxx
url: <your dingding url>
# 具体要发送的信息详情
message:
msgtype: text
text:
context: 开始运行工作流
content: 开始运行工作流
- name: application
type: apply-application
type: apply-component
properties:
component: express-server
outputs:
- from: app-status
exportKey: output.status.conditions[0].message + "工作流运行完成"
- name: slack-message
type: webhook-notification
inputs:
- name: app-status
parameterKey: properties.slack.message.text
properties:
slack:
# Slack Webhook 地址请查看https://api.slack.com/messaging/webhooks
url: xxx
# 具体要发送的信息详情
message:
text: 工作流运行完成
url: <your slack url>
# 具体要发送的信息详情,会被 input 中的值覆盖
# message:
# text: condition message + 工作流运行完成
```
## 期望结果

View File

@ -98,7 +98,7 @@ spec:
chart: ./charts/kruise/v0.9.0
version: "*"
repoType: git
repoUrl: https://github.com/openkruise/kruise
url: https://github.com/openkruise/kruise
dependsOn:
- ref:
apiVersion: core.oam.dev/v1beta1

View File

@ -120,7 +120,7 @@ spec:
type: helm
properties:
repoType: helm
repoUrl: https://charts.bitnami.com/bitnami
url: https://charts.bitnami.com/bitnami
chart: tomcat
version: "9.2.20"
workflow:
@ -141,7 +141,7 @@ spec:
properties:
slack:
# 你的 slack webhook 地址请参考https://api.slack.com/messaging/webhooks
url: slack url
url: <your slack url>
```
将该应用部署到集群中,可以看到所有的资源都已被成功部署,且 Slack 中收到了对应的通知,通知内容为该 Deployment 的状态信息。

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

After

Width:  |  Height:  |  Size: 237 KiB