Skip to content
Merged

Test #29

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ jobs:
CDN_REGION: ${{ secrets.CDN_REGION }}
CDN_ENDPOINT: ${{ secrets.CDN_ENDPOINT }}
CDN_URL: ${{ secrets.CDN_URL }}
CDN_DIR: '/docs'
31 changes: 31 additions & 0 deletions .github/workflows/test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: 测试环境-发布文档

on:
release:
types: [created]
push:
branches: [test]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
CDN_ACCESS_KEY: ${{ secrets.CDN_ACCESS_KEY }}
CDN_SECRET_KEY: ${{ secrets.CDN_SECRET_KEY }}
CDN_BUCKET: ${{ secrets.CDN_BUCKET }}
CDN_REGION: ${{ secrets.CDN_REGION }}
CDN_ENDPOINT: ${{ secrets.CDN_ENDPOINT }}
CDN_URL: ${{ secrets.CDN_URL }}
CDN_DIR: '/test/docs'
21 changes: 21 additions & 0 deletions flashduty/en/3. Configure Flashduty/3.7 Templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ CloseTime | int64 | No | Close time, EndTime is alert recovery time, CloseTime i

Below are specific instructions for each notification channel.

<div class="feishu_app hide">

## Feishu/Lark App
---
You need to configure `Integration Center - IM - Feishu/Lark` integration first to send message cards. If custom content is not set, the system default template will be used to render all label information:
Expand Down Expand Up @@ -280,6 +282,9 @@ If you want to display only key label information, you can refer to the code sni
{{if (index .Labels "mode")}}mode:{{index .Labels "mode"}}{{end}}
{{if (index .Labels "runbook_url")}}runbook_url:{{toHtml (index .Labels "runbook_url")}}{{end}}
```
</div>

<div class="dingtalk_app hide">

## Dingtalk App
---
Expand Down Expand Up @@ -322,6 +327,9 @@ If you want to display only key label information, you can refer to the code sni
{{if (index .Labels "mode")}}**mode**:{{index .Labels "mode"}}{{end}}
{{if (index .Labels "runbook_url")}}**runbook_url**:{{index .Labels "runbook_url"}}{{end}}
```
</div>

<div class="wecom_app hide">

## WeCom App
---
Expand Down Expand Up @@ -358,6 +366,9 @@ As shown below:


**Note: WeCom limits card length. In the template rendering area, you can render up to 8 lines of content. Content beyond 8 lines will be hidden**
</div>

<div class="slack_app hide">

## Slack App
---
Expand Down Expand Up @@ -401,6 +412,9 @@ If you want to display only key label information, you can refer to the code sni
{{if (index .Labels "mode")}}*mode*:{{index .Labels "mode"}}{{end}}
{{if (index .Labels "runbook_url")}}*runbook_url*:{{index .Labels "runbook_url"}}{{end}}
```
</div>

<div class="zoom hide">

## Zoom Bot
---
Expand Down Expand Up @@ -500,6 +514,10 @@ If you want to display only key label information, you can refer to the code sni
]
}
```
</div>


<div class="sms hide">

## SMS
---
Expand All @@ -508,6 +526,9 @@ If custom content is not set, the system default template will be used for notif
```
You have a pending incident: {{toHtml .Title}}, Channel: {{.ChannelName}}, Severity: {{.IncidentSeverity}}{{if gt .AlertCnt 1}}, Grouped {{.AlertCnt}} alerts{{end}}
```
</div>

<div class="email hide">

## Email
---
Expand Down
85 changes: 29 additions & 56 deletions flashduty/zh/3. 配置Flashduty/3.7 配置通知模板.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ CloseTime | int64 | 否 | 关闭时间,EndTime 为告警恢复时间,CloseTi
以下为各通知渠道具体说明。


<div class="feishu_app hide">

