perf: 任务下所有步骤都跳过时,整个任务显示跳过

pull/229/head
xiaojunnuo 2024-10-16 12:19:34 +08:00
parent 7d9183d022
commit 84fd3b250d
1 changed files with 12 additions and 6 deletions

View File

@ -155,8 +155,8 @@ export class Executor {
for (const task of stage.tasks) { for (const task of stage.tasks) {
const runner = async () => { const runner = async () => {
return this.runWithHistory(task, "task", async () => { return this.runWithHistory(task, "task", async () => {
await this.runTask(task); const res = await this.runTask(task);
return ResultType.success; return res;
}); });
}; };
runnerList.push(runner); runnerList.push(runner);
@ -178,16 +178,22 @@ export class Executor {
return this.compositionResultType(resList); return this.compositionResultType(resList);
} }
compositionResultType(resList: ResultType[]) { compositionResultType(resList: ResultType[]): ResultType {
let hasSuccess = false; let hasSuccess = false;
let hasSkip = false;
for (const type of resList) { for (const type of resList) {
if (type === ResultType.error) { if (type === ResultType.error) {
return ResultType.error; return ResultType.error;
} } else if (type === ResultType.success) {
if (type === ResultType.success) {
hasSuccess = true; hasSuccess = true;
} else if (type === ResultType.skip) {
hasSkip = true;
} }
} }
if (!hasSuccess && hasSkip) {
//全是跳过
return ResultType.skip;
}
if (hasSuccess) { if (hasSuccess) {
return ResultType.success; return ResultType.success;
} }
@ -254,7 +260,7 @@ export class Executor {
let inputChanged = true; let inputChanged = true;
const lastInputHash = lastNode?.status?.inputHash; const lastInputHash = lastNode?.status?.inputHash;
if (lastInputHash && newInputHash && lastInputHash === newInputHash) { if (lastInputHash && newInputHash && lastInputHash === newInputHash) {
//参数有变化 //参数有变化
inputChanged = false; inputChanged = false;
} }
if (step.strategy?.runStrategy === RunStrategy.SkipWhenSucceed) { if (step.strategy?.runStrategy === RunStrategy.SkipWhenSucceed) {