diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/prod-publish.yml similarity index 97% rename from .github/workflows/npm-publish.yml rename to .github/workflows/prod-publish.yml index 2725a542..6df8f295 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/prod-publish.yml @@ -28,3 +28,4 @@ jobs: CDN_REGION: ${{ secrets.CDN_REGION }} CDN_ENDPOINT: ${{ secrets.CDN_ENDPOINT }} CDN_URL: ${{ secrets.CDN_URL }} + CDN_DIR: '/docs' \ No newline at end of file diff --git a/.github/workflows/test-publish.yml b/.github/workflows/test-publish.yml new file mode 100644 index 00000000..ea76a213 --- /dev/null +++ b/.github/workflows/test-publish.yml @@ -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' diff --git a/flashduty/en/3. Configure Flashduty/3.7 Templates.md b/flashduty/en/3. Configure Flashduty/3.7 Templates.md index 2f27be34..271d426a 100644 --- a/flashduty/en/3. Configure Flashduty/3.7 Templates.md +++ b/flashduty/en/3. Configure Flashduty/3.7 Templates.md @@ -237,6 +237,8 @@ CloseTime | int64 | No | Close time, EndTime is alert recovery time, CloseTime i Below are specific instructions for each notification channel. +
+ ## 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: @@ -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}} ``` +
+ +
## Dingtalk App --- @@ -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}} ``` +
+ +
## WeCom App --- @@ -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** +
+ +
## Slack App --- @@ -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}} ``` +
+ +
## Zoom Bot --- @@ -500,6 +514,10 @@ If you want to display only key label information, you can refer to the code sni ] } ``` +
+ + +
## SMS --- @@ -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}} ``` +
+ +
## Email --- diff --git "a/flashduty/zh/3. \351\205\215\347\275\256Flashduty/3.7 \351\205\215\347\275\256\351\200\232\347\237\245\346\250\241\346\235\277.md" "b/flashduty/zh/3. \351\205\215\347\275\256Flashduty/3.7 \351\205\215\347\275\256\351\200\232\347\237\245\346\250\241\346\235\277.md" index b81a2cba..e88e98b1 100644 --- "a/flashduty/zh/3. \351\205\215\347\275\256Flashduty/3.7 \351\205\215\347\275\256\351\200\232\347\237\245\346\250\241\346\235\277.md" +++ "b/flashduty/zh/3. \351\205\215\347\275\256Flashduty/3.7 \351\205\215\347\275\256\351\200\232\347\237\245\346\250\241\346\235\277.md" @@ -239,6 +239,8 @@ CloseTime | int64 | 否 | 关闭时间,EndTime 为告警恢复时间,CloseTi 以下为各通知渠道具体说明。 +
+ ## 飞书应用 --- 您需要预先配置 `集成中心-即时消息-飞书` 集成,才能发送消息卡片。如果不设置自定义内容,将采用系统默认模板,渲染全部标签信息: @@ -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}} ``` +
- +
## 钉钉应用 --- @@ -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}} ``` +
+
## 企业微信应用 --- @@ -363,7 +368,9 @@ CloseTime | int64 | 否 | 关闭时间,EndTime 为告警恢复时间,CloseTi **注意,企业微信限制了卡片长度,在模板渲染区域,您最多可以渲染不超过 8 行内容,超过 8 行的部分将被隐藏** +
+
## Slack 应用 --- @@ -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}} ``` +
- +
## Microsoft Teams 应用 --- @@ -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}} ``` +
- - - - -## 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}} -``` - - -如下图所示: - -drawing - -如果您期望仅展示关键标签信息,可以参照下边的代码段: - -- 我们列出了一些常见标签,您可自行删减; -- 消息可以发送长度为 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}} -``` - - +
## 飞书机器人 --- @@ -727,8 +688,10 @@ msg_type 必填,值为 post 分派人员:{{range .Responders}}@{{.PersonName}} {{end}}{{end}}
详情:{{.DetailUrl}} ``` +
+
## 钉钉机器人 --- @@ -753,8 +716,9 @@ msg_type 必填,值为 post ---
[详情]({{.DetailUrl}})|[认领]({{.DetailUrl}}?ack=1) ``` +
- +
## 企业微信机器人 --- @@ -776,11 +740,13 @@ msg_type 必填,值为 post > 分派人员:{{range .Responders}}@{{.PersonName}} {{end}}{{end}}
[详情]({{.DetailUrl}})|[认领]({{.DetailUrl}}?ack=1) ``` +
- +
## Telegram 机器人 --- + - 配置国内能访问的Telegram服务地址; - 消息`最大长度为4096字符,超出后不发送`; - 如果文本中包含`
`,渲染时会`先删除空行,再将
替换为换行符`; @@ -800,8 +766,9 @@ msg_type 必填,值为 post
[详情]({{.DetailUrl}})|[认领]({{.DetailUrl}}?ack=1) ``` +
- +
## Slack 机器人 --- @@ -823,6 +790,9 @@ msg_type 必填,值为 post -----
<{{.DetailUrl}}|详情>|<{{.DetailUrl}}?ack=1|认领> ``` +
+ +
## Zoom 机器人 --- @@ -922,8 +892,10 @@ msg_type 必填,值为 post ] } ``` +
+
## 短信 --- @@ -932,8 +904,9 @@ msg_type 必填,值为 post ``` 您有故障待处理:{{toHtml .Title}},协作空间:{{.ChannelName}},等级:{{.IncidentSeverity}}{{if gt .AlertCnt 1}},共聚合{{.AlertCnt}}条告警{{end}} ``` +
- +
## 邮件 --- @@ -1028,4 +1001,4 @@ msg_type 必填,值为 post drawing - +
diff --git a/package.json b/package.json index 80e12fce..e45bcaa6 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/scripts/upload.mjs b/scripts/upload.mjs index e23bf8b9..032ccf7d 100644 --- a/scripts/upload.mjs +++ b/scripts/upload.mjs @@ -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, @@ -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); }