@catladder/cli 0.0.0-next-e7541a00 → 0.0.0-next-4e7c6848
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/catenv/index.js +626 -15
- package/dist/bundles/cli/index.js +628 -16
- package/dist/cli/src/apps/catenv/catenv.js +1 -2
- package/dist/cli/src/apps/catenv/catenv.js.map +1 -1
- package/dist/pipeline/src/backends/github/GithubBackend.d.ts +12 -0
- package/dist/pipeline/src/backends/github/GithubBackend.js +170 -0
- package/dist/pipeline/src/backends/github/GithubBackend.js.map +1 -0
- package/dist/pipeline/src/backends/github/ciVariables.d.ts +14 -0
- package/dist/pipeline/src/backends/github/ciVariables.js +31 -0
- package/dist/pipeline/src/backends/github/ciVariables.js.map +1 -0
- package/dist/pipeline/src/backends/github/createGithubJobs.d.ts +17 -0
- package/dist/pipeline/src/backends/github/createGithubJobs.js +208 -0
- package/dist/pipeline/src/backends/github/createGithubJobs.js.map +1 -0
- package/dist/pipeline/src/backends/github/githubReleaseJobs.d.ts +15 -0
- package/dist/pipeline/src/backends/github/githubReleaseJobs.js +65 -0
- package/dist/pipeline/src/backends/github/githubReleaseJobs.js.map +1 -0
- package/dist/pipeline/src/backends/github/index.d.ts +2 -0
- package/dist/pipeline/src/backends/github/index.js +26 -0
- package/dist/pipeline/src/backends/github/index.js.map +1 -0
- package/dist/pipeline/src/backends/github/scriptFunctions.d.ts +6 -0
- package/dist/pipeline/src/backends/github/scriptFunctions.js +30 -0
- package/dist/pipeline/src/backends/github/scriptFunctions.js.map +1 -0
- package/dist/pipeline/src/backends/gitlab/GitlabBackend.d.ts +1 -0
- package/dist/pipeline/src/backends/gitlab/GitlabBackend.js +7 -0
- package/dist/pipeline/src/backends/gitlab/GitlabBackend.js.map +1 -1
- package/dist/pipeline/src/backends/index.d.ts +8 -2
- package/dist/pipeline/src/backends/index.js +25 -3
- package/dist/pipeline/src/backends/index.js.map +1 -1
- package/dist/pipeline/src/backends/types.d.ts +7 -3
- package/dist/pipeline/src/bash/ciVariables.js +4 -2
- package/dist/pipeline/src/bash/ciVariables.js.map +1 -1
- package/dist/pipeline/src/constants.js +1 -1
- package/dist/pipeline/src/context/getReviewSlug.js +3 -1
- package/dist/pipeline/src/context/getReviewSlug.js.map +1 -1
- package/dist/pipeline/src/pipeline/generatePipelineFiles.d.ts +6 -1
- package/dist/pipeline/src/pipeline/generatePipelineFiles.js +14 -7
- package/dist/pipeline/src/pipeline/generatePipelineFiles.js.map +1 -1
- package/dist/pipeline/src/types/config.d.ts +20 -0
- package/dist/pipeline/src/types/github-types.d.ts +47 -0
- package/dist/pipeline/src/types/github-types.js +9 -0
- package/dist/pipeline/src/types/github-types.js.map +1 -0
- package/dist/pipeline/src/types/pipeline.d.ts +4 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/catenv/catenv.ts +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getGithubScriptFunctionDefinitions = void 0;
|
|
7
|
+
const globalScriptFunctions_1 = require("../../globalScriptFunctions");
|
|
8
|
+
/**
|
|
9
|
+
* github variants of the global script functions where the gitlab
|
|
10
|
+
* implementation uses gitlab-specific mechanics (e.g. collapsible log
|
|
11
|
+
* sections use gitlab's `section_start` escape codes, github uses
|
|
12
|
+
* `::group::` workflow commands). All other functions are plain bash
|
|
13
|
+
* and shared as-is.
|
|
14
|
+
*/
|
|
15
|
+
const GITHUB_FUNCTION_OVERRIDES = {
|
|
16
|
+
collapseable_section_start: `local section_title="\${1}"
|
|
17
|
+
local section_description="\${2:-$section_title}"
|
|
18
|
+
echo "::group::\${section_description}"`,
|
|
19
|
+
collapseable_section_end: `echo "::endgroup::"`
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* the bash function definitions to prepend to every job script.
|
|
23
|
+
* github has no pipeline-wide before_script like gitlab, so each job
|
|
24
|
+
* carries its own definitions.
|
|
25
|
+
*/
|
|
26
|
+
const getGithubScriptFunctionDefinitions = () => [...globalScriptFunctions_1.globalScriptFunctions.values()].map(fn => {
|
|
27
|
+
const override = GITHUB_FUNCTION_OVERRIDES[fn.name];
|
|
28
|
+
return override ? `function ${fn.name} () {\n${override.trim()}\n}` : fn.toBashFunction();
|
|
29
|
+
});
|
|
30
|
+
exports.getGithubScriptFunctionDefinitions = getGithubScriptFunctionDefinitions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scriptFunctions.js","sourceRoot":"","sources":["../../../../../../pipeline/src/backends/github/scriptFunctions.ts"],"names":[],"mappings":";;;AAAA,uEAAoE;AAEpE;;;;;;GAMG;AACH,MAAM,yBAAyB,GAA2B;IACxD,0BAA0B,EAAE;;0CAEY;IACxC,wBAAwB,EAAE,qBAAqB;CAChD,CAAC;AAEF;;;;GAIG;AACI,MAAM,kCAAkC,GAAG,GAAa,EAAE,CAC/D,CAAC,GAAG,6CAAqB,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;IAC7C,MAAM,QAAQ,GAAG,yBAAyB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACpD,OAAO,QAAQ;QACb,CAAC,CAAC,YAAY,EAAE,CAAC,IAAI,UAAU,QAAQ,CAAC,IAAI,EAAE,KAAK;QACnD,CAAC,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC;AAC1B,CAAC,CAAC,CAAC;AANQ,QAAA,kCAAkC,sCAM1C"}
|
|
@@ -3,6 +3,7 @@ import type { PipelineBackend, PipelineFile } from "../types";
|
|
|
3
3
|
export declare class GitlabBackend implements PipelineBackend {
|
|
4
4
|
readonly type: "gitlab";
|
|
5
5
|
readonly generatedFolder: string;
|
|
6
|
+
cleanup(): Promise<void>;
|
|
6
7
|
createFiles(config: Config): Promise<PipelineFile[]>;
|
|
7
8
|
/**
|
|
8
9
|
* the complete pipeline as one object (all includes merged into one),
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.GitlabBackend = void 0;
|
|
7
|
+
const promises_1 = require("fs/promises");
|
|
7
8
|
const rules_1 = require("../../rules");
|
|
8
9
|
const config_1 = require("../../types/config");
|
|
9
10
|
const createAllJobs_1 = require("../../pipeline/createAllJobs");
|
|
@@ -19,6 +20,12 @@ class GitlabBackend {
|
|
|
19
20
|
this.type = "gitlab";
|
|
20
21
|
this.generatedFolder = GITLAB_GENERATED_FOLDER;
|
|
21
22
|
}
|
|
23
|
+
async cleanup() {
|
|
24
|
+
await (0, promises_1.rm)(this.generatedFolder, {
|
|
25
|
+
force: true,
|
|
26
|
+
recursive: true
|
|
27
|
+
});
|
|
28
|
+
}
|
|
22
29
|
async createFiles(config) {
|
|
23
30
|
const includes = await this.createIncludes(config);
|
|
24
31
|
const mainFile = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitlabBackend.js","sourceRoot":"","sources":["../../../../../../pipeline/src/backends/gitlab/GitlabBackend.ts"],"names":[],"mappings":";;;AAAA,uCAKqB;AAUrB,+CAA2D;AAC3D,gEAA6D;AAG7D,yDAAsD;AACtD,iEAA0E;AAC1E,2DAA2D;AAC3D,2DAAwD;AACxD,mEAAgE;AAEhE,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAE1D,MAAM,uBAAuB,GAAG,0BAA0B,GAAG,SAAS,CAAC;AAEvE,MAAa,aAAa;IAA1B;QACW,SAAI,GAAG,QAAiB,CAAC;QAEzB,oBAAe,GAAG,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"GitlabBackend.js","sourceRoot":"","sources":["../../../../../../pipeline/src/backends/gitlab/GitlabBackend.ts"],"names":[],"mappings":";;;AAAA,0CAAiC;AACjC,uCAKqB;AAUrB,+CAA2D;AAC3D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K,mCAAI,EAAE,CAAC;iBAC3B,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;YACrC,CAAC;YAED,OAAO,GAAG,CAAC;QACb,CAAC,EACD,EAA6C,CAC9C,CAAC;QAEF,OAAO,IAAA,uDAAgC,EAAC;YACtC,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,SAAS,CAAC;YAC9B,IAAI,EAAE;gBACJ,GAAG,OAAO;gBACV,GAAG,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,OAAO,CAAC,IAAA,wCAAoB,EAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAC9C,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC;oBACrB,IAAI;oBACJ;wBACE,SAAS;wBACT,OAAO,EAAE,IAAI;qBACd;iBACF,CACF,CACF;aACF;YACD,SAAS,EAAE,MAAM,CAAC,eAAe;SAClC,CAAC,CAAC;IACL,CAAC;CACF;AA1KD,sCA0KC;AAED,SAAS,wBAAwB,CAAC,OAAwB;IACxD,kEAAkE;IAClE,uBAAuB;IACvB,wBAAwB;IACxB,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,YAAY;YACf,OAAO;gBACL,mCAA2B;gBAC3B,kDAA0C;aAC3C,CAAC;QACJ,KAAK,IAAI;YACP,OAAO,CAAC,mCAA2B,EAAE,6BAAqB,CAAC,CAAC;QAC9D,KAAK,eAAe;YAClB,OAAO,CAAC,mCAA2B,EAAE,8BAAsB,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,mBAAmB,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { PipelineType } from "../types";
|
|
1
|
+
import type { Config, PipelineType } from "../types";
|
|
2
2
|
import type { PipelineBackend } from "./types";
|
|
3
3
|
export * from "./types";
|
|
4
4
|
export * from "./gitlab";
|
|
5
|
-
export
|
|
5
|
+
export * from "./github";
|
|
6
|
+
export declare const getPipelineBackend: (type: PipelineType) => PipelineBackend;
|
|
7
|
+
/**
|
|
8
|
+
* the pipeline types enabled for this config. Multiple types can be
|
|
9
|
+
* enabled at once (parallel generation, e.g. during a CI migration).
|
|
10
|
+
*/
|
|
11
|
+
export declare const getEnabledPipelineTypes: (config: Config) => PipelineType[];
|
|
@@ -22,12 +22,15 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", {
|
|
23
23
|
value: true
|
|
24
24
|
});
|
|
25
|
-
exports.getPipelineBackend = void 0;
|
|
25
|
+
exports.getEnabledPipelineTypes = exports.getPipelineBackend = void 0;
|
|
26
|
+
const github_1 = require("./github");
|
|
26
27
|
const gitlab_1 = require("./gitlab");
|
|
27
28
|
__exportStar(require("./types"), exports);
|
|
28
29
|
__exportStar(require("./gitlab"), exports);
|
|
30
|
+
__exportStar(require("./github"), exports);
|
|
29
31
|
const BACKENDS = {
|
|
30
|
-
gitlab: () => new gitlab_1.GitlabBackend()
|
|
32
|
+
gitlab: () => new gitlab_1.GitlabBackend(),
|
|
33
|
+
github: () => new github_1.GithubBackend()
|
|
31
34
|
};
|
|
32
35
|
const getPipelineBackend = type => {
|
|
33
36
|
const createBackend = BACKENDS[type];
|
|
@@ -36,4 +39,23 @@ const getPipelineBackend = type => {
|
|
|
36
39
|
}
|
|
37
40
|
return createBackend();
|
|
38
41
|
};
|
|
39
|
-
exports.getPipelineBackend = getPipelineBackend;
|
|
42
|
+
exports.getPipelineBackend = getPipelineBackend;
|
|
43
|
+
/**
|
|
44
|
+
* the pipeline types enabled for this config. Multiple types can be
|
|
45
|
+
* enabled at once (parallel generation, e.g. during a CI migration).
|
|
46
|
+
*/
|
|
47
|
+
const getEnabledPipelineTypes = config => {
|
|
48
|
+
var _a;
|
|
49
|
+
if (config.pipelines) {
|
|
50
|
+
const enabled = Object.keys(BACKENDS).filter(type => {
|
|
51
|
+
var _a;
|
|
52
|
+
return (_a = config.pipelines) === null || _a === void 0 ? void 0 : _a[type];
|
|
53
|
+
});
|
|
54
|
+
if (enabled.length === 0) {
|
|
55
|
+
throw new Error("`pipelines` is configured, but no pipeline type is enabled");
|
|
56
|
+
}
|
|
57
|
+
return enabled;
|
|
58
|
+
}
|
|
59
|
+
return [(_a = config.pipelineType) !== null && _a !== void 0 ? _a : "gitlab"];
|
|
60
|
+
};
|
|
61
|
+
exports.getEnabledPipelineTypes = getEnabledPipelineTypes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../pipeline/src/backends/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,qCAAyC;AAGzC,0CAAwB;AACxB,2CAAyB;AAEzB,MAAM,QAAQ,GAAmD;IAC/D,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,sBAAa,EAAE;CAClC,CAAC;AAEK,MAAM,kBAAkB,GAAG,CAAC,IAAkB,EAAmB,EAAE;IACxE,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,aAAa,EAAE,CAAC;AACzB,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../pipeline/src/backends/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,qCAAyC;AACzC,qCAAyC;AAGzC,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AAEzB,MAAM,QAAQ,GAAmD;IAC/D,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,sBAAa,EAAE;IACjC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,sBAAa,EAAE;CAClC,CAAC;AAEK,MAAM,kBAAkB,GAAG,CAAC,IAAkB,EAAmB,EAAE;IACxE,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,aAAa,EAAE,CAAC;AACzB,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B;AAEF;;;GAGG;AACI,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAkB,EAAE;;IACxE,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,MAAM,OAAO,GAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAoB,CAAC,MAAM,CAC9D,CAAC,IAAI,EAAE,EAAE,WAAC,OAAA,MAAA,MAAM,CAAC,SAAS,0CAAG,IAAI,CAAC,CAAA,EAAA,CACnC,CAAC;QACF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,4DAA4D,CAC7D,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,CAAC,MAAA,MAAM,CAAC,YAAY,mCAAI,QAAQ,CAAC,CAAC;AAC3C,CAAC,CAAC;AAbW,QAAA,uBAAuB,2BAalC"}
|
|
@@ -18,10 +18,14 @@ export type PipelineFile = {
|
|
|
18
18
|
export interface PipelineBackend {
|
|
19
19
|
readonly type: PipelineType;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* removes previously generated files of this backend.
|
|
22
|
+
* Called before the files are written.
|
|
23
|
+
*
|
|
24
|
+
* Backends must only remove files they own (e.g. the github backend
|
|
25
|
+
* shares `.github/workflows` with user-maintained workflows and only
|
|
26
|
+
* removes its own, prefixed files).
|
|
23
27
|
*/
|
|
24
|
-
|
|
28
|
+
cleanup(): Promise<void>;
|
|
25
29
|
/**
|
|
26
30
|
* create all pipeline files for this backend.
|
|
27
31
|
* Paths are relative to the repository root.
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getCiVariable = void 0;
|
|
7
|
-
const ciVariables_1 = require("../backends/
|
|
7
|
+
const ciVariables_1 = require("../backends/github/ciVariables");
|
|
8
|
+
const ciVariables_2 = require("../backends/gitlab/ciVariables");
|
|
8
9
|
const BashExpression_1 = require("./BashExpression");
|
|
9
10
|
const CI_VARIABLES_PER_PIPELINE_TYPE = {
|
|
10
|
-
gitlab:
|
|
11
|
+
gitlab: ciVariables_2.GITLAB_CI_VARIABLES,
|
|
12
|
+
github: ciVariables_1.GITHUB_CI_VARIABLES
|
|
11
13
|
};
|
|
12
14
|
/**
|
|
13
15
|
* resolves a platform-neutral CI variable to a bash expression for the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ciVariables.js","sourceRoot":"","sources":["../../../../../pipeline/src/bash/ciVariables.ts"],"names":[],"mappings":";;;AAAA,gEAAqE;AAErE,qDAAkD;AAelD,MAAM,8BAA8B,GAEhC;IACF,MAAM,EAAE,iCAAmB;CAC5B,CAAC;AAEF;;;GAGG;AACI,MAAM,aAAa,GAAG,CAC3B,OAAwC,EACxC,IAAoB,EACJ,EAAE;;IAClB,sEAAsE;IACtE,qEAAqE;IACrE,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,YAAY,mCAAI,QAAQ,CAAC;IACtD,OAAO,IAAI,+BAAc,CACvB,IAAI,8BAA8B,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,EAAE,CACzD,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB"}
|
|
1
|
+
{"version":3,"file":"ciVariables.js","sourceRoot":"","sources":["../../../../../pipeline/src/bash/ciVariables.ts"],"names":[],"mappings":";;;AAAA,gEAAqE;AACrE,gEAAqE;AAErE,qDAAkD;AAelD,MAAM,8BAA8B,GAEhC;IACF,MAAM,EAAE,iCAAmB;IAC3B,MAAM,EAAE,iCAAmB;CAC5B,CAAC;AAEF;;;GAGG;AACI,MAAM,aAAa,GAAG,CAC3B,OAAwC,EACxC,IAAoB,EACJ,EAAE;;IAClB,sEAAsE;IACtE,qEAAqE;IACrE,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,YAAY,mCAAI,QAAQ,CAAC;IACtD,OAAO,IAAI,+BAAc,CACvB,IAAI,8BAA8B,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,EAAE,CACzD,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB"}
|
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
7
|
-
exports.PIPELINE_IMAGE_TAG = "next-
|
|
7
|
+
exports.PIPELINE_IMAGE_TAG = "next-4e7c6848" || "latest";
|
|
8
8
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
|
|
@@ -9,7 +9,9 @@ const bashExpressionPerPipelineType_1 = require("../bash/bashExpressionPerPipeli
|
|
|
9
9
|
const getEnvType_1 = require("./getEnvType");
|
|
10
10
|
const REVIEW_SLUG = {
|
|
11
11
|
default: "unknown-review-slug",
|
|
12
|
-
gitlab: new BashExpression_1.BashExpression(`$([ -n "$CI_MERGE_REQUEST_IID" ] && echo "mr$CI_MERGE_REQUEST_IID" || { [ -n "$CI_COMMIT_REF_SLUG" ] && echo "$CI_COMMIT_REF_SLUG" || echo "unknown"; })`)
|
|
12
|
+
gitlab: new BashExpression_1.BashExpression(`$([ -n "$CI_MERGE_REQUEST_IID" ] && echo "mr$CI_MERGE_REQUEST_IID" || { [ -n "$CI_COMMIT_REF_SLUG" ] && echo "$CI_COMMIT_REF_SLUG" || echo "unknown"; })`),
|
|
13
|
+
// CL_PR_NUMBER is injected by the github backend at the workflow level
|
|
14
|
+
github: new BashExpression_1.BashExpression(`$([ -n "$CL_PR_NUMBER" ] && echo "pr$CL_PR_NUMBER" || echo "unknown")`)
|
|
13
15
|
};
|
|
14
16
|
const getReviewSlug = (envConfig, env, pipelineType) => {
|
|
15
17
|
const envType = (0, getEnvType_1.getEnvType)(env, envConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getReviewSlug.js","sourceRoot":"","sources":["../../../../../pipeline/src/context/getReviewSlug.ts"],"names":[],"mappings":";;;AAAA,2DAGgC;AAEhC,yFAAyF;AAGzF,6CAA0C;AAC1C,MAAM,WAAW,GAAkC;IACjD,OAAO,EAAE,qBAAqB;IAC9B,MAAM,EAAE,IAAI,+BAAc,CACxB,0JAA0J,CAC3J;CACF,CAAC;AAEK,MAAM,aAAa,GAAG,CAC3B,SAAiC,EACjC,GAAW,EACX,YAA2B,EACI,EAAE;IACjC,MAAM,OAAO,GAAG,IAAA,uBAAU,EAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC3C,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzB,OAAO,IAAA,gEAAgC,EAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,oBAAoB;AACnC,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB"}
|
|
1
|
+
{"version":3,"file":"getReviewSlug.js","sourceRoot":"","sources":["../../../../../pipeline/src/context/getReviewSlug.ts"],"names":[],"mappings":";;;AAAA,2DAGgC;AAEhC,yFAAyF;AAGzF,6CAA0C;AAC1C,MAAM,WAAW,GAAkC;IACjD,OAAO,EAAE,qBAAqB;IAC9B,MAAM,EAAE,IAAI,+BAAc,CACxB,0JAA0J,CAC3J;IACD,uEAAuE;IACvE,MAAM,EAAE,IAAI,+BAAc,CACxB,uEAAuE,CACxE;CACF,CAAC;AAEK,MAAM,aAAa,GAAG,CAC3B,SAAiC,EACjC,GAAW,EACX,YAA2B,EACI,EAAE;IACjC,MAAM,OAAO,GAAG,IAAA,uBAAU,EAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC3C,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzB,OAAO,IAAA,gEAAgC,EAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,oBAAoB;AACnC,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Config, PipelineType } from "../types";
|
|
2
2
|
import type { CatenvContext } from "../catenv";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* generates the pipeline files of all pipeline types enabled in the
|
|
5
|
+
* config (see `pipelines`). Pass an explicit `pipelineType` to generate
|
|
6
|
+
* only that one.
|
|
7
|
+
*/
|
|
8
|
+
export declare function generatePipelineFiles(context: CatenvContext, pipelineType?: PipelineType): Promise<void>;
|
|
4
9
|
/**
|
|
5
10
|
*
|
|
6
11
|
* for testing purposes
|
|
@@ -8,14 +8,22 @@ const promises_1 = require("fs/promises");
|
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const backends_1 = require("../backends");
|
|
10
10
|
const gitlab_1 = require("../backends/gitlab");
|
|
11
|
+
/**
|
|
12
|
+
* generates the pipeline files of all pipeline types enabled in the
|
|
13
|
+
* config (see `pipelines`). Pass an explicit `pipelineType` to generate
|
|
14
|
+
* only that one.
|
|
15
|
+
*/
|
|
11
16
|
async function generatePipelineFiles(context, pipelineType) {
|
|
12
|
-
const
|
|
17
|
+
const pipelineTypes = pipelineType ? [pipelineType] : (0, backends_1.getEnabledPipelineTypes)(context.config);
|
|
18
|
+
for (const type of pipelineTypes) {
|
|
19
|
+
await generatePipelineFilesForBackend(context, (0, backends_1.getPipelineBackend)(type));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.generatePipelineFiles = generatePipelineFiles;
|
|
23
|
+
async function generatePipelineFilesForBackend(context, backend) {
|
|
13
24
|
const files = await backend.createFiles(context.config);
|
|
14
|
-
// first clean up
|
|
15
|
-
await (
|
|
16
|
-
force: true,
|
|
17
|
-
recursive: true
|
|
18
|
-
});
|
|
25
|
+
// first clean up previously generated files
|
|
26
|
+
await backend.cleanup();
|
|
19
27
|
// write files
|
|
20
28
|
await Promise.all(files.map(async ({
|
|
21
29
|
path,
|
|
@@ -27,7 +35,6 @@ async function generatePipelineFiles(context, pipelineType) {
|
|
|
27
35
|
await context.fileWriter.writeYamlfile(path, content);
|
|
28
36
|
}));
|
|
29
37
|
}
|
|
30
|
-
exports.generatePipelineFiles = generatePipelineFiles;
|
|
31
38
|
/**
|
|
32
39
|
*
|
|
33
40
|
* for testing purposes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatePipelineFiles.js","sourceRoot":"","sources":["../../../../../pipeline/src/pipeline/generatePipelineFiles.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"generatePipelineFiles.js","sourceRoot":"","sources":["../../../../../pipeline/src/pipeline/generatePipelineFiles.ts"],"names":[],"mappings":";;;AAAA,0CAAoC;AACpC,+BAA+B;AAI/B,0CAA0E;AAC1E,+CAAmD;AAGnD;;;;GAIG;AACI,KAAK,UAAU,qBAAqB,CACzC,OAAsB,EACtB,YAA2B;IAE3B,MAAM,aAAa,GAAG,YAAY;QAChC,CAAC,CAAC,CAAC,YAAY,CAAC;QAChB,CAAC,CAAC,IAAA,kCAAuB,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5C,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,MAAM,+BAA+B,CAAC,OAAO,EAAE,IAAA,6BAAkB,EAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC;AAXD,sDAWC;AAED,KAAK,UAAU,+BAA+B,CAC5C,OAAsB,EACtB,OAAwB;IAExB,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAExD,4CAA4C;IAC5C,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IACxB,cAAc;IACd,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,MAAM,IAAA,gBAAK,EAAC,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,MAAM,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,yBAAyB,CAAC,MAAc;IAC5D,OAAO,IAAI,sBAAa,EAAE,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;AAC5D,CAAC;AAFD,8DAEC"}
|
|
@@ -152,11 +152,31 @@ export type ComponentConfig<C extends ConfigProps = never> = {
|
|
|
152
152
|
export type ConfigProps = {
|
|
153
153
|
CustomEnvs: string;
|
|
154
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* per-pipeline-type options. Currently empty, but gives per-backend
|
|
157
|
+
* settings a home (e.g. output folder, workflow naming) later.
|
|
158
|
+
*/
|
|
159
|
+
export type PipelineOutputOptions = Record<string, never>;
|
|
155
160
|
export type Config<C extends ConfigProps = never> = {
|
|
156
161
|
/**
|
|
157
162
|
* the pipeline type to generate, defaults to gitlab
|
|
163
|
+
*
|
|
164
|
+
* @deprecated use `pipelines` instead
|
|
158
165
|
*/
|
|
159
166
|
pipelineType?: PipelineType;
|
|
167
|
+
/**
|
|
168
|
+
* which pipelines to generate. Multiple pipeline types can be enabled
|
|
169
|
+
* at the same time (e.g. during a step-by-step migration from one CI
|
|
170
|
+
* system to another); each generates its own set of files.
|
|
171
|
+
*
|
|
172
|
+
* Defaults to `{ gitlab: true }` (or the deprecated `pipelineType`).
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* pipelines: {
|
|
176
|
+
* gitlab: true,
|
|
177
|
+
* }
|
|
178
|
+
*/
|
|
179
|
+
pipelines?: { [T in PipelineType]?: boolean | PipelineOutputOptions };
|
|
160
180
|
/**
|
|
161
181
|
* name of the customer or group
|
|
162
182
|
*/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* minimal model of the github actions workflow yaml,
|
|
3
|
+
* see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
|
|
4
|
+
*/
|
|
5
|
+
export type GithubStep = {
|
|
6
|
+
name?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
uses?: string;
|
|
9
|
+
run?: string;
|
|
10
|
+
with?: Record<string, unknown>;
|
|
11
|
+
env?: Record<string, string>;
|
|
12
|
+
if?: string;
|
|
13
|
+
shell?: string;
|
|
14
|
+
};
|
|
15
|
+
export type GithubService = {
|
|
16
|
+
image: string;
|
|
17
|
+
env?: Record<string, string>;
|
|
18
|
+
ports?: string[];
|
|
19
|
+
options?: string;
|
|
20
|
+
};
|
|
21
|
+
export type GithubJob = {
|
|
22
|
+
name?: string;
|
|
23
|
+
"runs-on": string;
|
|
24
|
+
needs?: string[];
|
|
25
|
+
container?: {
|
|
26
|
+
image: string;
|
|
27
|
+
} | string;
|
|
28
|
+
services?: Record<string, GithubService>;
|
|
29
|
+
environment?: {
|
|
30
|
+
name: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
} | string;
|
|
33
|
+
env?: Record<string, string>;
|
|
34
|
+
permissions?: Record<string, string>;
|
|
35
|
+
if?: string;
|
|
36
|
+
steps: GithubStep[];
|
|
37
|
+
};
|
|
38
|
+
export type GithubWorkflow = {
|
|
39
|
+
name: string;
|
|
40
|
+
on: Record<string, unknown>;
|
|
41
|
+
concurrency?: {
|
|
42
|
+
group: string;
|
|
43
|
+
"cancel-in-progress"?: boolean;
|
|
44
|
+
};
|
|
45
|
+
env?: Record<string, string>;
|
|
46
|
+
jobs: Record<string, GithubJob>;
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-types.js","sourceRoot":"","sources":["../../../../../pipeline/src/types/github-types.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { GithubJob, GithubWorkflow } from "./github-types";
|
|
1
2
|
import type { GitlabJobDef, GitlabPipeline } from "./gitlab-types";
|
|
2
|
-
export type PipelineType = "gitlab";
|
|
3
|
-
export type PipelineJob<T extends PipelineType> = T extends "gitlab" ? GitlabJobDef : never;
|
|
4
|
-
export type Pipeline<T extends PipelineType> = T extends "gitlab" ? GitlabPipeline : never;
|
|
3
|
+
export type PipelineType = "gitlab" | "github";
|
|
4
|
+
export type PipelineJob<T extends PipelineType> = T extends "gitlab" ? GitlabJobDef : T extends "github" ? GithubJob : never;
|
|
5
|
+
export type Pipeline<T extends PipelineType> = T extends "gitlab" ? GitlabPipeline : T extends "github" ? Record<string, GithubWorkflow> : never;
|