@catladder/cli 5.6.0 → 5.7.1
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/apps/cli/src/catci.js +22 -0
- package/dist/apps/cli/src/catci.js.map +1 -1
- package/dist/apps/cli/src/commands/index.d.ts +1 -0
- package/dist/apps/cli/src/commands/index.js +4 -1
- package/dist/apps/cli/src/commands/index.js.map +1 -1
- package/dist/apps/cli/src/commands/project/commandMrPin.d.ts +9 -0
- package/dist/apps/cli/src/commands/project/commandMrPin.js +11 -13
- package/dist/apps/cli/src/commands/project/commandMrPin.js.map +1 -1
- package/dist/apps/cli/src/commands/project/commandMrReviewApp.d.ts +21 -0
- package/dist/apps/cli/src/commands/project/commandMrReviewApp.js +102 -0
- package/dist/apps/cli/src/commands/project/commandMrReviewApp.js.map +1 -0
- package/dist/apps/cli/src/reviewApps/github.d.ts +10 -0
- package/dist/apps/cli/src/reviewApps/github.js +240 -0
- package/dist/apps/cli/src/reviewApps/github.js.map +1 -0
- package/dist/bundles/catci/index.js +5 -5
- package/dist/bundles/catenv/index.js +897 -25
- package/dist/bundles/cli/index.js +1021 -39
- package/dist/bundles/skills/catladder-cli/references/commands.md +13 -0
- package/dist/bundles/skills/catladder-config/SKILL.md +4 -0
- package/dist/bundles/skills/catladder-deploys/SKILL.md +6 -0
- package/dist/bundles/skills/catladder-pipelines/SKILL.md +85 -1
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js +60 -3
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/github/aggregateCheckJob.d.ts +1 -1
- package/dist/packages/pipeline/src/backends/github/aggregateCheckJob.js +22 -8
- package/dist/packages/pipeline/src/backends/github/aggregateCheckJob.js.map +1 -1
- package/dist/packages/pipeline/src/backends/github/reviewDeployWorkflow.d.ts +128 -0
- package/dist/packages/pipeline/src/backends/github/reviewDeployWorkflow.js +510 -0
- package/dist/packages/pipeline/src/backends/github/reviewDeployWorkflow.js.map +1 -0
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js +29 -4
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.d.ts +11 -1
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.js +17 -5
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/reviewDeployGate.d.ts +26 -0
- package/dist/packages/pipeline/src/backends/gitlab/reviewDeployGate.js +94 -0
- package/dist/packages/pipeline/src/backends/gitlab/reviewDeployGate.js.map +1 -0
- package/dist/packages/pipeline/src/deploy/base/deploy.js +10 -3
- package/dist/packages/pipeline/src/deploy/base/deploy.js.map +1 -1
- package/dist/packages/pipeline/src/index.d.ts +1 -0
- package/dist/packages/pipeline/src/index.js +1 -0
- package/dist/packages/pipeline/src/index.js.map +1 -1
- package/dist/packages/pipeline/src/pipeline/resolveRequirements.d.ts +2 -0
- package/dist/packages/pipeline/src/pipeline/resolveRequirements.js +3 -2
- package/dist/packages/pipeline/src/pipeline/resolveRequirements.js.map +1 -1
- package/dist/packages/pipeline/src/reviewApps.d.ts +38 -0
- package/dist/packages/pipeline/src/reviewApps.js +86 -0
- package/dist/packages/pipeline/src/reviewApps.js.map +1 -0
- package/dist/packages/pipeline/src/reviewAppsPolicy.d.ts +46 -0
- package/dist/packages/pipeline/src/reviewAppsPolicy.js +37 -0
- package/dist/packages/pipeline/src/reviewAppsPolicy.js.map +1 -0
- package/dist/packages/pipeline/src/types/config.d.ts +55 -0
- package/dist/packages/pipeline/src/types/config.js.map +1 -1
- package/dist/skills/catladder-cli/references/commands.md +13 -0
- package/dist/skills/catladder-config/SKILL.md +4 -0
- package/dist/skills/catladder-deploys/SKILL.md +6 -0
- package/dist/skills/catladder-pipelines/SKILL.md +85 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/catci.ts +29 -0
- package/src/commands/index.ts +4 -0
- package/src/commands/project/commandMrPin.ts +15 -14
- package/src/commands/project/commandMrReviewApp.ts +143 -0
- package/src/reviewApps/__tests__/github.test.ts +118 -0
- package/src/reviewApps/github.ts +307 -0
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createGitlabPipelineWithDefaults = void 0;
|
|
3
|
+
exports.createGitlabPipelineWithDefaults = exports.DEFAULT_PIPELINE_IMAGE = void 0;
|
|
4
4
|
const bash_1 = require("../../../../bash/src/index.js");
|
|
5
5
|
const autoStop_1 = require("../../autoStop");
|
|
6
|
+
const reviewApps_1 = require("../../reviewApps");
|
|
6
7
|
const rules_1 = require("../../rules");
|
|
7
8
|
/**
|
|
8
9
|
* gitlab requires a top-level default image for jobs that don't set their
|
|
9
10
|
* own. Every catladder-generated job sets an explicit image, so this
|
|
10
|
-
* fallback is never
|
|
11
|
+
* fallback is never pulled for them — it just needs to be a valid,
|
|
11
12
|
* build-free image (a catladder job image would drag in a build job).
|
|
13
|
+
* Trivial jobs (the review deploy switch) reuse it explicitly.
|
|
12
14
|
*/
|
|
13
|
-
|
|
14
|
-
const createGitlabPipelineWithDefaults = ({ image, variables, before_script, branchPipelines = [], autoStop, ...config }) => {
|
|
15
|
+
exports.DEFAULT_PIPELINE_IMAGE = "node:22";
|
|
16
|
+
const createGitlabPipelineWithDefaults = ({ image, variables, before_script, branchPipelines = [], autoStop, reviewApps, ...config }) => {
|
|
15
17
|
const pinLabel = autoStop && autoStop.pinLabel;
|
|
16
18
|
return {
|
|
17
|
-
image: image !== null && image !== void 0 ? image : DEFAULT_PIPELINE_IMAGE,
|
|
19
|
+
image: image !== null && image !== void 0 ? image : exports.DEFAULT_PIPELINE_IMAGE,
|
|
18
20
|
variables: {
|
|
19
21
|
FF_USE_FASTZIP: "true", // enable fastzip - a faster zip implementation that also supports level configuration.
|
|
20
22
|
ARTIFACT_COMPRESSION_LEVEL: "fast", // we value speed over compression
|
|
@@ -52,6 +54,16 @@ const createGitlabPipelineWithDefaults = ({ image, variables, before_script, bra
|
|
|
52
54
|
PIPELINE_NAME: "Thinking...",
|
|
53
55
|
},
|
|
54
56
|
},
|
|
57
|
+
// reviewApps.drafts: "skip" — draft MRs get no pipeline (rules
|
|
58
|
+
// stop at the first match, so this must come first)
|
|
59
|
+
...((reviewApps === null || reviewApps === void 0 ? void 0 : reviewApps.drafts) === "skip"
|
|
60
|
+
? [
|
|
61
|
+
{
|
|
62
|
+
if: `${rules_1.RULE_IS_MERGE_REQUEST.if} && ${reviewApps_1.GITLAB_DRAFT_MR_CONDITION}`,
|
|
63
|
+
when: "never",
|
|
64
|
+
},
|
|
65
|
+
]
|
|
66
|
+
: []),
|
|
55
67
|
// pinned MRs (rules stop at the first match, so this must come
|
|
56
68
|
// before the plain merge-request rule)
|
|
57
69
|
...(pinLabel
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGitlabPipeline.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/createGitlabPipeline.ts"],"names":[],"mappings":";;;AACA,0CAAwD;AACxD,6CAIwB;AACxB,uCAIqB;AAGrB
|
|
1
|
+
{"version":3,"file":"createGitlabPipeline.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/createGitlabPipeline.ts"],"names":[],"mappings":";;;AACA,0CAAwD;AACxD,6CAIwB;AACxB,iDAG0B;AAC1B,uCAIqB;AAGrB;;;;;;GAMG;AACU,QAAA,sBAAsB,GAAG,SAAS,CAAC;AAEzC,MAAM,gCAAgC,GAAG,CAAC,EAC/C,KAAK,EACL,SAAS,EACT,aAAa,EACb,eAAe,GAAG,EAAE,EACpB,QAAQ,EACR,UAAU,EACV,GAAG,MAAM,EASV,EAAsB,EAAE;IACvB,MAAM,QAAQ,GAAG,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC;IA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,MAAM,qBAAqB;qBAC9C;iBACF,CAAC,CAAC;gBAEH;oBACE,IAAI,EAAE,QAAQ,EAAE,WAAW;oBAC3B,SAAS,EAAE;wBACT,aAAa,EAAE,KAAK;wBACpB,aAAa,EAAE,SAAS;qBACzB;iBACF;aACF;SACF;QAED,GAAG,MAAM;KACV,CAAC;AACJ,CAAC,CAAC;AAnIW,QAAA,gCAAgC,oCAmI3C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AllCatladderJobs } from "../../pipeline/createAllJobs";
|
|
2
|
+
import { type ResolvedReviewAppsConfig } from "../../reviewApps";
|
|
3
|
+
import type { GitlabJobDef } from "../../types";
|
|
4
|
+
export declare const REVIEW_DEPLOY_GATE_JOB_NAME = "\uD83D\uDE80 deploy review";
|
|
5
|
+
/**
|
|
6
|
+
* the review deploy switch of a merge request (see reviewApps.ts): ONE
|
|
7
|
+
* job per MR pipeline that unlocks the delivery chains (docker → deploy
|
|
8
|
+
* → verify) of all components' review apps, instead of a manual job per
|
|
9
|
+
* component — or a docker build per component in every pipeline.
|
|
10
|
+
*
|
|
11
|
+
* The chain heads `needs` the switch. It is a no-op job with
|
|
12
|
+
* `allow_failure: true`: while it is unplayed, gitlab marks its
|
|
13
|
+
* dependents skipped and the pipeline still passes ("Pipelines must
|
|
14
|
+
* succeed" keeps working); playing it resets them to created, so it
|
|
15
|
+
* can be played any time — early clicks wait for the builds and tests
|
|
16
|
+
* like the chains always did (the same mechanism as the release
|
|
17
|
+
* button).
|
|
18
|
+
*
|
|
19
|
+
* The label/draft policy decides whether it starts on its own. Label
|
|
20
|
+
* changes only apply to the next pipeline (gitlab doesn't start one for
|
|
21
|
+
* them) — `catladder mr review-app-on` sets the label and triggers one.
|
|
22
|
+
*
|
|
23
|
+
* Mutates the needs of the gated jobs; returns the switch job, or
|
|
24
|
+
* nothing when review deploys aren't gated (or nothing deploys).
|
|
25
|
+
*/
|
|
26
|
+
export declare const addGitlabReviewDeployGate: (allJobs: AllCatladderJobs, reviewApps: ResolvedReviewAppsConfig) => GitlabJobDef | undefined;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addGitlabReviewDeployGate = exports.REVIEW_DEPLOY_GATE_JOB_NAME = void 0;
|
|
4
|
+
const reviewApps_1 = require("../../reviewApps");
|
|
5
|
+
const rules_1 = require("../../rules");
|
|
6
|
+
const createGitlabPipeline_1 = require("./createGitlabPipeline");
|
|
7
|
+
exports.REVIEW_DEPLOY_GATE_JOB_NAME = "🚀 deploy review";
|
|
8
|
+
/**
|
|
9
|
+
* the review deploy switch of a merge request (see reviewApps.ts): ONE
|
|
10
|
+
* job per MR pipeline that unlocks the delivery chains (docker → deploy
|
|
11
|
+
* → verify) of all components' review apps, instead of a manual job per
|
|
12
|
+
* component — or a docker build per component in every pipeline.
|
|
13
|
+
*
|
|
14
|
+
* The chain heads `needs` the switch. It is a no-op job with
|
|
15
|
+
* `allow_failure: true`: while it is unplayed, gitlab marks its
|
|
16
|
+
* dependents skipped and the pipeline still passes ("Pipelines must
|
|
17
|
+
* succeed" keeps working); playing it resets them to created, so it
|
|
18
|
+
* can be played any time — early clicks wait for the builds and tests
|
|
19
|
+
* like the chains always did (the same mechanism as the release
|
|
20
|
+
* button).
|
|
21
|
+
*
|
|
22
|
+
* The label/draft policy decides whether it starts on its own. Label
|
|
23
|
+
* changes only apply to the next pipeline (gitlab doesn't start one for
|
|
24
|
+
* them) — `catladder mr review-app-on` sets the label and triggers one.
|
|
25
|
+
*
|
|
26
|
+
* Mutates the needs of the gated jobs; returns the switch job, or
|
|
27
|
+
* nothing when review deploys aren't gated (or nothing deploys).
|
|
28
|
+
*/
|
|
29
|
+
const addGitlabReviewDeployGate = (allJobs, reviewApps) => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (!(0, reviewApps_1.isReviewDeployGated)(reviewApps)) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
let gated = false;
|
|
35
|
+
for (const { context, jobs } of allJobs.components) {
|
|
36
|
+
for (const job of jobs) {
|
|
37
|
+
// the chain heads: verify follows its deploy anyway
|
|
38
|
+
if ((0, reviewApps_1.isReviewDeliveryJob)(context, job) && job.stage !== "verify") {
|
|
39
|
+
job.needs = [
|
|
40
|
+
...((_a = job.needs) !== null && _a !== void 0 ? _a : []),
|
|
41
|
+
{ job: exports.REVIEW_DEPLOY_GATE_JOB_NAME, artifacts: false, global: true },
|
|
42
|
+
];
|
|
43
|
+
gated = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (!gated) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const isMr = rules_1.RULE_IS_MERGE_REQUEST.if;
|
|
51
|
+
const manual = { when: "manual", allow_failure: true };
|
|
52
|
+
const auto = { when: "on_success" };
|
|
53
|
+
const policyRules = reviewApps.deploy === "optIn"
|
|
54
|
+
? [
|
|
55
|
+
{
|
|
56
|
+
if: `${isMr} && $CI_MERGE_REQUEST_LABELS =~ ${(0, reviewApps_1.getGitlabLabelRegex)(reviewApps.label)}`,
|
|
57
|
+
...auto,
|
|
58
|
+
},
|
|
59
|
+
{ if: isMr, ...manual },
|
|
60
|
+
]
|
|
61
|
+
: reviewApps.deploy === "optOut"
|
|
62
|
+
? [
|
|
63
|
+
{
|
|
64
|
+
if: `${isMr} && $CI_MERGE_REQUEST_LABELS =~ ${(0, reviewApps_1.getGitlabLabelRegex)(reviewApps.skipLabel)}`,
|
|
65
|
+
...manual,
|
|
66
|
+
},
|
|
67
|
+
{ if: isMr, ...auto },
|
|
68
|
+
]
|
|
69
|
+
: reviewApps.deploy === "manual"
|
|
70
|
+
? [{ if: isMr, ...manual }]
|
|
71
|
+
: [{ if: isMr, ...auto }];
|
|
72
|
+
return {
|
|
73
|
+
stage: "setup",
|
|
74
|
+
image: createGitlabPipeline_1.DEFAULT_PIPELINE_IMAGE,
|
|
75
|
+
variables: { GIT_STRATEGY: "none" },
|
|
76
|
+
needs: [],
|
|
77
|
+
interruptible: true,
|
|
78
|
+
allow_failure: true,
|
|
79
|
+
script: [
|
|
80
|
+
`echo "review apps unlocked — the docker → deploy → verify chains of all components run as soon as their builds and tests succeeded"`,
|
|
81
|
+
],
|
|
82
|
+
rules: [
|
|
83
|
+
rules_1.RULE_NEVER_ON_AGENT_TRIGGER,
|
|
84
|
+
// drafts never deploy on their own (drafts: "skip" has no
|
|
85
|
+
// pipeline at all, see the workflow rules)
|
|
86
|
+
...(reviewApps.drafts !== "likeReady"
|
|
87
|
+
? [{ if: `${isMr} && ${reviewApps_1.GITLAB_DRAFT_MR_CONDITION}`, ...manual }]
|
|
88
|
+
: []),
|
|
89
|
+
...policyRules,
|
|
90
|
+
],
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
exports.addGitlabReviewDeployGate = addGitlabReviewDeployGate;
|
|
94
|
+
//# sourceMappingURL=reviewDeployGate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewDeployGate.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/reviewDeployGate.ts"],"names":[],"mappings":";;;AACA,iDAM0B;AAC1B,uCAGqB;AAErB,iEAAgE;AAEnD,QAAA,2BAA2B,GAAG,kBAAkB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,MAAM,yBAAyB,GAAG,CACvC,OAAyB,EACzB,UAAoC,EACV,EAAE;;IAC5B,IAAI,CAAC,IAAA,gCAAmB,EAAC,UAAU,CAAC,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACnD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,oDAAoD;YACpD,IAA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EAAE,CAAC;gBAC3B,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IAElC,OAAO;QACL,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,6CAAsB;QAC7B,SAAS,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE;QACnC,KAAK,EAAE,EAAE;QACT,aAAa,EAAE,IAAI;QACnB,aAAa,EAAE,IAAI;QACnB,MAAM,EAAE;YACN,qIAAqI;SACtI;QACD,KAAK,EAAE;YACL,mCAA2B;YAC3B,0DAA0D;YAC1D,2CAA2C;YAC3C,GAAG,CAAC,UAAU,CAAC,MAAM,KAAK,WAAW;gBACnC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,OAAO,sCAAyB,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC;gBAChE,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,WAAW;SACf;KACF,CAAC;AACJ,CAAC,CAAC;AApEW,QAAA,yBAAyB,6BAoEpC"}
|
|
@@ -7,6 +7,7 @@ const jobs_1 = require("../../types/jobs");
|
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
8
|
const autoStop_1 = require("../../autoStop");
|
|
9
9
|
const stop_1 = require("./stop");
|
|
10
|
+
const reviewApps_1 = require("../../reviewApps");
|
|
10
11
|
const variables_1 = require("./variables");
|
|
11
12
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
12
13
|
class DeployJob extends jobs_1.CatladderJob {
|
|
@@ -43,9 +44,15 @@ class DeployJob extends jobs_1.CatladderJob {
|
|
|
43
44
|
: ((_b = context.componentConfig.env) === null || _b === void 0 ? void 0 : _b.stage) === false
|
|
44
45
|
? "auto" // is prod, but no staging, auto deploy
|
|
45
46
|
: "manual"; // manually deploy
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
// gated review apps: one switch per MR/PR unlocks the whole delivery
|
|
48
|
+
// chain (see reviewApps.ts), the deploy itself then runs on its own
|
|
49
|
+
const isGatedReviewApp = context.environment.instance.type === "review" &&
|
|
50
|
+
(0, reviewApps_1.isReviewDeployGated)((0, reviewApps_1.getReviewAppsConfig)(context.fullConfig));
|
|
51
|
+
const whenDeploy = isGatedReviewApp
|
|
52
|
+
? "auto"
|
|
53
|
+
: whenDeployDefined
|
|
54
|
+
? whenDeployDefined
|
|
55
|
+
: whenDeployDefault;
|
|
49
56
|
// wait for the deployment of other components first
|
|
50
57
|
const waitForRequirements = (_d = (_c = deployConfig === null || deployConfig === void 0 ? void 0 : deployConfig.waitFor) === null || _c === void 0 ? void 0 : _c.map((c) => ({
|
|
51
58
|
capability: "deployment",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/deploy/base/deploy.ts"],"names":[],"mappings":";;;AAAA,+CAG4B;AAE5B,iDAG6B;AAE7B,2CAAgD;AAChD,oCAA8C;AAC9C,6CAA8E;AAC9E,iCAAuC;
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/deploy/base/deploy.ts"],"names":[],"mappings":";;;AAAA,+CAG4B;AAE5B,iDAG6B;AAE7B,2CAAgD;AAChD,oCAA8C;AAC9C,6CAA8E;AAC9E,iCAAuC;AACvC,iDAA4E;AAE5E,2CAAsD;AAEzC,QAAA,eAAe,GAAG,WAAW,CAAC;AAE3C,MAAa,SAAU,SAAQ,mBAAY;IACzC,YAAY,OAAyB,EAAE,aAAkC;;QACvE,MAAM,SAAS,GAAG,IAAA,4BAAmB,EAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,WAAW,GAAG,IAAA,0BAAkB,EAAC,OAAO,CAAC,CAAC;QAEhD,iEAAiE;QACjE,sDAAsD;QACtD,MAAM,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC;QACxD,MAAM,cAAc,GAAG,IAAA,4BAAiB,EAAC,OAA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AG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,gCAAuB,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACtD,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO;gBAEjD,GAAG,aAAa,CAAC,SAAS;aAC3B;YACD,eAAe,EAAE;gBACf,GAAG,mCAAuB;gBAC1B,GAAG,CAAC,MAAA,aAAa,CAAC,eAAe,mCAAI,EAAE,CAAC;gBACxC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAA,YAAY,CAAC,eAAe,mCAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9D;YACD,WAAW,EAAE,WAAW;gBACtB,CAAC,CAAC;oBACE,MAAM,EAAE,oBAAa;oBACrB,UAAU,EAAE,QAAQ;iBACrB;gBACH,CAAC,CAAC,EAAE;YACN,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;SACzD,CAAC,CAAC;IACL,CAAC;CACF;AA9JD,8BA8JC"}
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./pipeline"), exports);
|
|
18
18
|
__exportStar(require("./autoStop"), exports);
|
|
19
|
+
__exportStar(require("./reviewApps"), exports);
|
|
19
20
|
__exportStar(require("./backends"), exports);
|
|
20
21
|
__exportStar(require("./types"), exports);
|
|
21
22
|
__exportStar(require("./rules"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pipeline/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,+DAA6C;AAC7C,+DAA6C;AAC7C,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,kDAAgC;AAChC,4CAA0B;AAC1B,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,2CAAyB;AACzB,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pipeline/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,+CAA6B;AAC7B,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,+DAA6C;AAC7C,+DAA6C;AAC7C,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,kDAAgC;AAChC,4CAA0B;AAC1B,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,2CAAyB;AACzB,gDAA8B"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { CapabilityName, CatladderJob } from "../types/jobs";
|
|
1
2
|
import type { AllCatladderJobs } from "./createAllJobs";
|
|
3
|
+
export declare const providesCapability: (job: CatladderJob, capability: CapabilityName) => boolean;
|
|
2
4
|
/**
|
|
3
5
|
* the planner: resolves the semantic `requires` declarations of all jobs
|
|
4
6
|
* to concrete job dependencies (`needs`), now that all jobs of the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveRequirements = void 0;
|
|
3
|
+
exports.resolveRequirements = exports.providesCapability = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* jobs that don't declare `provides` get a capability derived from
|
|
6
6
|
* their stage. This keeps e.g. custom jobs in the test stage acting
|
|
@@ -31,6 +31,7 @@ const providesCapability = (job, capability) => {
|
|
|
31
31
|
((_a = CAPABILITY_IMPLICATIONS[c]) !== null && _a !== void 0 ? _a : []).includes(capability);
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
+
exports.providesCapability = providesCapability;
|
|
34
35
|
/**
|
|
35
36
|
* the planner: resolves the semantic `requires` declarations of all jobs
|
|
36
37
|
* to concrete job dependencies (`needs`), now that all jobs of the
|
|
@@ -72,7 +73,7 @@ const expandRequirement = (context, job, requirement, allJobs) => {
|
|
|
72
73
|
c.context.env === env;
|
|
73
74
|
})
|
|
74
75
|
.flatMap((c) => c.jobs);
|
|
75
|
-
const providers = candidates.filter((candidate) => candidate !== job && providesCapability(candidate, capability));
|
|
76
|
+
const providers = candidates.filter((candidate) => candidate !== job && (0, exports.providesCapability)(candidate, capability));
|
|
76
77
|
// consuming artifacts from nobody is almost always a broken config
|
|
77
78
|
const isStrict = (_b = strict !== null && strict !== void 0 ? strict : artifacts) !== null && _b !== void 0 ? _b : false;
|
|
78
79
|
if (isStrict && providers.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveRequirements.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/pipeline/resolveRequirements.ts"],"names":[],"mappings":";;;AAUA;;;;GAIG;AACH,MAAM,0BAA0B,GAA+C;IAC7E,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,aAAa;IACnB,YAAY,EAAE,aAAa;IAC3B,MAAM,EAAE,YAAY;CACrB,CAAC;AAEF;;;;GAIG;AACH,MAAM,uBAAuB,GAEzB;IACF,cAAc,EAAE,CAAC,OAAO,CAAC;IACzB,WAAW,EAAE,CAAC,OAAO,CAAC;CACvB,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveRequirements.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/pipeline/resolveRequirements.ts"],"names":[],"mappings":";;;AAUA;;;;GAIG;AACH,MAAM,0BAA0B,GAA+C;IAC7E,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,aAAa;IACnB,YAAY,EAAE,aAAa;IA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AAC;gBACE,GAAG,EAAE,QAAQ,CAAC,IAAI;gBAClB,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,KAAK;gBAC7B,aAAa,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,mCAAI,OAAO,CAAC,IAAI;aAC/C,CAAA;KAAA,CACN,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ResolvedReviewAppsConfig } from "./reviewAppsPolicy";
|
|
2
|
+
import type { Config } from "./types";
|
|
3
|
+
import type { Context } from "./types/context";
|
|
4
|
+
import type { CatladderJob } from "./types/jobs";
|
|
5
|
+
export * from "./reviewAppsPolicy";
|
|
6
|
+
export declare const getReviewAppsConfig: (config: Config) => ResolvedReviewAppsConfig;
|
|
7
|
+
/**
|
|
8
|
+
* whether the review deploys sit behind the per-MR/PR deploy switch
|
|
9
|
+
* instead of running in every pipeline
|
|
10
|
+
*/
|
|
11
|
+
export declare const isReviewDeployGated: (config: ResolvedReviewAppsConfig) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* the label whose change switches the review apps on (`labeled` on
|
|
14
|
+
* opt-in, `unlabeled` on opt-out) or off (the inverse), if the mode is
|
|
15
|
+
* label-driven at all
|
|
16
|
+
*/
|
|
17
|
+
export declare const getReviewAppsSwitchLabel: (config: ResolvedReviewAppsConfig) => {
|
|
18
|
+
label: string;
|
|
19
|
+
deployOn: "labeled" | "unlabeled";
|
|
20
|
+
stopOn: string;
|
|
21
|
+
} | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* gitlab: matches a label inside `$CI_MERGE_REQUEST_LABELS`
|
|
24
|
+
* (comma-separated) — anchored so `x` never matches `no-x`
|
|
25
|
+
*/
|
|
26
|
+
export declare const getGitlabLabelRegex: (label: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* gitlab: a draft MR, by its title prefix — the only draft signal every
|
|
29
|
+
* gitlab version exposes to rules
|
|
30
|
+
*/
|
|
31
|
+
export declare const GITLAB_DRAFT_MR_CONDITION = "$CI_MERGE_REQUEST_TITLE =~ /^\\s*(\\[draft\\]|\\(draft\\)|draft:)/i";
|
|
32
|
+
/**
|
|
33
|
+
* whether a job belongs to the delivery chain of a review app — the
|
|
34
|
+
* docker image, the deploy and the post-deploy verification. These jobs
|
|
35
|
+
* sit behind the review deploy switch; quality jobs (lint, test, audit)
|
|
36
|
+
* and the app build never do.
|
|
37
|
+
*/
|
|
38
|
+
export declare const isReviewDeliveryJob: (context: Context, job: CatladderJob) => boolean;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.isReviewDeliveryJob = exports.GITLAB_DRAFT_MR_CONDITION = exports.getGitlabLabelRegex = exports.getReviewAppsSwitchLabel = exports.isReviewDeployGated = exports.getReviewAppsConfig = void 0;
|
|
18
|
+
const autoStop_1 = require("./autoStop");
|
|
19
|
+
const reviewAppsPolicy_1 = require("./reviewAppsPolicy");
|
|
20
|
+
__exportStar(require("./reviewAppsPolicy"), exports);
|
|
21
|
+
const getReviewAppsConfig = (config) => {
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
23
|
+
return ({
|
|
24
|
+
deploy: (_b = (_a = config.reviewApps) === null || _a === void 0 ? void 0 : _a.deploy) !== null && _b !== void 0 ? _b : "auto",
|
|
25
|
+
// single colon on purpose: gitlab treats `a::b` labels as scoped and
|
|
26
|
+
// mutually exclusive, which would make this label and the
|
|
27
|
+
// `catladder::pin-review` pin label displace each other
|
|
28
|
+
label: (_d = (_c = config.reviewApps) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : reviewAppsPolicy_1.DEFAULT_REVIEW_APP_LABEL,
|
|
29
|
+
skipLabel: (_f = (_e = config.reviewApps) === null || _e === void 0 ? void 0 : _e.skipLabel) !== null && _f !== void 0 ? _f : reviewAppsPolicy_1.DEFAULT_NO_REVIEW_APP_LABEL,
|
|
30
|
+
drafts: (_h = (_g = config.reviewApps) === null || _g === void 0 ? void 0 : _g.drafts) !== null && _h !== void 0 ? _h : "likeReady",
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
exports.getReviewAppsConfig = getReviewAppsConfig;
|
|
34
|
+
/**
|
|
35
|
+
* whether the review deploys sit behind the per-MR/PR deploy switch
|
|
36
|
+
* instead of running in every pipeline
|
|
37
|
+
*/
|
|
38
|
+
const isReviewDeployGated = (config) => config.deploy !== "auto" || config.drafts === "checksOnly";
|
|
39
|
+
exports.isReviewDeployGated = isReviewDeployGated;
|
|
40
|
+
/**
|
|
41
|
+
* the label whose change switches the review apps on (`labeled` on
|
|
42
|
+
* opt-in, `unlabeled` on opt-out) or off (the inverse), if the mode is
|
|
43
|
+
* label-driven at all
|
|
44
|
+
*/
|
|
45
|
+
const getReviewAppsSwitchLabel = (config) => {
|
|
46
|
+
switch (config.deploy) {
|
|
47
|
+
case "optIn":
|
|
48
|
+
return { label: config.label, deployOn: "labeled", stopOn: "unlabeled" };
|
|
49
|
+
case "optOut":
|
|
50
|
+
return {
|
|
51
|
+
label: config.skipLabel,
|
|
52
|
+
deployOn: "unlabeled",
|
|
53
|
+
stopOn: "labeled",
|
|
54
|
+
};
|
|
55
|
+
default:
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.getReviewAppsSwitchLabel = getReviewAppsSwitchLabel;
|
|
60
|
+
/**
|
|
61
|
+
* gitlab: matches a label inside `$CI_MERGE_REQUEST_LABELS`
|
|
62
|
+
* (comma-separated) — anchored so `x` never matches `no-x`
|
|
63
|
+
*/
|
|
64
|
+
const getGitlabLabelRegex = (label) => `/${(0, autoStop_1.getPinLabelRegexSource)(label)}/`;
|
|
65
|
+
exports.getGitlabLabelRegex = getGitlabLabelRegex;
|
|
66
|
+
/**
|
|
67
|
+
* gitlab: a draft MR, by its title prefix — the only draft signal every
|
|
68
|
+
* gitlab version exposes to rules
|
|
69
|
+
*/
|
|
70
|
+
exports.GITLAB_DRAFT_MR_CONDITION = "$CI_MERGE_REQUEST_TITLE =~ /^\\s*(\\[draft\\]|\\(draft\\)|draft:)/i";
|
|
71
|
+
/**
|
|
72
|
+
* whether a job belongs to the delivery chain of a review app — the
|
|
73
|
+
* docker image, the deploy and the post-deploy verification. These jobs
|
|
74
|
+
* sit behind the review deploy switch; quality jobs (lint, test, audit)
|
|
75
|
+
* and the app build never do.
|
|
76
|
+
*/
|
|
77
|
+
const isReviewDeliveryJob = (context, job) => {
|
|
78
|
+
var _a;
|
|
79
|
+
return context.type === "component" &&
|
|
80
|
+
context.environment.instance.type === "review" &&
|
|
81
|
+
(job.stage === "deploy" ||
|
|
82
|
+
job.stage === "verify" ||
|
|
83
|
+
((_a = job.provides) !== null && _a !== void 0 ? _a : []).includes("dockerImage"));
|
|
84
|
+
};
|
|
85
|
+
exports.isReviewDeliveryJob = isReviewDeliveryJob;
|
|
86
|
+
//# sourceMappingURL=reviewApps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewApps.js","s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AAEF;;;GAGG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAU,EAAE,CAC3D,IAAI,IAAA,iCAAsB,EAAC,KAAK,CAAC,GAAG,CAAC;AAD1B,QAAA,mBAAmB,uBACO;AAEvC;;;GAGG;AACU,QAAA,yBAAyB,GACpC,qEAAqE,CAAC;AAExE;;;;;GAKG;AACI,MAAM,mBAAmB,GAAG,CAAC,OAAgB,EAAE,GAAiB,EAAE,EAAE;;IACzE,OAAA,OAAO,CAAC,IAAI,KAAK,WAAW;QAC5B,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ;QAC9C,CAAC,GAAG,CAAC,KAAK,KAAK,QAAQ;YACrB,GAAG,CAAC,KAAK,KAAK,QAAQ;YACtB,CAAC,MAAA,GAAG,CAAC,QAAQ,mCAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAA;CAAA,CAAC;AALrC,QAAA,mBAAmB,uBAKkB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* the review-app deploy policy — dependency-free, so catci (the CI
|
|
3
|
+
* companion bundle) can import it without dragging in the pipeline.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* when the review apps of a merge request / pull request deploy:
|
|
7
|
+
* - auto: every MR/PR deploys its review apps (default)
|
|
8
|
+
* - manual: never on their own — one "deploy review" switch per MR/PR
|
|
9
|
+
* (gitlab: a manual job in the pipeline, github: a dispatch workflow)
|
|
10
|
+
* - optIn: only while the MR/PR carries the `label`
|
|
11
|
+
* - optOut: unless the MR/PR carries the `skipLabel`
|
|
12
|
+
*/
|
|
13
|
+
export type ReviewAppsDeployMode = "auto" | "manual" | "optIn" | "optOut";
|
|
14
|
+
/**
|
|
15
|
+
* what a draft MR/PR runs:
|
|
16
|
+
* - likeReady: the same as a ready one, review apps included (default)
|
|
17
|
+
* - checksOnly: tests, lint and audit only — the review apps deploy once it is
|
|
18
|
+
* marked ready
|
|
19
|
+
* - skip: no pipeline at all
|
|
20
|
+
*/
|
|
21
|
+
export type ReviewAppsDraftsMode = "likeReady" | "checksOnly" | "skip";
|
|
22
|
+
export declare const DEFAULT_REVIEW_APP_LABEL = "catladder:review-app";
|
|
23
|
+
export declare const DEFAULT_NO_REVIEW_APP_LABEL = "catladder:no-review-app";
|
|
24
|
+
export type ResolvedReviewAppsConfig = {
|
|
25
|
+
deploy: ReviewAppsDeployMode;
|
|
26
|
+
label: string;
|
|
27
|
+
skipLabel: string;
|
|
28
|
+
drafts: ReviewAppsDraftsMode;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* the state of a merge request / pull request the deploy decision
|
|
32
|
+
* depends on
|
|
33
|
+
*/
|
|
34
|
+
export type ReviewAppsMrState = {
|
|
35
|
+
labels: string[];
|
|
36
|
+
draft: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* whether the review apps of an MR/PR in the given state deploy
|
|
40
|
+
* automatically. An explicit request (playing the gate job, dispatching
|
|
41
|
+
* the deploy workflow) always deploys and doesn't consult this.
|
|
42
|
+
*/
|
|
43
|
+
export declare const shouldAutoDeployReviewApps: (config: ResolvedReviewAppsConfig, { labels, draft }: ReviewAppsMrState) => {
|
|
44
|
+
deploy: boolean;
|
|
45
|
+
reason: string;
|
|
46
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldAutoDeployReviewApps = exports.DEFAULT_NO_REVIEW_APP_LABEL = exports.DEFAULT_REVIEW_APP_LABEL = void 0;
|
|
4
|
+
exports.DEFAULT_REVIEW_APP_LABEL = "catladder:review-app";
|
|
5
|
+
exports.DEFAULT_NO_REVIEW_APP_LABEL = "catladder:no-review-app";
|
|
6
|
+
/**
|
|
7
|
+
* whether the review apps of an MR/PR in the given state deploy
|
|
8
|
+
* automatically. An explicit request (playing the gate job, dispatching
|
|
9
|
+
* the deploy workflow) always deploys and doesn't consult this.
|
|
10
|
+
*/
|
|
11
|
+
const shouldAutoDeployReviewApps = (config, { labels, draft }) => {
|
|
12
|
+
if (draft && config.drafts !== "likeReady") {
|
|
13
|
+
return { deploy: false, reason: "drafts don't deploy review apps" };
|
|
14
|
+
}
|
|
15
|
+
switch (config.deploy) {
|
|
16
|
+
case "auto":
|
|
17
|
+
return { deploy: true, reason: "review apps deploy automatically" };
|
|
18
|
+
case "manual":
|
|
19
|
+
return {
|
|
20
|
+
deploy: false,
|
|
21
|
+
reason: "review apps only deploy on request (deploy: manual)",
|
|
22
|
+
};
|
|
23
|
+
case "optIn":
|
|
24
|
+
return labels.includes(config.label)
|
|
25
|
+
? { deploy: true, reason: `the '${config.label}' label is set` }
|
|
26
|
+
: { deploy: false, reason: `the '${config.label}' label is not set` };
|
|
27
|
+
case "optOut":
|
|
28
|
+
return labels.includes(config.skipLabel)
|
|
29
|
+
? { deploy: false, reason: `the '${config.skipLabel}' label is set` }
|
|
30
|
+
: {
|
|
31
|
+
deploy: true,
|
|
32
|
+
reason: `the '${config.skipLabel}' label is not set`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.shouldAutoDeployReviewApps = shouldAutoDeployReviewApps;
|
|
37
|
+
//# sourceMappingURL=reviewAppsPolicy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewAppsPolicy.js","sourceRoot":"","sources":["../../../../../../packages/pipeline/src/reviewAppsPolicy.ts"],"names":[],"mappings":";;;AAuBa,QAAA,wBAAwB,GAAG,sBAAsB,CAAC;AAClD,QAAA,2BAA2B,GAAG,yBAAyB,CAAC;AAkBrE;;;;GAIG;AACI,MAAM,0BAA0B,GAAG,CACxC,MAAgC,EAChC,EAAE,MAAM,EAAE,KAAK,EAAqB,EACC,EAAE;IACvC,IAAI,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;QAC3C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,iCAAiC,EAAE,CAAC;IACtE,CAAC;IACD,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,KAAK,MAAM;YACT,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,kCAAkC,EAAE,CAAC;QACtE,KAAK,QAAQ;YACX,OAAO;gBACL,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE,qDAAqD;aAC9D,CAAC;QACJ,KAAK,OAAO;YACV,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC;gBAClC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,MAAM,CAAC,KAAK,gBAAgB,EAAE;gBAChE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,MAAM,CAAC,KAAK,oBAAoB,EAAE,CAAC;QAC1E,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC;gBACtC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,MAAM,CAAC,SAAS,gBAAgB,EAAE;gBACrE,CAAC,CAAC;oBACE,MAAM,EAAE,IAAI;oBACZ,MAAM,EAAE,QAAQ,MAAM,CAAC,SAAS,oBAAoB;iBACrD,CAAC;IACV,CAAC;AACH,CAAC,CAAC;AA3BW,QAAA,0BAA0B,8BA2BrC"}
|
|
@@ -11,6 +11,7 @@ import type { CatladderStore } from "../store";
|
|
|
11
11
|
import type { AgentSkillsConfig } from "../agentSkills/types";
|
|
12
12
|
import type { ProjectImageConfig } from "../customImages/projectImages";
|
|
13
13
|
import type { VerifyConfig } from "../verify/types";
|
|
14
|
+
import type { ReviewAppsDeployMode, ReviewAppsDraftsMode } from "../reviewAppsPolicy";
|
|
14
15
|
export declare const ALL_PIPELINE_TRIGGERS: readonly ["mainBranch", "mr", "taggedRelease"];
|
|
15
16
|
export type PipelineTrigger = (typeof ALL_PIPELINE_TRIGGERS)[number];
|
|
16
17
|
/**
|
|
@@ -492,6 +493,60 @@ export type Config<C extends ConfigProps = never> = {
|
|
|
492
493
|
*/
|
|
493
494
|
pinLabel?: string | false;
|
|
494
495
|
};
|
|
496
|
+
/**
|
|
497
|
+
* when merge requests / pull requests deploy their review apps —
|
|
498
|
+
* useful when many MRs/PRs are opened (e.g. by agents) and most of
|
|
499
|
+
* them don't need a running instance.
|
|
500
|
+
*
|
|
501
|
+
* With anything but the defaults, the delivery chain of every
|
|
502
|
+
* component's review app (docker image → deploy → verify) waits for
|
|
503
|
+
* ONE switch per MR/PR instead of running in every pipeline; tests,
|
|
504
|
+
* lint and audit always run:
|
|
505
|
+
* - gitlab: a `🚀 deploy review` job (manual, or automatic when the
|
|
506
|
+
* label policy says so). Label changes only apply to the next
|
|
507
|
+
* pipeline — `catladder mr review-app-on/off` sets the label and
|
|
508
|
+
* triggers one.
|
|
509
|
+
* - github: the review workflow decides at its start (labels, draft)
|
|
510
|
+
* and deploys in the same run when the policy says so. Later
|
|
511
|
+
* changes go through a `▶️ catladder deploy review` workflow,
|
|
512
|
+
* dispatched by the review workflow once green (when the policy now
|
|
513
|
+
* says deploy), by adding/removing the label, or by hand with the
|
|
514
|
+
* PR number. Switching the label off stops the review apps.
|
|
515
|
+
*
|
|
516
|
+
* Per-component `deploy.when` of the review env is ignored then — the
|
|
517
|
+
* switch covers all components.
|
|
518
|
+
*/
|
|
519
|
+
reviewApps?: {
|
|
520
|
+
/**
|
|
521
|
+
* - auto: every MR/PR deploys (default)
|
|
522
|
+
* - manual: only on request (play the gate job / dispatch the
|
|
523
|
+
* workflow)
|
|
524
|
+
* - optIn: only while the MR/PR carries `label`
|
|
525
|
+
* - optOut: unless the MR/PR carries `skipLabel`
|
|
526
|
+
* @defaultValue "auto"
|
|
527
|
+
*/
|
|
528
|
+
deploy?: ReviewAppsDeployMode;
|
|
529
|
+
/**
|
|
530
|
+
* the opt-in label
|
|
531
|
+
* @defaultValue "catladder:review-app"
|
|
532
|
+
*/
|
|
533
|
+
label?: string;
|
|
534
|
+
/**
|
|
535
|
+
* the opt-out label
|
|
536
|
+
* @defaultValue "catladder:no-review-app"
|
|
537
|
+
*/
|
|
538
|
+
skipLabel?: string;
|
|
539
|
+
/**
|
|
540
|
+
* what draft MRs/PRs run:
|
|
541
|
+
* - likeReady: the same as ready ones (default)
|
|
542
|
+
* - checksOnly: tests, lint and audit — the review apps deploy once the
|
|
543
|
+
* MR/PR is marked ready
|
|
544
|
+
* - skip: nothing (gitlab: marking an MR ready doesn't start a
|
|
545
|
+
* pipeline, the next push does)
|
|
546
|
+
* @defaultValue "likeReady"
|
|
547
|
+
*/
|
|
548
|
+
drafts?: ReviewAppsDraftsMode;
|
|
549
|
+
};
|
|
495
550
|
/**
|
|
496
551
|
* additional vars only for the runner in all jobs.
|
|
497
552
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/types/config.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/types/config.ts"],"names":[],"mappings":";;;AAmBa,QAAA,qBAAqB,GAAG;IACnC,YAAY;IACZ,IAAI;IACJ,eAAe;CACP,CAAC;AAoBJ,MAAM,eAAe,GAAG,CAC7B,OAA2B,EACO,EAAE,CACpC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,QAAQ,IAAI,OAAO,CAAC;AAH5D,QAAA,eAAe,mBAG6C;AAElE,MAAM,gBAAgB,GAAG,CAC9B,CAA0B,EAC1B,CAAqB,EACZ,EAAE;IACX,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACjD,IAAI,IAAA,uBAAe,EAAC,CAAC,CAAC;QAAE,OA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