From a560999d13eed18d08dd32ee530166569e3f8746 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Sat, 17 May 2025 01:13:36 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E9=92=89=E9=92=89?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=A0=87=E9=A2=98=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/pipeline/src/core/executor.ts | 4 ++-- .../src/plugins/plugin-notification/dingtalk/index.ts | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/core/pipeline/src/core/executor.ts b/packages/core/pipeline/src/core/executor.ts index a009ca39..dd6d23d2 100644 --- a/packages/core/pipeline/src/core/executor.ts +++ b/packages/core/pipeline/src/core/executor.ts @@ -218,7 +218,7 @@ export class Executor { returnType: ResultType.error, runnable: t, }); - errorMessage += `任务${t.title}执行失败,错误详情:${e.message};`; + errorMessage += `任务${t.title}执行失败,错误详情:${e.message};`; } } if (errorList.length > 0) { @@ -438,7 +438,7 @@ export class Executor { const runnableError = error as RunnableError; content = `流水线ID:${this.pipeline.id},运行ID:${this.runtime.id}\n\n`; for (const re of runnableError.errors) { - content += ` - ${re.runnable.title} 执行失败,错误详情:${re.e?.error?.message}\n\n`; + content += ` - ${re.runnable.title} 执行失败,错误详情:${re.e?.error?.message}\n\n`; } } else { content = `流水线ID:${this.pipeline.id},运行ID:${this.runtime.id}\n\n${this.currentStatusMap?.currentStep?.title} 执行失败\n\n错误详情:${error.message}`; diff --git a/packages/ui/certd-server/src/plugins/plugin-notification/dingtalk/index.ts b/packages/ui/certd-server/src/plugins/plugin-notification/dingtalk/index.ts index e97e19ae..e875f1bd 100644 --- a/packages/ui/certd-server/src/plugins/plugin-notification/dingtalk/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-notification/dingtalk/index.ts @@ -125,15 +125,17 @@ export class DingTalkNotification extends BaseNotification { at.isAtAll = true; } + const color = body.errorMessage?'red':'green'; const res = await this.http.request({ url: webhook, method: 'POST', data: { at: at, - text: { - content: `${body.title}\n${body.content}\n查看详情: ${body.url}`, + markdown: { + title: body.title, + text: `${body.title}\n\n\n ${body.content}\n\n\n[查看详情](${body.url})`, }, - msgtype:"text" + msgtype:"markdown" }, }); if(res.errcode>100){