refactor: pipeline edit view

This commit is contained in:
xiaojunnuo
2022-10-26 09:02:47 +08:00
parent af919c2f6e
commit 370a28c10e
48 changed files with 1606 additions and 3 deletions

View File

@@ -0,0 +1,10 @@
import { expect } from "chai";
import "mocha";
import { EchoPlugin } from "../src/plugin/plugins";
describe("task_plugin", function () {
it("#taskplugin", function () {
const define = EchoPlugin.define;
new EchoPlugin().execute({ context: {}, props: { test: 111 } });
expect(define.name).eq("EchoPlugin");
});
});

View File

@@ -0,0 +1,10 @@
import { IAccessService } from "../../src/access/access-service";
import { AbstractAccess, AliyunAccess } from "../../src";
import { aliyunSecret } from "../user.secret";
export class AccessServiceTest implements IAccessService {
getById(id: any): AbstractAccess {
return {
...aliyunSecret,
} as AliyunAccess;
}
}

View File

@@ -0,0 +1,62 @@
import { ConcurrencyStrategy, NextStrategy, Pipeline } from "../../src";
let idIndex = 0;
function generateId() {
idIndex++;
return idIndex + "";
}
export const pipeline: Pipeline = {
version: 1,
id: generateId(),
title: "测试管道",
triggers: [],
stages: [
{
id: generateId(),
title: "证书申请阶段",
concurrency: ConcurrencyStrategy.Serial,
next: NextStrategy.AllSuccess,
tasks: [
{
id: generateId(),
title: "申请证书任务",
steps: [
{
id: generateId(),
title: "申请证书",
type: "CertApply",
input: {
domains: ["*.docmirror.cn"],
email: "xiaojunnuo@qq.com",
dnsProviderType: "aliyun",
accessId: "111",
},
},
],
},
],
},
{
id: generateId(),
title: "证书部署阶段",
concurrency: ConcurrencyStrategy.Serial,
next: NextStrategy.AllSuccess,
tasks: [
{
id: generateId(),
title: "测试输出参数",
steps: [
{
id: generateId(),
title: "输出参数",
type: "EchoPlugin",
input: {
cert: "cert",
},
},
],
},
],
},
],
};

View File

@@ -0,0 +1,18 @@
import { expect } from "chai";
import "mocha";
import { Executor, RunHistory } from "../../src";
import { pipeline } from "./pipeline.define";
import { AccessServiceTest } from "./access-service-test";
import { FileStorage } from "../../src/core/storage";
describe("pipeline", function () {
it("#pipeline", async function () {
this.timeout(120000);
function onChanged(history: RunHistory) {
console.log("changed:");
}
const executor = new Executor({ userId: 1, pipeline, onChanged, accessService: new AccessServiceTest(), storage: new FileStorage() });
await executor.run();
// expect(define.name).eq("EchoPlugin");
});
});