diff --git a/packages/core/pipeline/package.json b/packages/core/pipeline/package.json
index 79882100..d5804cf4 100644
--- a/packages/core/pipeline/package.json
+++ b/packages/core/pipeline/package.json
@@ -20,7 +20,8 @@
"axios": "^1.4.0",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.3",
- "qs": "^6.11.2"
+ "qs": "^6.11.2",
+ "uuid": "^8.3.2"
},
"devDependencies": {
"@certd/acme-client": "^1.0.6",
@@ -33,6 +34,7 @@
"@types/lodash": "^4.14.194",
"@types/mocha": "^10.0.1",
"@types/node-forge": "^1.3.2",
+ "@types/uuid": "^9.0.2",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
"chai": "^4.3.7",
diff --git a/packages/core/pipeline/src/core/executor.ts b/packages/core/pipeline/src/core/executor.ts
index d1e2f7d5..7dcd8b4b 100644
--- a/packages/core/pipeline/src/core/executor.ts
+++ b/packages/core/pipeline/src/core/executor.ts
@@ -29,6 +29,7 @@ export class Executor {
logger: Logger;
pipelineContext!: IContext;
lastStatusMap!: RunnableCollection;
+ lastRuntime!: RunHistory;
options: ExecutorOptions;
onChanged: (history: RunHistory) => void;
constructor(options: ExecutorOptions) {
@@ -45,6 +46,7 @@ export class Executor {
async init() {
const lastRuntime = await this.pipelineContext.getObj(`lastRuntime`);
+ this.lastRuntime = lastRuntime;
this.lastStatusMap = new RunnableCollection(lastRuntime?.pipeline);
}
@@ -59,6 +61,9 @@ export class Executor {
await this.runWithHistory(this.pipeline, "pipeline", async () => {
await this.runStages(this.pipeline);
});
+ if (this.lastRuntime && this.lastRuntime.pipeline.status?.status === ResultType.error) {
+ await this.notification("turnToSuccess");
+ }
await this.notification("success");
} catch (e) {
await this.notification("error", e);
@@ -233,6 +238,9 @@ export class Executor {
} else if (when === "success") {
subject = `【CertD】执行成功,${this.pipeline.title}, buildId:${this.runtime.id}`;
content = subject;
+ } else if (when === "turnToSuccess") {
+ subject = `【CertD】执行成功(错误转成功),${this.pipeline.title}, buildId:${this.runtime.id}`;
+ content = subject;
} else if (when === "error") {
subject = `【CertD】执行失败,${this.pipeline.title}, buildId:${this.runtime.id}`;
content = `
${error.message}
`;
diff --git a/packages/core/pipeline/src/core/run-history.ts b/packages/core/pipeline/src/core/run-history.ts
index bd5796f5..855deffb 100644
--- a/packages/core/pipeline/src/core/run-history.ts
+++ b/packages/core/pipeline/src/core/run-history.ts
@@ -119,25 +119,25 @@ export class RunnableCollection {
this.collection = map;
}
- private each(list: T[], exec: (item: Runnable) => void) {
+ static each(list: T[], exec: (item: Runnable) => void) {
list.forEach((item) => {
exec(item);
if (item.runnableType === "pipeline") {
// @ts-ignore
- this.each(item.stages, exec);
+ RunnableCollection.each(item.stages, exec);
} else if (item.runnableType === "stage") {
// @ts-ignore
- this.each(item.tasks, exec);
+ RunnableCollection.each(item.tasks, exec);
} else if (item.runnableType === "task") {
// @ts-ignore
- this.each(item.steps, exec);
+ RunnableCollection.each(item.steps, exec);
}
});
}
- private toMap(pipeline: Pipeline) {
+ public toMap(pipeline: Pipeline) {
const map: RunnableMap = {};
- this.each(pipeline.stages, (item) => {
+ RunnableCollection.each(pipeline.stages, (item) => {
map[item.id] = item;
});
return map;
@@ -151,7 +151,7 @@ export class RunnableCollection {
if (!this.pipeline) {
return;
}
- this.each(this.pipeline.stages, (item) => {
+ RunnableCollection.each(this.pipeline.stages, (item) => {
item.status = undefined;
});
}
diff --git a/packages/core/pipeline/src/d.ts/pipeline.ts b/packages/core/pipeline/src/d.ts/pipeline.ts
index 29b2a250..56487290 100644
--- a/packages/core/pipeline/src/d.ts/pipeline.ts
+++ b/packages/core/pipeline/src/d.ts/pipeline.ts
@@ -56,6 +56,7 @@ export type Trigger = {
};
export type FileItem = {
+ id: string;
filename: string;
path: string;
};
@@ -68,13 +69,12 @@ export type Runnable = {
default?: {
[key: string]: any;
};
- files?: FileItem[];
};
export type EmailOptions = {
receivers: string[];
};
-export type NotificationWhen = "error" | "success" | "start";
+export type NotificationWhen = "error" | "success" | "turnToSuccess" | "start";
export type NotificationType = "email" | "url";
export type Notification = {
type: NotificationType;
diff --git a/packages/core/pipeline/src/plugin/api.ts b/packages/core/pipeline/src/plugin/api.ts
index 14d87dfc..9503a12d 100644
--- a/packages/core/pipeline/src/plugin/api.ts
+++ b/packages/core/pipeline/src/plugin/api.ts
@@ -6,7 +6,7 @@ import { IAccessService } from "../access";
import { IEmailService } from "../service";
import { IContext } from "../core";
import { AxiosInstance } from "axios";
-
+import { v4 as uuidv4 } from "uuid";
export enum ContextScope {
global,
pipeline,
@@ -81,6 +81,7 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
saveFile(filename: string, file: Buffer) {
const filePath = this.ctx.fileStore.writeFile(filename, file);
this._result.files!.push({
+ id: uuidv4(),
filename,
path: filePath,
});
diff --git a/packages/ui/certd-client/package.json b/packages/ui/certd-client/package.json
index 2a9d3364..f41f5af8 100644
--- a/packages/ui/certd-client/package.json
+++ b/packages/ui/certd-client/package.json
@@ -74,7 +74,7 @@
"@vue/compiler-sfc": "^3.2.45",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/test-utils": "^2.2.6",
- "autoprefixer": "^10.4.12",
+ "autoprefixer": "^10.4.14",
"caller-path": "^4.0.0",
"chai": "^4.3.7",
"eslint": "8.29.0",
@@ -89,7 +89,7 @@
"less": "^4.1.3",
"less-loader": "^11.0.0",
"lint-staged": "^13.1.0",
- "postcss": "^8.4.20",
+ "postcss": "^8.4.23",
"prettier": "2.8.1",
"pretty-quick": "^3.1.3",
"rimraf": "^3.0.2",
@@ -98,7 +98,7 @@
"stylelint": "^14.16.0",
"stylelint-config-prettier": "^9.0.4",
"stylelint-order": "^5.0.0",
- "tailwindcss": "^3.2.4",
+ "tailwindcss": "^3.3.2",
"ts-node": "^10.9.1",
"typescript": "4.9.4",
"vite": "^4.0.1",
diff --git a/packages/ui/certd-client/postcss.config.js b/packages/ui/certd-client/postcss.config.js
new file mode 100644
index 00000000..5cbc2c7d
--- /dev/null
+++ b/packages/ui/certd-client/postcss.config.js
@@ -0,0 +1,6 @@
+module.exports = {
+ plugins: {
+ tailwindcss: {},
+ autoprefixer: {}
+ }
+};
diff --git a/packages/ui/certd-client/src/App.vue b/packages/ui/certd-client/src/App.vue
index 5059cfa5..414d5081 100644
--- a/packages/ui/certd-client/src/App.vue
+++ b/packages/ui/certd-client/src/App.vue
@@ -11,9 +11,9 @@ import { provide, ref, nextTick } from "vue";
import { usePageStore } from "/src/store/modules/page";
import { useResourceStore } from "/src/store/modules/resource";
import { useSettingStore } from "/@/store/modules/settings";
-import 'dayjs/locale/zh-cn';
-import 'dayjs/locale/en';
-import dayjs from 'dayjs'
+import "dayjs/locale/zh-cn";
+import "dayjs/locale/en";
+import dayjs from "dayjs";
export default {
name: "App",
setup() {
@@ -29,13 +29,13 @@ export default {
console.log("locale changed:", value);
if (value === "zh-cn") {
locale.value = zhCN;
- dayjs.locale('zh-cn');
+ dayjs.locale("zh-cn");
} else if (value === "en") {
locale.value = enUS;
- dayjs.locale('en');
+ dayjs.locale("en");
}
}
- localeChanged('zh-cn')
+ localeChanged("zh-cn");
provide("fn:router.reload", reload);
provide("fn:locale.changed", localeChanged);
diff --git a/packages/ui/certd-client/src/api/tools.ts b/packages/ui/certd-client/src/api/tools.ts
index 0400bec9..d26c4f8c 100644
--- a/packages/ui/certd-client/src/api/tools.ts
+++ b/packages/ui/certd-client/src/api/tools.ts
@@ -53,7 +53,7 @@ export function errorLog(error: any) {
error.message = error?.response?.data?.message;
}
// 打印到控制台
- console.error(error);
+ console.error("errorLog", error);
// 显示提示
uiContext.get().notification.error({ message: error.message });
}
@@ -64,6 +64,7 @@ export function errorLog(error: any) {
*/
export function errorCreate(msg: string) {
const err = new Error(msg);
+ console.error("errorCreate", err);
uiContext.get().notification.error({ message: err.message });
throw err;
}
diff --git a/packages/ui/certd-client/src/layout/layout-framework.vue b/packages/ui/certd-client/src/layout/layout-framework.vue
index 24421cff..5c262874 100644
--- a/packages/ui/certd-client/src/layout/layout-framework.vue
+++ b/packages/ui/certd-client/src/layout/layout-framework.vue
@@ -1,4 +1,4 @@
-
+