@catladder/cli 5.5.0 → 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 +364 -45
- 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 +364 -45
- 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-pipelines/SKILL.md +18 -2
- 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/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/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-pipelines/SKILL.md +18 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -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,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;AAEF,MAAM,kBAAkB,GAAG,CAAC,GAAiB,EAAE,UAA0B,EAAE,EAAE;;IAC3E,MAAM,YAAY,GAAG,0BAA0B,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,MAAA,GAAG,CAAC,QAAQ,mCAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACtE,OAAO,QAAQ,CAAC,IAAI,CAClB,CAAC,CAAC,EAAE,EAAE;;QACJ,OAAA,CAAC,KAAK,UAAU;YAChB,CAAC,MAAA,uBAAuB,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;KAAA,CAC1D,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;GAOG;AACI,MAAM,mBAAmB,GAAG,CACjC,OAAyB,EACP,EAAE;IACpB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAC/C,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC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AAI,IAAI,CACrD,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;;QAChC,OAAA,aAAa;YACX,CAAC,CAAC;gBACE,GAAG,EAAE,QAAQ,CAAC,IAAI;gBAClB,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,KAAK;gBAC7B,aAAa;aACd;YACH,CAAC,CAAC;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"}
|
|
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;AAEF,MAAM,kBAAkB,GAAG,CAAC,GAAiB,EAAE,UAA0B,EAAE,EAAE;;IAC3E,MAAM,YAAY,GAAG,0BAA0B,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,MAAA,GAAG,CAAC,QAAQ,mCAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACtE,OAAO,QAAQ,CAAC,IAAI,CAClB,CAAC,CAAC,EAAE,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kB,CAAC,SAAS,EAAE,UAAU,CAAC,CACjE,CAAC;IAEF,mEAAmE;IACnE,MAAM,QAAQ,GAAG,MAAA,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,SAAS,mCAAI,KAAK,CAAC;IAE9C,IAAI,QAAQ,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,oBAAoB,UAAU,SAAS,GAAG,IACxC,MAAA,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,mCAAI,OAAO,CAAC,IAC9C,mBAAmB,GAAG,CAAC,IAAI,SAAS,OAAO,CAAC,IAAI,IAAI,CACrD,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;;QAChC,OAAA,aAAa;YACX,CAAC,CAAC;gBACE,GAAG,EAAE,QAAQ,CAAC,IAAI;gBAClB,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,KAAK;gBAC7B,aAAa;aACd;YACH,CAAC,CAAC;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,16 @@
|
|
|
1
|
+
import type { ComponentContext, WorkspaceContext } from "../types/context";
|
|
2
|
+
import { CatladderJob } from "../types/jobs";
|
|
3
|
+
export declare const POST_BUILD_TEST_STAGE = "post-build";
|
|
4
|
+
export declare const postBuildTestJobName: (name: string) => string;
|
|
5
|
+
/**
|
|
6
|
+
* jobs for `postBuildTests`: they run after the build in the `post-build`
|
|
7
|
+
* stage, against the build artifacts, and act as quality gates, so a
|
|
8
|
+
* failing post-build test blocks the deploy.
|
|
9
|
+
*/
|
|
10
|
+
export declare const createPostBuildTestJobs: (context: ComponentContext | WorkspaceContext) => Promise<CatladderJob[]>;
|
|
11
|
+
/**
|
|
12
|
+
* post-build test names are chosen by the user. Github job ids drop the
|
|
13
|
+
* emoji of the job name, so e.g. a post-build test named `test` would
|
|
14
|
+
* clash with the `🧪 test` job.
|
|
15
|
+
*/
|
|
16
|
+
export declare const assertUniquePostBuildTestNames: (context: ComponentContext | WorkspaceContext, postBuildTestJobs: CatladderJob[], otherJobs: CatladderJob[]) => void;
|
|
@@ -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,OA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EAAE,CAClC,OAAO;KACJ,WAAW,EAAE;KACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;KAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAE7B;;;;GAIG;AACI,MAAM,8BAA8B,GAAG,CAC5C,OAA4C,EAC5C,iBAAiC,EACjC,SAAyB,EACzB,EAAE;IACF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnE,gEAAgE;IAChE,qCAAqC;IACrC,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;QAC3C,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;IACH,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,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":""}
|
|
@@ -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.
|
|
@@ -46,8 +46,9 @@ review app`); the same workflow can be dispatched with a PR number to
|
|
|
46
46
|
tear one down while the pull request is still open (gitlab runs these as manual jobs inside the pipeline
|
|
47
47
|
instead).
|
|
48
48
|
|
|
49
|
-
Stages: setup → test → build →
|
|
50
|
-
|
|
49
|
+
Stages: setup → test → build → post-build (`postBuildTests` against
|
|
50
|
+
the build output, block the deploy) → deploy → verify (post-deploy
|
|
51
|
+
checks), plus stop jobs for review-app teardown.
|
|
51
52
|
|
|
52
53
|
## Superseded pipelines are cancelled
|
|
53
54
|
|
|
@@ -151,6 +152,21 @@ pipelines: { github: { repository: "AcmeCorp/Nautilus" } },
|
|
|
151
152
|
`yarn catladder project doctor` reports a mixed-case repository whose
|
|
152
153
|
generated workflows still carry the expression.
|
|
153
154
|
|
|
155
|
+
### Artifacts between jobs (GitHub)
|
|
156
|
+
|
|
157
|
+
A job's `artifacts.paths` are handed to the jobs that need them as one
|
|
158
|
+
tar archive (`catladder-artifacts-<job-id>.tar`): an "Archive
|
|
159
|
+
artifacts" step tars them after the job, `upload-artifact` uploads the
|
|
160
|
+
archive under the job id, and the consumers get a matching "Extract
|
|
161
|
+
artifacts" step after `download-artifact`. The tar keeps symlinks, file
|
|
162
|
+
modes and repo-relative paths, as GitLab artifacts do. Plain
|
|
163
|
+
`upload-artifact` loses them, which breaks Next.js/Turbopack builds in
|
|
164
|
+
pnpm workspaces: `.next/node_modules/<pkg>-<hash>` are symlinks into
|
|
165
|
+
the pnpm store, and as copied directories they fail at runtime with
|
|
166
|
+
`ERR_MODULE_NOT_FOUND`. If a deployed app shows that error, check that
|
|
167
|
+
the committed workflows contain the archive steps and regenerate if
|
|
168
|
+
they don't.
|
|
169
|
+
|
|
154
170
|
## Caching
|
|
155
171
|
|
|
156
172
|
Cache configuration is generated per build type. **yarn** node builds
|