## 飞书应用
---
您需要预先配置 `集成中心-即时消息-飞书` 集成,才能发送消息卡片。如果不设置自定义内容,将采用系统默认模板,渲染全部标签信息:
Expand Down Expand Up @@ -281,8 +283,9 @@ CloseTime | int64 | 否 | 关闭时间,EndTime 为告警恢复时间,CloseTi
{{if (index .Labels "mode")}}mode:{{index .Labels "mode"}}{{end}}
{{if (index .Labels "runbook_url")}}runbook_url:{{toHtml (index .Labels "runbook_url")}}{{end}}
```
</div>


<div class="dingtalk_app hide">

## 钉钉应用
---
Expand Down Expand Up @@ -325,7 +328,9 @@ CloseTime | int64 | 否 | 关闭时间,EndTime 为告警恢复时间,CloseTi
{{if (index .Labels "mode")}}**mode**:{{index .Labels "mode"}}{{end}}
{{if (index .Labels "runbook_url")}}**runbook_url**:{{index .Labels "runbook_url"}}{{end}}
```
</div>

<div class="wecom_app hide">

## 企业微信应用
---
Expand Down Expand Up @@ -363,7 +368,9 @@ CloseTime | int64 | 否 | 关闭时间,EndTime 为告警恢复时间,CloseTi

**注意,企业微信限制了卡片长度,在模板渲染区域,您最多可以渲染不超过 8 行内容,超过 8 行的部分将被隐藏**

</div>

<div class="slack_app hide">

## Slack 应用
---
Expand Down Expand Up @@ -408,8 +415,9 @@ CloseTime | int64 | 否 | 关闭时间,EndTime 为告警恢复时间,CloseTi
{{if (index .Labels "mode")}}*mode*:{{index .Labels "mode"}}{{end}}
{{if (index .Labels "runbook_url")}}*runbook_url*:{{index .Labels "runbook_url"}}{{end}}
```
</div>


<div class="teams_app hide">

## Microsoft Teams 应用
---
Expand Down Expand Up @@ -454,56 +462,9 @@ CloseTime | int64 | 否 | 关闭时间,EndTime 为告警恢复时间,CloseTi
{{if (index .Labels "mode")}}**mode**:{{index .Labels "mode"}}{{end}}
{{if (index .Labels "runbook_url")}}**runbook_url**:{{index .Labels "runbook_url"}}{{end}}
```
</div>





## Microsoft Teams 应用
---
您需要预先配置 `集成中心-即时消息- Microsoft Teams` 集成,才能发送消息卡片。如果不设置自定义内容,将采用系统默认模板,仅渲染常见标签信息:

```
{{if .Description}}**description** :{{toHtml .Labels.body_text .Description}}{{end}}
{{if .Labels.resource}}**resource** : {{toHtml (joinAlertLabels . "resource" ", ")}}{{end}}
{{range $k, $v := .Labels}}
{{if not (in $k "resource" "body_text" "body_text_with_table")}}**{{$k}}** : {{toHtml $v}}{{end}}{{end}}
```


如下图所示:

<img src="https://download.flashcat.cloud/flashduty/integration/microsoft-teams/teams_app_message.png" alt="drawing" style="display: block; margin: 0 auto;" width="300"/>

如果您期望仅展示关键标签信息,可以参照下边的代码段:

- 我们列出了一些常见标签,您可自行删减;
- 消息可以发送长度为 28KB 左右字节,超出后报错;
- 在 Microsoft Teams 应用中,系统会自动帮您删除(因标签不存在导致的)渲染空行,您可放心配置

```
{{if (index .Labels "resource")}}**resource**:{{toHtml (joinAlertLabels . "resource" ", ")}}{{end}}
{{if (index .Labels "metric")}}**metric**:{{index .Labels "metric"}}{{end}}
{{if (index .Labels "prom_ql")}}**prom_ql**:{{toHtml (index .Labels "prom_ql")}}{{end}}
{{if (index .Labels "trigger_value")}}**trigger_value**:{{index .Labels "trigger_value"}}{{end}}
{{if (index .Labels "host_ql")}}**host_ql**:{{index .Labels "host_ql"}}{{end}}
{{if (index .Labels "region")}}**region**:{{index .Labels "region"}}{{end}}
{{if (index .Labels "cluster")}}**cluster**:{{index .Labels "cluster"}}{{end}}
{{if (index .Labels "business")}}**business**:{{index .Labels "business"}}{{end}}
{{if (index .Labels "service")}}**service**:{{index .Labels "service"}}{{end}}
{{if (index .Labels "env")}}**env**:{{index .Labels "env"}}{{end}}
{{if (index .Labels "type")}}**type**:{{index .Labels "type"}}{{end}}
{{if (index .Labels "topic")}}**topic**:{{index .Labels "topic"}}{{end}}
{{if (index .Labels "cpu")}}**cpu**:{{index .Labels "cpu"}}{{end}}
{{if (index .Labels "device")}}**device**:{{index .Labels "device"}}{{end}}
{{if (index .Labels "path")}}**path**:{{index .Labels "path"}}{{end}}
{{if (index .Labels "fstype")}}**fstype**:{{index .Labels "fstype"}}{{end}}
{{if (index .Labels "name")}}**name**:{{index .Labels "name"}}{{end}}
{{if (index .Labels "mode")}}**mode**:{{index .Labels "mode"}}{{end}}
{{if (index .Labels "runbook_url")}}**runbook_url**:{{index .Labels "runbook_url"}}{{end}}
```


