@catladder/cli 5.4.1 → 5.6.0
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 +390 -53
- package/dist/bundles/catenv/xdg-open +0 -0
- package/dist/bundles/cli/clipboard_i686.exe +0 -0
- package/dist/bundles/cli/clipboard_x86_64.exe +0 -0
- package/dist/bundles/cli/index.js +390 -53
- package/dist/bundles/cli/xdg-open +0 -0
- package/dist/bundles/cli/xsel +0 -0
- package/dist/bundles/runner-images/changesets/scripts/changesetsRelease +0 -0
- package/dist/bundles/runner-images/kubernetes/scripts/kubernetesCreateSecret +0 -0
- package/dist/bundles/runner-images/kubernetes/scripts/kubernetesDelete +0 -0
- package/dist/bundles/runner-images/kubernetes/scripts/kubernetesDeploy +0 -0
- package/dist/bundles/runner-images/kubernetes/scripts/kubernetesRollback +0 -0
- package/dist/bundles/skills/catladder-builds/SKILL.md +50 -2
- package/dist/bundles/skills/catladder-builds/references/build-types.md +10 -2
- package/dist/bundles/skills/catladder-config/SKILL.md +18 -7
- package/dist/bundles/skills/catladder-pipelines/SKILL.md +39 -20
- package/dist/packages/pipeline/src/backends/github/artifactArchive.d.ts +22 -0
- package/dist/packages/pipeline/src/backends/github/artifactArchive.js +84 -0
- package/dist/packages/pipeline/src/backends/github/artifactArchive.js.map +1 -0
- package/dist/packages/pipeline/src/backends/github/createGithubJobs.js +12 -29
- package/dist/packages/pipeline/src/backends/github/createGithubJobs.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js +3 -1
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/getPipelineStages.d.ts +4 -1
- package/dist/packages/pipeline/src/backends/gitlab/getPipelineStages.js +11 -2
- package/dist/packages/pipeline/src/backends/gitlab/getPipelineStages.js.map +1 -1
- package/dist/packages/pipeline/src/build/types.d.ts +4 -3
- package/dist/packages/pipeline/src/build/types.js.map +1 -1
- package/dist/packages/pipeline/src/config/configruedEnvs.js +7 -1
- package/dist/packages/pipeline/src/config/configruedEnvs.js.map +1 -1
- package/dist/packages/pipeline/src/context/getEnvInherit.d.ts +2 -2
- package/dist/packages/pipeline/src/context/getEnvInherit.js +5 -2
- package/dist/packages/pipeline/src/context/getEnvInherit.js.map +1 -1
- package/dist/packages/pipeline/src/context/getEnvInstance.d.ts +2 -2
- package/dist/packages/pipeline/src/context/getEnvInstance.js.map +1 -1
- package/dist/packages/pipeline/src/context/getEnvOn.d.ts +2 -2
- package/dist/packages/pipeline/src/context/getEnvOn.js +1 -1
- package/dist/packages/pipeline/src/context/getEnvOn.js.map +1 -1
- package/dist/packages/pipeline/src/context/getEnvType.d.ts +3 -3
- package/dist/packages/pipeline/src/context/getEnvType.js +1 -1
- package/dist/packages/pipeline/src/context/getEnvType.js.map +1 -1
- package/dist/packages/pipeline/src/context/getEnvironmentContext.js +3 -2
- package/dist/packages/pipeline/src/context/getEnvironmentContext.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/base/deploy.js +15 -9
- 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/createJobsForComponent.js +12 -2
- package/dist/packages/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
- package/dist/packages/pipeline/src/pipeline/createJobsForWorkspace.js +7 -2
- package/dist/packages/pipeline/src/pipeline/createJobsForWorkspace.js.map +1 -1
- package/dist/packages/pipeline/src/pipeline/resolveRequirements.js +1 -0
- package/dist/packages/pipeline/src/pipeline/resolveRequirements.js.map +1 -1
- package/dist/packages/pipeline/src/postBuildTest/createPostBuildTestJobs.d.ts +16 -0
- package/dist/packages/pipeline/src/postBuildTest/createPostBuildTestJobs.js +167 -0
- package/dist/packages/pipeline/src/postBuildTest/createPostBuildTestJobs.js.map +1 -0
- package/dist/packages/pipeline/src/postBuildTest/index.d.ts +2 -0
- package/dist/packages/pipeline/src/postBuildTest/index.js +19 -0
- package/dist/packages/pipeline/src/postBuildTest/index.js.map +1 -0
- package/dist/packages/pipeline/src/postBuildTest/types.d.ts +61 -0
- package/dist/packages/pipeline/src/postBuildTest/types.js +3 -0
- package/dist/packages/pipeline/src/postBuildTest/types.js.map +1 -0
- package/dist/packages/pipeline/src/types/config.d.ts +20 -2
- package/dist/packages/pipeline/src/types/config.js +9 -1
- package/dist/packages/pipeline/src/types/config.js.map +1 -1
- package/dist/packages/pipeline/src/types/jobs.d.ts +2 -2
- package/dist/packages/pipeline/src/types/jobs.js +1 -0
- package/dist/packages/pipeline/src/types/jobs.js.map +1 -1
- package/dist/runner-images/changesets/scripts/changesetsRelease +0 -0
- package/dist/runner-images/kubernetes/scripts/kubernetesCreateSecret +0 -0
- package/dist/runner-images/kubernetes/scripts/kubernetesDelete +0 -0
- package/dist/runner-images/kubernetes/scripts/kubernetesDeploy +0 -0
- package/dist/runner-images/kubernetes/scripts/kubernetesRollback +0 -0
- package/dist/skills/catladder-builds/SKILL.md +50 -2
- package/dist/skills/catladder-builds/references/build-types.md +10 -2
- package/dist/skills/catladder-config/SKILL.md +18 -7
- package/dist/skills/catladder-pipelines/SKILL.md +39 -20
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertUniquePostBuildTestNames = exports.createPostBuildTestJobs = exports.postBuildTestJobName = exports.POST_BUILD_TEST_STAGE = void 0;
|
|
4
|
+
const createArtifactsConfig_1 = require("../build/base/createArtifactsConfig");
|
|
5
|
+
const cache_1 = require("../build/node/cache");
|
|
6
|
+
const constants_1 = require("../build/node/constants");
|
|
7
|
+
const packageManagerInstall_1 = require("../build/node/packageManagerInstall");
|
|
8
|
+
const types_1 = require("../build/types");
|
|
9
|
+
const runner_1 = require("../runner");
|
|
10
|
+
const jobs_1 = require("../types/jobs");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
exports.POST_BUILD_TEST_STAGE = "post-build";
|
|
13
|
+
const postBuildTestJobName = (name) => `🔬 ${name}`;
|
|
14
|
+
exports.postBuildTestJobName = postBuildTestJobName;
|
|
15
|
+
const getPostBuildTestsConfig = (context) => {
|
|
16
|
+
if (context.type === "workspace") {
|
|
17
|
+
return context.build.config.postBuildTests;
|
|
18
|
+
}
|
|
19
|
+
if (context.build.type === "disabled") {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return context.build.config.postBuildTests;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* whether the build output is a node project, so the job has to install
|
|
26
|
+
* the dependencies before running the tests
|
|
27
|
+
*/
|
|
28
|
+
const isNodeBuild = (context) => {
|
|
29
|
+
if (context.type === "workspace") {
|
|
30
|
+
return true; // workspace builds are node builds
|
|
31
|
+
}
|
|
32
|
+
if (context.build.type === "fromWorkspace") {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
if (context.build.type === "standalone") {
|
|
36
|
+
return (0, types_1.isOfBuildType)(context.build.config, "node", "node-static", "storybook", "meteor");
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
};
|
|
40
|
+
const hasBuildCommand = (buildCommand) => buildCommand !== null && buildCommand !== false;
|
|
41
|
+
/**
|
|
42
|
+
* whether the build creates an app build job with artifacts. Rails builds
|
|
43
|
+
* and builds with `buildCommand: false` only build the docker image.
|
|
44
|
+
*/
|
|
45
|
+
const hasBuildArtifacts = (context) => {
|
|
46
|
+
if (context.type === "workspace") {
|
|
47
|
+
return hasBuildCommand(context.build.config.buildCommand);
|
|
48
|
+
}
|
|
49
|
+
if (context.build.type === "fromWorkspace") {
|
|
50
|
+
return hasBuildCommand(context.build.workspaceBuildConfig.buildCommand);
|
|
51
|
+
}
|
|
52
|
+
if (context.build.type === "standalone") {
|
|
53
|
+
return (!(0, types_1.isOfBuildType)(context.build.config, "rails") &&
|
|
54
|
+
hasBuildCommand(context.build.config.buildCommand));
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
};
|
|
58
|
+
const getDefaultImage = (context) => {
|
|
59
|
+
if (context.type === "component" &&
|
|
60
|
+
context.build.type === "standalone" &&
|
|
61
|
+
(0, types_1.isOfBuildType)(context.build.config, "custom")) {
|
|
62
|
+
// custom builds bring their own toolchain image
|
|
63
|
+
return context.build.config.jobImage;
|
|
64
|
+
}
|
|
65
|
+
return (0, runner_1.getRunnerImage)("jobs-default");
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* jobs for `postBuildTests`: they run after the build in the `post-build`
|
|
69
|
+
* stage, against the build artifacts, and act as quality gates, so a
|
|
70
|
+
* failing post-build test blocks the deploy.
|
|
71
|
+
*/
|
|
72
|
+
const createPostBuildTestJobs = async (context) => {
|
|
73
|
+
var _a;
|
|
74
|
+
// like lint and test: tagged releases deploy what was already tested
|
|
75
|
+
if (context.trigger === "taggedRelease") {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
const tests = Object.entries((_a = getPostBuildTestsConfig(context)) !== null && _a !== void 0 ? _a : {}).filter((entry) => entry[1] !== false);
|
|
79
|
+
if (tests.length === 0) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
const nodeBuild = isNodeBuild(context);
|
|
83
|
+
const [packageManagerInstall, nodeCache] = nodeBuild
|
|
84
|
+
? await Promise.all([
|
|
85
|
+
(0, packageManagerInstall_1.getPackageManagerInstall)(context),
|
|
86
|
+
// pull-only: the build job is the designated cache writer
|
|
87
|
+
(0, cache_1.getNodeCache)(context, "pull"),
|
|
88
|
+
])
|
|
89
|
+
: [null, null];
|
|
90
|
+
// components built in a workspace test the workspace build output
|
|
91
|
+
const from = context.type === "component" && context.build.type === "fromWorkspace"
|
|
92
|
+
? { workspace: context.build.workspaceName }
|
|
93
|
+
: undefined;
|
|
94
|
+
const buildRequirement = hasBuildArtifacts(context)
|
|
95
|
+
? { capability: "buildArtifacts", artifacts: true, strict: true, from }
|
|
96
|
+
: // no build artifacts (e.g. rails): run after the build (docker image)
|
|
97
|
+
{ capability: "build", artifacts: false, from };
|
|
98
|
+
return tests.map(([name, test]) => {
|
|
99
|
+
var _a, _b, _c;
|
|
100
|
+
const artifactsConfig = (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, test.artifactsReports, test.artifacts);
|
|
101
|
+
return new jobs_1.CatladderJob({
|
|
102
|
+
name: (0, exports.postBuildTestJobName)(name),
|
|
103
|
+
stage: exports.POST_BUILD_TEST_STAGE,
|
|
104
|
+
envMode: "stagePerEnv",
|
|
105
|
+
provides: ["qualityGate"],
|
|
106
|
+
needs: [],
|
|
107
|
+
requires: [buildRequirement],
|
|
108
|
+
image: (_a = test.jobImage) !== null && _a !== void 0 ? _a : getDefaultImage(context),
|
|
109
|
+
services: test.services,
|
|
110
|
+
// neutral cache declarations, lowered by each backend
|
|
111
|
+
caches: nodeCache !== null && nodeCache !== void 0 ? nodeCache : undefined,
|
|
112
|
+
variables: {
|
|
113
|
+
APP_PATH: context.build.dir,
|
|
114
|
+
...(context.type === "component"
|
|
115
|
+
? context.environment.jobOnlyVars.build.envVars
|
|
116
|
+
: {}),
|
|
117
|
+
...((_b = test.vars) !== null && _b !== void 0 ? _b : {}),
|
|
118
|
+
},
|
|
119
|
+
runnerVariables: {
|
|
120
|
+
...(nodeBuild ? constants_1.NODE_RUNNER_BUILD_VARIABLES : {}),
|
|
121
|
+
...((_c = test.runnerVariables) !== null && _c !== void 0 ? _c : {}),
|
|
122
|
+
},
|
|
123
|
+
script: [
|
|
124
|
+
...(nodeBuild ? (0, packageManagerInstall_1.ensureNodeVersion)(context) : []),
|
|
125
|
+
`cd ${context.build.dir}`,
|
|
126
|
+
...(packageManagerInstall !== null && packageManagerInstall !== void 0 ? packageManagerInstall : []),
|
|
127
|
+
...(0, utils_1.ensureArray)(test.command),
|
|
128
|
+
],
|
|
129
|
+
allow_failure: test.allowFailure,
|
|
130
|
+
// reports and screenshots are most needed when the tests fail
|
|
131
|
+
...(artifactsConfig
|
|
132
|
+
? {
|
|
133
|
+
artifacts: {
|
|
134
|
+
when: "always",
|
|
135
|
+
...artifactsConfig.artifacts,
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
: {}),
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
exports.createPostBuildTestJobs = createPostBuildTestJobs;
|
|
143
|
+
const jobIdOf = (jobName) => jobName
|
|
144
|
+
.toLowerCase()
|
|
145
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
146
|
+
.replace(/^-+|-+$/g, "");
|
|
147
|
+
/**
|
|
148
|
+
* post-build test names are chosen by the user. Github job ids drop the
|
|
149
|
+
* emoji of the job name, so e.g. a post-build test named `test` would
|
|
150
|
+
* clash with the `🧪 test` job.
|
|
151
|
+
*/
|
|
152
|
+
const assertUniquePostBuildTestNames = (context, postBuildTestJobs, otherJobs) => {
|
|
153
|
+
const seenIds = new Set(otherJobs.map((job) => jobIdOf(job.name)));
|
|
154
|
+
// also catches two post-build tests that only differ in case or
|
|
155
|
+
// punctuation (e.g. `e2e` and `E2E`)
|
|
156
|
+
const clash = postBuildTestJobs.find((job) => {
|
|
157
|
+
const id = jobIdOf(job.name);
|
|
158
|
+
const isClash = seenIds.has(id);
|
|
159
|
+
seenIds.add(id);
|
|
160
|
+
return isClash;
|
|
161
|
+
});
|
|
162
|
+
if (clash) {
|
|
163
|
+
throw new Error(`${context.name}: post-build test '${clash.name}' clashes with another job of the same name, please rename it in postBuildTests`);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
exports.assertUniquePostBuildTestNames = assertUniquePostBuildTestNames;
|
|
167
|
+
//# sourceMappingURL=createPostBuildTestJobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPostBuildTestJobs.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/postBuildTest/createPostBuildTestJobs.ts"],"names":[],"mappings":";;;AAAA,+EAA4E;AAC5E,+CAAmD;AACnD,uDAAsE;AACtE,+EAG6C;AAC7C,0CAA+C;AAC/C,sCAA2C;AAG3C,wCAA6C;AAC7C,oCAAuC;AAG1B,QAAA,qBAAqB,GAAG,YAAY,CAAC;AAE3C,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC;AAAtD,QAAA,oBAAoB,wBAAkC;AAEnE,MAAM,uBAAuB,GAAG,CAC9B,OAA4C,EACV,EAAE;IACpC,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC;IAC7C,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC;AAC7C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,GAAG,CAAC,OAA4C,EAAE,EAAE;IACnE,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC,CAAC,mCAAmC;IAClD,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QACxC,OAAO,IAAA,qBAAa,EAClB,OAAO,CAAC,KAAK,CAAC,MAAM,EACpB,MAAM,EACN,aAAa,EACb,WAAW,EACX,QAAQ,CACT,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC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,IAAI,KAAK,CACb,GAAG,OAAO,CAAC,IAAI,sBAAsB,KAAK,CAAC,IAAI,iFAAiF,CACjI,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAnBW,QAAA,8BAA8B,kCAmBzC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./createPostBuildTestJobs"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/postBuildTest/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,4DAA0C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { TestJobCustom } from "../build/types";
|
|
2
|
+
import type { Services } from "../types/gitlab-ci-yml";
|
|
3
|
+
/**
|
|
4
|
+
* a test job that runs after the build, against the build output, and
|
|
5
|
+
* blocks the deploy when it fails (e.g. an e2e suite against the
|
|
6
|
+
* production build with a database service)
|
|
7
|
+
*/
|
|
8
|
+
export type PostBuildTestConfig = TestJobCustom & {
|
|
9
|
+
/**
|
|
10
|
+
* command(s) to run, in the build directory (component dir, or the
|
|
11
|
+
* workspace dir for workspace builds). The build artifacts (e.g.
|
|
12
|
+
* `dist`, `.next`) are already in place and dependencies are
|
|
13
|
+
* installed for node builds.
|
|
14
|
+
*
|
|
15
|
+
* The command is responsible for starting the app if it needs one,
|
|
16
|
+
* e.g. via playwright's `webServer` option running `next start`.
|
|
17
|
+
*/
|
|
18
|
+
command: string | string[];
|
|
19
|
+
/**
|
|
20
|
+
* services the job needs, e.g. a database:
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* services: [{
|
|
24
|
+
* name: "postgres:17",
|
|
25
|
+
* alias: "postgres",
|
|
26
|
+
* variables: { POSTGRES_PASSWORD: "postgres" },
|
|
27
|
+
* }]
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* The service is reachable by its alias as hostname. On github,
|
|
31
|
+
* `command` and `entrypoint` of a service are not supported.
|
|
32
|
+
*/
|
|
33
|
+
services?: Services;
|
|
34
|
+
/**
|
|
35
|
+
* variables for this job, e.g. `DATABASE_URL` pointing to a service
|
|
36
|
+
* or `BASE_URL` for the test runner.
|
|
37
|
+
*
|
|
38
|
+
* The job gets the build vars of the component (like the build and
|
|
39
|
+
* test jobs), but not the runtime vars and secrets of the deployed
|
|
40
|
+
* environment: post-build tests run before the deploy, also for
|
|
41
|
+
* merge requests, and should use their own services.
|
|
42
|
+
*/
|
|
43
|
+
vars?: Record<string, string>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* named post-build tests: each entry becomes its own job in the
|
|
47
|
+
* `post-build` stage. Set an entry to `false` to disable it (e.g. in an
|
|
48
|
+
* env-specific override).
|
|
49
|
+
*/
|
|
50
|
+
export type PostBuildTestsConfig = Record<string, PostBuildTestConfig | false>;
|
|
51
|
+
export type WithPostBuildTests = {
|
|
52
|
+
/**
|
|
53
|
+
* tests that run after the build against the build output, in the
|
|
54
|
+
* `post-build` stage between build and deploy. A failing post-build
|
|
55
|
+
* test blocks the deploy.
|
|
56
|
+
*
|
|
57
|
+
* Each entry becomes its own job, e.g. `{ e2e: { command: "pnpm test:e2e" } }`.
|
|
58
|
+
* Post-build tests don't run in tagged-release pipelines (like lint and test).
|
|
59
|
+
*/
|
|
60
|
+
postBuildTests?: PostBuildTestsConfig;
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/postBuildTest/types.ts"],"names":[],"mappings":""}
|
|
@@ -170,7 +170,10 @@ export type EnvironmentConfig = {
|
|
|
170
170
|
* `{ branch: "next" }` deploys the env on pushes to that branch —
|
|
171
171
|
* one stable environment tracking a long-lived branch.
|
|
172
172
|
*
|
|
173
|
-
* `false`
|
|
173
|
+
* `false` keeps the env but never deploys it from a pipeline (like
|
|
174
|
+
* `local`): it still exists for `catladder project setup`, secrets and
|
|
175
|
+
* catenv. To remove an env from the project entirely, disable it
|
|
176
|
+
* instead: `environments: { stage: false }`.
|
|
174
177
|
*/
|
|
175
178
|
on?: EnvOnConfig;
|
|
176
179
|
/**
|
|
@@ -220,6 +223,18 @@ export type EnvironmentConfig = {
|
|
|
220
223
|
* Inheriting from `local` is not possible, chains are followed, cycles
|
|
221
224
|
* are an error.
|
|
222
225
|
*/
|
|
226
|
+
/**
|
|
227
|
+
* the top-level `environments` config: per env either its project-wide
|
|
228
|
+
* declaration/tuning, or `false` to disable the env for the whole
|
|
229
|
+
* project (all components, setup, secrets, pipelines, catenv).
|
|
230
|
+
*/
|
|
231
|
+
export type EnvironmentsConfig = Record<string, EnvironmentConfig | false>;
|
|
232
|
+
/**
|
|
233
|
+
* the project-wide config of `env` (undefined when not declared or
|
|
234
|
+
* disabled)
|
|
235
|
+
*/
|
|
236
|
+
export declare const getEnvironmentConfig: (environments: EnvironmentsConfig | undefined, env: string) => EnvironmentConfig | undefined;
|
|
237
|
+
export declare const isEnvironmentDisabled: (environments: EnvironmentsConfig | undefined, env: string) => boolean;
|
|
223
238
|
export type EnvironmentInheritConfig = string | {
|
|
224
239
|
/** env whose per-component config overrides are inherited */
|
|
225
240
|
config?: string;
|
|
@@ -430,8 +445,11 @@ export type Config<C extends ConfigProps = never> = {
|
|
|
430
445
|
* - declare an extra env (every component deploys to it unless it
|
|
431
446
|
* opts out with `env.<name>: false`):
|
|
432
447
|
* `environments: { next: { type: "dev", on: { branch: "next" } } }`
|
|
448
|
+
* - disable an env for the whole project (no setup, secrets, jobs or
|
|
449
|
+
* catenv for any component): `environments: { stage: false }`.
|
|
450
|
+
* A single component opts out with `env.<name>: false` instead.
|
|
433
451
|
*/
|
|
434
|
-
environments?:
|
|
452
|
+
environments?: EnvironmentsConfig;
|
|
435
453
|
/**
|
|
436
454
|
* components (sub apps)
|
|
437
455
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isKnowEnvType = exports.DEFAULT_ENV_TYPES = exports.DEFAULT_ENVS = exports.ENV_TYPES = exports.envTriggerEquals = exports.isBranchTrigger = exports.ALL_PIPELINE_TRIGGERS = void 0;
|
|
3
|
+
exports.isEnvironmentDisabled = exports.getEnvironmentConfig = exports.isKnowEnvType = exports.DEFAULT_ENV_TYPES = exports.DEFAULT_ENVS = exports.ENV_TYPES = exports.envTriggerEquals = exports.isBranchTrigger = exports.ALL_PIPELINE_TRIGGERS = void 0;
|
|
4
4
|
exports.ALL_PIPELINE_TRIGGERS = [
|
|
5
5
|
"mainBranch",
|
|
6
6
|
"mr",
|
|
@@ -43,4 +43,12 @@ const isKnowEnvType = (env) => {
|
|
|
43
43
|
return env in exports.ENV_TYPES;
|
|
44
44
|
};
|
|
45
45
|
exports.isKnowEnvType = isKnowEnvType;
|
|
46
|
+
/**
|
|
47
|
+
* the project-wide config of `env` (undefined when not declared or
|
|
48
|
+
* disabled)
|
|
49
|
+
*/
|
|
50
|
+
const getEnvironmentConfig = (environments, env) => (environments === null || environments === void 0 ? void 0 : environments[env]) || undefined;
|
|
51
|
+
exports.getEnvironmentConfig = getEnvironmentConfig;
|
|
52
|
+
const isEnvironmentDisabled = (environments, env) => (environments === null || environments === void 0 ? void 0 : environments[env]) === false;
|
|
53
|
+
exports.isEnvironmentDisabled = isEnvironmentDisabled;
|
|
46
54
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/types/config.ts"],"names":[],"mappings":";;;AAea,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,OAAO,IAAA,uBAAe,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC;IAC3E,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC,CAAC;AAPW,QAAA,gBAAgB,oBAO3B;AAEF;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,GAAG,EAAE;QACH,QAAQ,EAAE,CAAC,YAAY,CAAC;KACzB;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,CAAC,IAAI,CAAC;KACjB;IACD,KAAK,EAAE;QAC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,CAAC,IAAI,CAAC;KACjB;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,CAAC,eAAe,CAAC;KAC5B;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,CAAC,eAAe,CAAC;KAC5B;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,EAAE;KACb;CACO,CAAC;AAEE,QAAA,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAS,CAAC,CAAC;AACtC,QAAA,iBAAiB,GAAG,oBAAyB,CAAC;AAGpD,MAAM,aAAa,GAAG,CAAC,GAAW,EAAkB,EAAE;IAC3D,OAAO,GAAG,IAAI,iBAAS,CAAC;AAC1B,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB;AAmMF;;;GAGG;AACI,MAAM,oBAAoB,GAAG,CAClC,YAA4C,EAC5C,GAAW,EACoB,EAAE,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,GAAG,CAAC,KAAI,SAAS,CAAC;AAHxD,QAAA,oBAAoB,wBAGoC;AAE9D,MAAM,qBAAqB,GAAG,CACnC,YAA4C,EAC5C,GAAW,EACF,EAAE,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,GAAG,CAAC,MAAK,KAAK,CAAC;AAH/B,QAAA,qBAAqB,yBAGU"}
|
|
@@ -16,7 +16,7 @@ export type CatladderJobCache = GitlabJobCache & {
|
|
|
16
16
|
cacheId?: string;
|
|
17
17
|
redundantOnExactHitOf?: string;
|
|
18
18
|
};
|
|
19
|
-
export declare const BASE_STAGES: readonly ["setup", "test", "build", "deploy", "verify", "agents", "rollback", "stop"];
|
|
19
|
+
export declare const BASE_STAGES: readonly ["setup", "test", "build", "post-build", "deploy", "verify", "agents", "rollback", "stop"];
|
|
20
20
|
export type BaseStage = (typeof BASE_STAGES)[number];
|
|
21
21
|
export type CatladderJobNeed = string | {
|
|
22
22
|
job: string;
|
|
@@ -130,7 +130,7 @@ export type CatladderJobCore<S = BaseStage> = {
|
|
|
130
130
|
/**
|
|
131
131
|
* the capabilities this job provides to other jobs.
|
|
132
132
|
* If not set, it is derived from the stage:
|
|
133
|
-
* build -> "build", test -> "qualityGate", deploy -> "deployment"
|
|
133
|
+
* build -> "build", test and post-build -> "qualityGate", deploy -> "deployment"
|
|
134
134
|
*/
|
|
135
135
|
provides?: CapabilityName[];
|
|
136
136
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/types/jobs.ts"],"names":[],"mappings":";;;AAIA,8DAA2D;AAsB9C,QAAA,WAAW,GAAG;IACzB,OAAO;IACP,MAAM;IACN,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,MAAM;CACE,CAAC;AAWE,QAAA,YAAY,GAAG;IAC1B,OAAO;IACP,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,YAAY;CACJ,CAAC;AAuOX;;;;;;;GAOG;AACH,4JAA4J;AAC5J,MAAa,YAAY;IACvB,YAAY,IAAyB;QACnC,uDAAuD;QACvD,2DAA2D;QAC3D,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAA,iCAAe,EAAC,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,IAAI,CACT,GAAkD;QAElD,OAAO,GAAG,YAAY,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC;IACnE,CAAC;CACF;AAZD,oCAYC"}
|
|
1
|
+
{"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/types/jobs.ts"],"names":[],"mappings":";;;AAIA,8DAA2D;AAsB9C,QAAA,WAAW,GAAG;IACzB,OAAO;IACP,MAAM;IACN,OAAO;IACP,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,MAAM;CACE,CAAC;AAWE,QAAA,YAAY,GAAG;IAC1B,OAAO;IACP,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,YAAY;CACJ,CAAC;AAuOX;;;;;;;GAOG;AACH,4JAA4J;AAC5J,MAAa,YAAY;IACvB,YAAY,IAAyB;QACnC,uDAAuD;QACvD,2DAA2D;QAC3D,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAA,iCAAe,EAAC,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,IAAI,CACT,GAAkD;QAElD,OAAO,GAAG,YAAY,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC;IACnE,CAAC;CACF;AAZD,oCAYC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: catladder-builds
|
|
3
|
-
description: Configuring how a component is built in a catladder project — the `build` config in catladder.ts (build types node / rails / meteor / custom, build & start commands, artifacts, caching, lint/test/audit jobs, the Docker image, project-declared job images, and shared workspace builds). Use when adding or changing a component's build, choosing a build type, wiring a Dockerfile/nginx image, declaring a custom CI job image (`images` config), tuning the build/test/lint jobs, or setting up a monorepo workspace build. Triggers on "build config", "buildCommand", "build type", "Dockerfile", "docker image", "job image", "jobImage", "custom image", "project image", "rails build", "monorepo build", "artifacts".
|
|
3
|
+
description: Configuring how a component is built in a catladder project — the `build` config in catladder.ts (build types node / rails / meteor / custom, build & start commands, artifacts, caching, lint/test/audit jobs, the Docker image, project-declared job images, and shared workspace builds). Use when adding or changing a component's build, choosing a build type, wiring a Dockerfile/nginx image, declaring a custom CI job image (`images` config), tuning the build/test/lint jobs, adding e2e tests against the build (`postBuildTests`), or setting up a monorepo workspace build. Triggers on "build config", "postBuildTests", "post-build test", "e2e", "playwright", "buildCommand", "build type", "Dockerfile", "docker image", "job image", "jobImage", "custom image", "project image", "rails build", "monorepo build", "artifacts".
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Component builds with catladder
|
|
@@ -66,6 +66,10 @@ type: `build: { from: "web" }` (see workspace builds below).
|
|
|
66
66
|
won't run).
|
|
67
67
|
- `lint` / `test` / `audit` — customize (`{ command, jobImage, … }`) or
|
|
68
68
|
set to `false` to disable that job.
|
|
69
|
+
- `postBuildTests` — named tests against the **build output** (e.g. an
|
|
70
|
+
e2e suite against the production build with a Postgres service). Each
|
|
71
|
+
entry becomes a job in the `post-build` stage between build and deploy
|
|
72
|
+
and blocks the deploy when it fails (see below).
|
|
69
73
|
- `artifactsPaths` / `artifactsExcludePaths` — extra build artifacts
|
|
70
74
|
(`dist` and `.next` are always included).
|
|
71
75
|
- `cache` — build caching (see the `catladder-pipelines` skill for the
|
|
@@ -82,11 +86,55 @@ type: `build: { from: "web" }` (see workspace builds below).
|
|
|
82
86
|
(`{ type: "nginx" | "node" | "meteor" }`) or
|
|
83
87
|
`{ type: "custom" }` (expects a `Dockerfile`).
|
|
84
88
|
|
|
89
|
+
## Post-build tests (e2e against the build)
|
|
90
|
+
|
|
91
|
+
`lint`/`test` run against the sources, in parallel with the build. Tests
|
|
92
|
+
that need the built app go into `postBuildTests`:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
build: {
|
|
96
|
+
type: "node",
|
|
97
|
+
postBuildTests: {
|
|
98
|
+
e2e: {
|
|
99
|
+
command: "pnpm test:e2e", // runs in the build dir
|
|
100
|
+
jobImage: "mcr.microsoft.com/playwright:v1.56.0-noble",
|
|
101
|
+
services: [{ name: "postgres:17", alias: "postgres",
|
|
102
|
+
variables: { POSTGRES_PASSWORD: "postgres" } }],
|
|
103
|
+
vars: { DATABASE_URL: "postgres://postgres:postgres@postgres:5432/postgres" },
|
|
104
|
+
artifacts: { paths: ["apps/web/playwright-report"] }, // repo-root relative
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
- The job (`🔬 e2e`, stage `post-build <env>`) downloads the build
|
|
111
|
+
artifacts (`.next`, `dist`, `artifactsPaths`), installs dependencies
|
|
112
|
+
for node builds, then runs `command`. The command starts the app
|
|
113
|
+
itself, e.g. playwright `webServer: { command: "pnpm start" }`.
|
|
114
|
+
Builds without artifacts (`rails`, `buildCommand: false`) just run
|
|
115
|
+
it after the build.
|
|
116
|
+
- It is a quality gate: the env's deploy waits for it; on github it is
|
|
117
|
+
part of the `catladder ✅` required check. `allowFailure: true` makes
|
|
118
|
+
it report-only.
|
|
119
|
+
- It gets the build vars plus `vars`, **not** the deployed env's
|
|
120
|
+
runtime vars/secrets — use services instead of the real database.
|
|
121
|
+
- Artifacts are uploaded also when the job fails.
|
|
122
|
+
- Not run in tagged releases. Disable one per env:
|
|
123
|
+
`env: { dev: { build: { postBuildTests: { e2e: false } } } }`.
|
|
124
|
+
- Names must not clash with other jobs of the component (e.g. `test`,
|
|
125
|
+
`lint`) — generation fails with a clear error.
|
|
126
|
+
- Workspace builds: on `builds.<ws>` they block the deploys of all
|
|
127
|
+
components in the workspace; on `build: { from: "<ws>", postBuildTests }`
|
|
128
|
+
only that component's deploy.
|
|
129
|
+
- To test the **deployed** env instead (smoke tests on dev / review
|
|
130
|
+
apps), use the component's `verify` (post-deploy, does not block the
|
|
131
|
+
deploy). The same suite can serve both, with `BASE_URL` as the switch.
|
|
132
|
+
|
|
85
133
|
## Project images (custom CI job images)
|
|
86
134
|
|
|
87
135
|
When a job needs a toolchain catladder doesn't ship (Java, Playwright,
|
|
88
136
|
…), declare a Docker image at the top level under `images` and reference
|
|
89
|
-
it in any `jobImage` field (build, `test.jobImage`, custom/pages deploy,
|
|
137
|
+
it in any `jobImage` field (build, `test.jobImage`, `postBuildTests`, custom/pages deploy,
|
|
90
138
|
verify):
|
|
91
139
|
|
|
92
140
|
```ts
|
|
@@ -12,6 +12,7 @@ generated pipeline files.
|
|
|
12
12
|
| `startCommand` | `string` | runtime start command |
|
|
13
13
|
| `postInstall` | `string \| string[]` | runs after the package-manager install (node family) |
|
|
14
14
|
| `lint` / `test` / `audit` | `false \| TestJobCustom` | customize or disable the job |
|
|
15
|
+
| `postBuildTests` | `Record<string, PostBuildTestConfig \| false>` | named tests against the build output in the `post-build` stage; block the deploy |
|
|
15
16
|
| `artifactsPaths` | `string[]` | extra artifacts (`dist`, `.next` always included) |
|
|
16
17
|
| `artifactsExcludePaths` | `string[]` | artifact excludes |
|
|
17
18
|
| `artifactsReports` | `{ junit?: string[] }` | CI test report paths |
|
|
@@ -27,6 +28,13 @@ generated pipeline files.
|
|
|
27
28
|
`artifactsReports`, `artifacts`, `runnerVariables`, `allowFailure`
|
|
28
29
|
(`allowFailure` defaults to `true` for `audit`).
|
|
29
30
|
|
|
31
|
+
`PostBuildTestConfig` (for `postBuildTests` entries): `TestJobCustom` with
|
|
32
|
+
a required `command`, plus `services?: Services` (gitlab shape, reachable
|
|
33
|
+
by alias) and `vars?: Record<string,string>`. The job gets the build
|
|
34
|
+
artifacts, the build vars and `vars` (not the deployed env's runtime
|
|
35
|
+
vars), installs dependencies for node builds, and uploads `artifacts`
|
|
36
|
+
also on failure.
|
|
37
|
+
|
|
30
38
|
`audit` additionally takes `level`: `"info" | "low" | "moderate" | "high" |
|
|
31
39
|
"critical"` (default `"critical"`) — the lowest severity that fails the job,
|
|
32
40
|
translated to the package manager's own flag (`pnpm audit --audit-level`,
|
|
@@ -81,5 +89,5 @@ defaulted `buildCommand: "yarn build-storybook --quiet -o ./dist"`.
|
|
|
81
89
|
Top-level `builds: Record<string, WorkspaceBuildConfig>`. Only
|
|
82
90
|
`type: "node"` is supported.
|
|
83
91
|
|
|
84
|
-
- Node workspace build: `dir?`, `buildCommand?` (default `<pm> build`), `dockerDefaults?: { yarnRebuildEnabled }`, plus shared `lint?` (default `{ command: "<pm> lint" }`), `test?` (default `{ command: "<pm> test" }`), `audit?`, `runnerVariables?`, `artifactsReports?`, `jobImage?`, `jobTags?`, `cache?` (`<pm>` = `yarn`/`pnpm` per detection).
|
|
85
|
-
- A component references it via `build: { from: "<name>", docker?, startCommand?, artifactsPaths?, artifactsExcludePaths?, cache? }` — the per-component overrides layer on top of the shared build.
|
|
92
|
+
- Node workspace build: `dir?`, `buildCommand?` (default `<pm> build`), `dockerDefaults?: { yarnRebuildEnabled }`, plus shared `lint?` (default `{ command: "<pm> lint" }`), `test?` (default `{ command: "<pm> test" }`), `audit?`, `postBuildTests?` (block the deploys of all its components), `runnerVariables?`, `artifactsReports?`, `jobImage?`, `jobTags?`, `cache?` (`<pm>` = `yarn`/`pnpm` per detection).
|
|
93
|
+
- A component references it via `build: { from: "<name>", docker?, startCommand?, artifactsPaths?, artifactsExcludePaths?, cache?, postBuildTests? }` — the per-component overrides layer on top of the shared build.
|
|
@@ -33,20 +33,23 @@ const config = {
|
|
|
33
33
|
appName: "my-app",
|
|
34
34
|
customerName: "pan",
|
|
35
35
|
pipelines: { gitlab: true, github: true }, // which CI systems to generate
|
|
36
|
-
environments: {
|
|
36
|
+
environments: {
|
|
37
|
+
// optional: project-wide env declarations/tuning
|
|
37
38
|
review: { autoStop: "3 days" },
|
|
39
|
+
stage: false, // the project has no stage env (any component)
|
|
38
40
|
next: { type: "dev", on: { branch: "next" } }, // extra branch-tracking env
|
|
39
41
|
},
|
|
40
42
|
components: {
|
|
41
43
|
www: {
|
|
42
|
-
dir: "frontend",
|
|
43
|
-
vars: { public: {}, secret: [] },
|
|
44
|
-
build: { type: "node" },
|
|
44
|
+
dir: "frontend", // working directory of this component
|
|
45
|
+
vars: { public: {}, secret: [] }, // env vars (see catladder-secrets skill)
|
|
46
|
+
build: { type: "node" }, // node | rails | meteor | custom — see catladder-builds
|
|
45
47
|
deploy: { type: "kubernetes" }, // kubernetes | google-cloudrun | dockerTag | custom — see catladder-deploys
|
|
46
|
-
env: {
|
|
48
|
+
env: {
|
|
49
|
+
// enable/customize per environment
|
|
47
50
|
review: {},
|
|
48
51
|
dev: {},
|
|
49
|
-
stage: false,
|
|
52
|
+
stage: false, // false disables the env for this component only
|
|
50
53
|
prod: {},
|
|
51
54
|
},
|
|
52
55
|
},
|
|
@@ -68,9 +71,17 @@ Key concepts:
|
|
|
68
71
|
per-component `env.<name>` entries only carry component-local
|
|
69
72
|
overrides (vars, deploy settings, host, autoStop) or `false` to opt
|
|
70
73
|
the component out. In `environments`:
|
|
74
|
+
- `<name>: false` — disables the env for the whole project: no
|
|
75
|
+
component has it, so no setup contexts (`catladder project setup`),
|
|
76
|
+
secrets, pipeline jobs/workflows or catenv for it. This is how to
|
|
77
|
+
say "this project has no stage": `environments: { stage: false }`
|
|
78
|
+
(not `on: false`). `local` cannot be disabled; inheriting from a
|
|
79
|
+
disabled env is an error.
|
|
71
80
|
- `on` — when the env deploys: `"mainBranch"`, `"mr"`,
|
|
72
81
|
`"taggedRelease"`, `{ branch: "next" }` (a stable env deploying on
|
|
73
|
-
pushes to that branch), or `false` (
|
|
82
|
+
pushes to that branch), or `false` (never deployed by a pipeline —
|
|
83
|
+
the env still exists for setup, secrets and catenv; use
|
|
84
|
+
`environments.<name>: false` to remove it). `on: "mr"`
|
|
74
85
|
makes an env a review app (one instance per MR/PR, torn down on
|
|
75
86
|
close). Defaults from the env type.
|
|
76
87
|
- `autoStop` — how long a stoppable environment stays up after its
|