<div class="feishu hide">

## 飞书机器人
---
Expand Down Expand Up @@ -727,8 +688,10 @@ msg_type 必填,值为 post
分派人员:{{range .Responders}}@{{.PersonName}} {{end}}{{end}}
<br>详情:{{.DetailUrl}}
```
</div>


<div class="dingtalk hide">

## 钉钉机器人
---
Expand All @@ -753,8 +716,9 @@ msg_type 必填,值为 post
---
<br>[详情]({{.DetailUrl}})|[认领]({{.DetailUrl}}?ack=1)
```
</div>


<div class="wecom hide">

## 企业微信机器人
---
Expand All @@ -776,11 +740,13 @@ msg_type 必填,值为 post
> 分派人员:{{range .Responders}}@{{.PersonName}} {{end}}{{end}}
<br>[详情]({{.DetailUrl}})|[认领]({{.DetailUrl}}?ack=1)
```
</div>


<div class="telegram hide">

## Telegram 机器人
---

- 配置国内能访问的Telegram服务地址;
- 消息`最大长度为4096字符,超出后不发送`;
- 如果文本中包含`<br>`,渲染时会`先删除空行,再将<br>替换为换行符`;
Expand All @@ -800,8 +766,9 @@ msg_type 必填,值为 post

<br>[详情]({{.DetailUrl}})|[认领]({{.DetailUrl}}?ack=1)
```
</div>


<div class="slack hide">

## Slack 机器人
---
Expand All @@ -823,6 +790,9 @@ msg_type 必填,值为 post
-----
<br><{{.DetailUrl}}|详情>|<{{.DetailUrl}}?ack=1|认领>
```
</div>

<div class="zoom hide">

## Zoom 机器人
---
Expand Down Expand Up @@ -922,8 +892,10 @@ msg_type 必填,值为 post
]
}
```
</div>


<div class="sms hide">

## 短信
---
Expand All @@ -932,8 +904,9 @@ msg_type 必填,值为 post
```
您有故障待处理:{{toHtml .Title}},协作空间:{{.ChannelName}},等级:{{.IncidentSeverity}}{{if gt .AlertCnt 1}},共聚合{{.AlertCnt}}条告警{{end}}
```
</div>


<div class="email hide">

## 邮件
---
Expand Down Expand Up @@ -1028,4 +1001,4 @@ msg_type 必填,值为 post

<img src="https://download.flashcat.cloud/flashduty/changelog/20230720/email_render.png" alt="drawing" style="display: block; margin: 0 auto;" width="500"/>


</div>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flashduty-knowledge-base",
"version": "1.2.4-beta.2",
"version": "1.2.5",
"description": "flashduty knowledge base",
"type": "module",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions scripts/upload.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import OpenApi from "@alicloud/openapi-client";
dotenv.config();

const localDir = "./dist/iife"; // 本地文件夹路径
const ossDir = "/docs"; // 将数字转换为字符串并添加前缀
// const ossDir = "/test/docs"; // 上传到oss的文件路径

const client = new OSS({
region: process.env.CDN_REGION,
Expand Down Expand Up @@ -43,7 +43,7 @@ async function uploadFiles() {
}
}

await uploadDir(localDir, ossDir);
await uploadDir(localDir, process.env.CDN_DIR);
} catch (err) {
console.error("Error uploading files:", err);
}
Expand Down
Loading