@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
|
@@ -3102,6 +3102,97 @@ exports.makeAggregateCheckJob = makeAggregateCheckJob;
|
|
|
3102
3102
|
|
|
3103
3103
|
/***/ }),
|
|
3104
3104
|
|
|
3105
|
+
/***/ 75125:
|
|
3106
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3107
|
+
|
|
3108
|
+
"use strict";
|
|
3109
|
+
|
|
3110
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3111
|
+
exports.createArtifactDownloadSteps = exports.createArtifactUploadSteps = exports.artifactArchiveFile = void 0;
|
|
3112
|
+
/**
|
|
3113
|
+
* Artifacts are handed between github jobs as ONE tar archive instead
|
|
3114
|
+
* of letting upload-artifact walk the paths itself.
|
|
3115
|
+
*
|
|
3116
|
+
* upload-artifact does not preserve symlinks (it uploads the target's
|
|
3117
|
+
* content) nor file modes, and it strips the paths' common ancestor.
|
|
3118
|
+
* Gitlab artifacts keep all of that, and builds rely on it: next.js
|
|
3119
|
+
* with turbopack writes `.next/node_modules/<pkg>-<hash>` as relative
|
|
3120
|
+
* symlinks into the pnpm virtual store. Copied as plain directories,
|
|
3121
|
+
* node resolves the package's own dependencies from the wrong place
|
|
3122
|
+
* and the app crashes with ERR_MODULE_NOT_FOUND at runtime. tar keeps
|
|
3123
|
+
* symlinks, modes and the paths relative to the repo root (github's
|
|
3124
|
+
* own docs recommend it for exactly this).
|
|
3125
|
+
*
|
|
3126
|
+
* The archive is not hidden (upload-artifact skips hidden files) and
|
|
3127
|
+
* lives in the workspace, the one path run steps and actions agree on
|
|
3128
|
+
* inside job containers too.
|
|
3129
|
+
*/
|
|
3130
|
+
const artifactArchiveFile = (jobId) => `catladder-artifacts-${jobId}.tar`;
|
|
3131
|
+
exports.artifactArchiveFile = artifactArchiveFile;
|
|
3132
|
+
const createArtifactUploadSteps = (jobId, paths, condition) => {
|
|
3133
|
+
const archive = (0, exports.artifactArchiveFile)(jobId);
|
|
3134
|
+
const ifCondition = condition ? { if: condition } : {};
|
|
3135
|
+
return [
|
|
3136
|
+
{
|
|
3137
|
+
name: "Archive artifacts",
|
|
3138
|
+
...ifCondition,
|
|
3139
|
+
run: [
|
|
3140
|
+
"shopt -s nullglob globstar",
|
|
3141
|
+
"paths=()",
|
|
3142
|
+
// unquoted on purpose: artifact paths may be globs. Non-matching
|
|
3143
|
+
// globs vanish (nullglob), missing literal paths are skipped —
|
|
3144
|
+
// gitlab only warns about both, so do we
|
|
3145
|
+
`for path in ${paths.join(" ")}; do`,
|
|
3146
|
+
' if [ -e "$path" ] || [ -L "$path" ]; then paths+=("$path"); else echo "::warning::artifact path not found: $path"; fi',
|
|
3147
|
+
"done",
|
|
3148
|
+
"if [ ${#paths[@]} -eq 0 ]; then",
|
|
3149
|
+
// an empty archive keeps downstream downloads from failing.
|
|
3150
|
+
// Written by hand: busybox tar (alpine job images) refuses to
|
|
3151
|
+
// create one, and zero blocks are what an empty tar is
|
|
3152
|
+
` head -c 10240 /dev/zero > ${archive}`,
|
|
3153
|
+
"else",
|
|
3154
|
+
` tar -cf ${archive} -- "\${paths[@]}"`,
|
|
3155
|
+
"fi",
|
|
3156
|
+
].join("\n"),
|
|
3157
|
+
shell: "bash",
|
|
3158
|
+
},
|
|
3159
|
+
{
|
|
3160
|
+
name: "Upload artifacts",
|
|
3161
|
+
...ifCondition,
|
|
3162
|
+
uses: "actions/upload-artifact@v4",
|
|
3163
|
+
with: {
|
|
3164
|
+
name: jobId,
|
|
3165
|
+
path: archive,
|
|
3166
|
+
"if-no-files-found": "error",
|
|
3167
|
+
},
|
|
3168
|
+
},
|
|
3169
|
+
];
|
|
3170
|
+
};
|
|
3171
|
+
exports.createArtifactUploadSteps = createArtifactUploadSteps;
|
|
3172
|
+
const createArtifactDownloadSteps = (providerIds) => providerIds.length === 0
|
|
3173
|
+
? []
|
|
3174
|
+
: [
|
|
3175
|
+
...providerIds.map((id) => ({
|
|
3176
|
+
name: `Download artifacts from ${id}`,
|
|
3177
|
+
uses: "actions/download-artifact@v4",
|
|
3178
|
+
with: { name: id },
|
|
3179
|
+
})),
|
|
3180
|
+
{
|
|
3181
|
+
name: "Extract artifacts",
|
|
3182
|
+
run: providerIds
|
|
3183
|
+
.flatMap((id) => [
|
|
3184
|
+
`tar -xf ${(0, exports.artifactArchiveFile)(id)}`,
|
|
3185
|
+
`rm ${(0, exports.artifactArchiveFile)(id)}`,
|
|
3186
|
+
])
|
|
3187
|
+
.join("\n"),
|
|
3188
|
+
shell: "bash",
|
|
3189
|
+
},
|
|
3190
|
+
];
|
|
3191
|
+
exports.createArtifactDownloadSteps = createArtifactDownloadSteps;
|
|
3192
|
+
//# sourceMappingURL=artifactArchive.js.map
|
|
3193
|
+
|
|
3194
|
+
/***/ }),
|
|
3195
|
+
|
|
3105
3196
|
/***/ 17300:
|
|
3106
3197
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3107
3198
|
|
|
@@ -3171,6 +3262,7 @@ const utils_1 = __nccwpck_require__(49401);
|
|
|
3171
3262
|
const gitlab_1 = __nccwpck_require__(86962);
|
|
3172
3263
|
const scriptFunctions_1 = __nccwpck_require__(85873);
|
|
3173
3264
|
const ciVariables_1 = __nccwpck_require__(17300);
|
|
3265
|
+
const artifactArchive_1 = __nccwpck_require__(75125);
|
|
3174
3266
|
/**
|
|
3175
3267
|
* runner variables that only make sense on gitlab runners and must not
|
|
3176
3268
|
* leak into github jobs (docker-in-docker daemon config, kubernetes
|
|
@@ -3381,7 +3473,7 @@ const getReferencedSecretsEnv = (script, kinds) => Object.fromEntries([...script
|
|
|
3381
3473
|
.filter((name) => !ciVariables_1.GITHUB_INJECTED_WORKFLOW_ENV_NAMES.has(name))
|
|
3382
3474
|
.map((name) => [name, vaultValueExpression(name, kinds)]));
|
|
3383
3475
|
const makeGithubJob = (context, job, allJobs, uploadProviderIds, images, scripts, secretKinds = new Map()) => {
|
|
3384
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
3476
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
3385
3477
|
const id = (0, exports.githubJobId)(context, job.name);
|
|
3386
3478
|
const isComponent = context.type === "component";
|
|
3387
3479
|
const createsJobEnv = !!job.environment &&
|
|
@@ -3526,13 +3618,7 @@ const makeGithubJob = (context, job, allJobs, uploadProviderIds, images, scripts
|
|
|
3526
3618
|
? []
|
|
3527
3619
|
: [{ name: "Checkout", uses: "actions/checkout@v4" }]),
|
|
3528
3620
|
...createCacheSteps(context, job),
|
|
3529
|
-
...needs
|
|
3530
|
-
.filter((n) => n.artifacts)
|
|
3531
|
-
.map((n) => ({
|
|
3532
|
-
name: `Download artifacts from ${n.id}`,
|
|
3533
|
-
uses: "actions/download-artifact@v4",
|
|
3534
|
-
with: { name: n.id },
|
|
3535
|
-
})),
|
|
3621
|
+
...(0, artifactArchive_1.createArtifactDownloadSteps)(needs.filter((n) => n.artifacts).map((n) => n.id)),
|
|
3536
3622
|
{
|
|
3537
3623
|
name: job.name,
|
|
3538
3624
|
id: "main",
|
|
@@ -3553,27 +3639,15 @@ const makeGithubJob = (context, job, allJobs, uploadProviderIds, images, scripts
|
|
|
3553
3639
|
},
|
|
3554
3640
|
]
|
|
3555
3641
|
: []),
|
|
3556
|
-
...(pagesPublishDir
|
|
3557
|
-
?
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
name: id,
|
|
3566
|
-
path: artifactPaths.join("\n"),
|
|
3567
|
-
"if-no-files-found": "warn",
|
|
3568
|
-
// gitlab artifacts include everything; upload-artifact
|
|
3569
|
-
// silently drops hidden files by default — which is
|
|
3570
|
-
// exactly where next.js builds live (.next)
|
|
3571
|
-
"include-hidden-files": true,
|
|
3572
|
-
},
|
|
3573
|
-
},
|
|
3574
|
-
]
|
|
3575
|
-
: []
|
|
3576
|
-
: []),
|
|
3642
|
+
...(!pagesPublishDir && artifactPaths.length > 0
|
|
3643
|
+
? (0, artifactArchive_1.createArtifactUploadSteps)(id, artifactPaths,
|
|
3644
|
+
// gitlab's `artifacts.when`: steps only run on success by default
|
|
3645
|
+
((_k = job.artifacts) === null || _k === void 0 ? void 0 : _k.when) === "always"
|
|
3646
|
+
? "always()"
|
|
3647
|
+
: ((_l = job.artifacts) === null || _l === void 0 ? void 0 : _l.when) === "on_failure"
|
|
3648
|
+
? "failure()"
|
|
3649
|
+
: undefined)
|
|
3650
|
+
: []),
|
|
3577
3651
|
],
|
|
3578
3652
|
};
|
|
3579
3653
|
return [id, githubJob];
|
|
@@ -4266,7 +4340,6 @@ class GitlabBackend {
|
|
|
4266
4340
|
return [mainInclude, ...componentIncludes];
|
|
4267
4341
|
}
|
|
4268
4342
|
async createPipeline(config, images) {
|
|
4269
|
-
const stages = (0, getPipelineStages_1.getPipelineStages)(config);
|
|
4270
4343
|
// register the release image first: the per-trigger job creation
|
|
4271
4344
|
// below emits the build jobs of all images registered so far. The
|
|
4272
4345
|
// release jobs themselves are created afterwards — they need the
|
|
@@ -4285,6 +4358,9 @@ class GitlabBackend {
|
|
|
4285
4358
|
jobs: await (0, createGitlabJobs_1.createGitlabJobs)(await (0, createAllJobs_1.createAllJobs)({ config, trigger, pipelineType: this.type }), images, getGitlabRulesForTrigger(trigger)),
|
|
4286
4359
|
})));
|
|
4287
4360
|
const allJobsPerTrigger = jobsPerTrigger.flatMap(({ jobs }) => jobs);
|
|
4361
|
+
const stages = (0, getPipelineStages_1.getPipelineStages)(config, new Set(allJobsPerTrigger
|
|
4362
|
+
.map(({ gitlabJob }) => gitlabJob.stage)
|
|
4363
|
+
.filter((stage) => typeof stage === "string")));
|
|
4288
4364
|
// the jobs the queued-release executor waits for: everything that
|
|
4289
4365
|
// runs automatically in a main-branch pipeline. Manual jobs (stop,
|
|
4290
4366
|
// rollback, gates) are excluded — gitlab skips a job whose needs
|
|
@@ -4939,14 +5015,23 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
4939
5015
|
exports.getPipelineStages = void 0;
|
|
4940
5016
|
const config_1 = __nccwpck_require__(11646);
|
|
4941
5017
|
const jobs_1 = __nccwpck_require__(98521);
|
|
5018
|
+
/**
|
|
5019
|
+
* stages that only appear in the pipeline when a job uses them, so that
|
|
5020
|
+
* projects not using the feature keep their generated files unchanged
|
|
5021
|
+
*/
|
|
5022
|
+
const OPTIONAL_STAGES = ["post-build"];
|
|
4942
5023
|
/**
|
|
4943
5024
|
* while technically not required, we group different envs in its own stage
|
|
4944
5025
|
* each job from `createJobs` that is defined as `envMode: "stagePerEnv"` will have `deploy dev`, etc. instead of just `deploy`
|
|
4945
5026
|
* this is just so that it looks nicer in gitlab and makes running mutliple manual tasks more easy to use
|
|
5027
|
+
*
|
|
5028
|
+
* `usedStages` are the stages of all generated jobs; optional stages are
|
|
5029
|
+
* dropped when none of them is used.
|
|
4946
5030
|
*/
|
|
4947
|
-
function getPipelineStages(config) {
|
|
5031
|
+
function getPipelineStages(config, usedStages = new Set()) {
|
|
4948
5032
|
const allEnvs = (0, config_1.getAllEnvsInAllComponents)(config).filter((e) => e !== "local");
|
|
4949
|
-
const
|
|
5033
|
+
const isUsed = (baseStage) => [...usedStages].some((stage) => stage === baseStage || stage.startsWith(`${baseStage} `));
|
|
5034
|
+
const stages = jobs_1.BASE_STAGES.filter((baseStage) => !OPTIONAL_STAGES.includes(baseStage) || isUsed(baseStage)).reduce((acc, baseStage) => [
|
|
4950
5035
|
...acc,
|
|
4951
5036
|
baseStage,
|
|
4952
5037
|
...allEnvs.map((e) => `${baseStage} ${e}`),
|
|
@@ -9030,14 +9115,20 @@ class DeployJob extends jobs_1.CatladderJob {
|
|
|
9030
9115
|
: []),
|
|
9031
9116
|
];
|
|
9032
9117
|
// we don't want to deploy when there is a broken test
|
|
9033
|
-
const
|
|
9034
|
-
|
|
9035
|
-
artifacts: false,
|
|
9036
|
-
//
|
|
9037
|
-
|
|
9038
|
-
?
|
|
9039
|
-
|
|
9040
|
-
|
|
9118
|
+
const qualityGateRequirements = [
|
|
9119
|
+
// the component's own gates (e.g. post-build tests, custom test jobs)
|
|
9120
|
+
{ capability: "qualityGate", artifacts: false },
|
|
9121
|
+
// ...and the gates of the workspace build it is built in
|
|
9122
|
+
...((0, context_1.componentContextHasWorkspaceBuild)(context)
|
|
9123
|
+
? [
|
|
9124
|
+
{
|
|
9125
|
+
capability: "qualityGate",
|
|
9126
|
+
artifacts: false,
|
|
9127
|
+
from: { workspace: context.build.workspaceName },
|
|
9128
|
+
},
|
|
9129
|
+
]
|
|
9130
|
+
: []),
|
|
9131
|
+
];
|
|
9041
9132
|
super({
|
|
9042
9133
|
name: exports.DEPLOY_JOB_NAME,
|
|
9043
9134
|
script: jobDefinition.script,
|
|
@@ -9054,7 +9145,7 @@ class DeployJob extends jobs_1.CatladderJob {
|
|
|
9054
9145
|
...waitForRequirements,
|
|
9055
9146
|
// if the build is disabled, we don't need to wait for it
|
|
9056
9147
|
...(context.build.type !== "disabled"
|
|
9057
|
-
? [...buildRequirements,
|
|
9148
|
+
? [...buildRequirements, ...qualityGateRequirements]
|
|
9058
9149
|
: []),
|
|
9059
9150
|
],
|
|
9060
9151
|
gate: whenDeploy,
|
|
@@ -11830,6 +11921,7 @@ __exportStar(__nccwpck_require__(15707), exports);
|
|
|
11830
11921
|
__exportStar(__nccwpck_require__(45492), exports);
|
|
11831
11922
|
__exportStar(__nccwpck_require__(3659), exports);
|
|
11832
11923
|
__exportStar(__nccwpck_require__(50713), exports);
|
|
11924
|
+
__exportStar(__nccwpck_require__(28458), exports);
|
|
11833
11925
|
__exportStar(__nccwpck_require__(26041), exports);
|
|
11834
11926
|
__exportStar(__nccwpck_require__(47663), exports);
|
|
11835
11927
|
__exportStar(__nccwpck_require__(91804), exports);
|
|
@@ -12427,6 +12519,7 @@ exports.createJobsForComponentContext = void 0;
|
|
|
12427
12519
|
const build_1 = __nccwpck_require__(45492);
|
|
12428
12520
|
const deploy_1 = __nccwpck_require__(3659);
|
|
12429
12521
|
const jobs_1 = __nccwpck_require__(98521);
|
|
12522
|
+
const createPostBuildTestJobs_1 = __nccwpck_require__(61844);
|
|
12430
12523
|
const createVerifyJobs_1 = __nccwpck_require__(66900);
|
|
12431
12524
|
const injectDefaultVarsInCustomJobs = (context, jobs) => jobs.map(({ variables, ...job }) => {
|
|
12432
12525
|
var _a;
|
|
@@ -12446,17 +12539,26 @@ const getCustomJobs = (context) => {
|
|
|
12446
12539
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
12447
12540
|
};
|
|
12448
12541
|
const createJobsForComponentContext = async (context) => {
|
|
12449
|
-
const [buildJobs, deployJobs, verifyJobs] = await Promise.all([
|
|
12542
|
+
const [buildJobs, postBuildTestJobs, deployJobs, verifyJobs] = await Promise.all([
|
|
12450
12543
|
context.build.type !== "disabled"
|
|
12451
12544
|
? build_1.BUILD_TYPES[context.build.buildType].jobs(context)
|
|
12452
12545
|
: [],
|
|
12546
|
+
(0, createPostBuildTestJobs_1.createPostBuildTestJobs)(context),
|
|
12453
12547
|
context.componentConfig.deploy !== false
|
|
12454
12548
|
? deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context)
|
|
12455
12549
|
: [],
|
|
12456
12550
|
(0, createVerifyJobs_1.createVerifyJobs)(context),
|
|
12457
12551
|
]);
|
|
12458
12552
|
const customJobs = getCustomJobs(context);
|
|
12459
|
-
|
|
12553
|
+
const otherJobs = [...buildJobs, ...deployJobs, ...verifyJobs, ...customJobs];
|
|
12554
|
+
(0, createPostBuildTestJobs_1.assertUniquePostBuildTestNames)(context, postBuildTestJobs, otherJobs);
|
|
12555
|
+
return [
|
|
12556
|
+
...buildJobs,
|
|
12557
|
+
...postBuildTestJobs,
|
|
12558
|
+
...deployJobs,
|
|
12559
|
+
...verifyJobs,
|
|
12560
|
+
...customJobs,
|
|
12561
|
+
];
|
|
12460
12562
|
};
|
|
12461
12563
|
exports.createJobsForComponentContext = createJobsForComponentContext;
|
|
12462
12564
|
//# sourceMappingURL=createJobsForComponent.js.map
|
|
@@ -12471,9 +12573,14 @@ exports.createJobsForComponentContext = createJobsForComponentContext;
|
|
|
12471
12573
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12472
12574
|
exports.createJobsForWorkspace = void 0;
|
|
12473
12575
|
const build_1 = __nccwpck_require__(45492);
|
|
12576
|
+
const createPostBuildTestJobs_1 = __nccwpck_require__(61844);
|
|
12474
12577
|
const createJobsForWorkspace = async (context) => {
|
|
12475
|
-
const buildJobs = await
|
|
12476
|
-
|
|
12578
|
+
const [buildJobs, postBuildTestJobs] = await Promise.all([
|
|
12579
|
+
build_1.WORKSPACE_BUILD_TYPES[context.build.buildType].jobs(context),
|
|
12580
|
+
(0, createPostBuildTestJobs_1.createPostBuildTestJobs)(context),
|
|
12581
|
+
]);
|
|
12582
|
+
(0, createPostBuildTestJobs_1.assertUniquePostBuildTestNames)(context, postBuildTestJobs, buildJobs);
|
|
12583
|
+
return [...buildJobs, ...postBuildTestJobs];
|
|
12477
12584
|
};
|
|
12478
12585
|
exports.createJobsForWorkspace = createJobsForWorkspace;
|
|
12479
12586
|
//# sourceMappingURL=createJobsForWorkspace.js.map
|
|
@@ -12942,6 +13049,7 @@ exports.resolveRequirements = void 0;
|
|
|
12942
13049
|
const DEFAULT_STAGE_CAPABILITIES = {
|
|
12943
13050
|
build: "build",
|
|
12944
13051
|
test: "qualityGate",
|
|
13052
|
+
"post-build": "qualityGate",
|
|
12945
13053
|
deploy: "deployment",
|
|
12946
13054
|
};
|
|
12947
13055
|
/**
|
|
@@ -13083,6 +13191,216 @@ exports.getWorkspaceDependencies = getWorkspaceDependencies;
|
|
|
13083
13191
|
|
|
13084
13192
|
/***/ }),
|
|
13085
13193
|
|
|
13194
|
+
/***/ 61844:
|
|
13195
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
13196
|
+
|
|
13197
|
+
"use strict";
|
|
13198
|
+
|
|
13199
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
13200
|
+
exports.assertUniquePostBuildTestNames = exports.createPostBuildTestJobs = exports.postBuildTestJobName = exports.POST_BUILD_TEST_STAGE = void 0;
|
|
13201
|
+
const createArtifactsConfig_1 = __nccwpck_require__(14149);
|
|
13202
|
+
const cache_1 = __nccwpck_require__(74559);
|
|
13203
|
+
const constants_1 = __nccwpck_require__(5576);
|
|
13204
|
+
const packageManagerInstall_1 = __nccwpck_require__(28419);
|
|
13205
|
+
const types_1 = __nccwpck_require__(35249);
|
|
13206
|
+
const runner_1 = __nccwpck_require__(92146);
|
|
13207
|
+
const jobs_1 = __nccwpck_require__(98521);
|
|
13208
|
+
const utils_1 = __nccwpck_require__(49401);
|
|
13209
|
+
exports.POST_BUILD_TEST_STAGE = "post-build";
|
|
13210
|
+
const postBuildTestJobName = (name) => `🔬 ${name}`;
|
|
13211
|
+
exports.postBuildTestJobName = postBuildTestJobName;
|
|
13212
|
+
const getPostBuildTestsConfig = (context) => {
|
|
13213
|
+
if (context.type === "workspace") {
|
|
13214
|
+
return context.build.config.postBuildTests;
|
|
13215
|
+
}
|
|
13216
|
+
if (context.build.type === "disabled") {
|
|
13217
|
+
return undefined;
|
|
13218
|
+
}
|
|
13219
|
+
return context.build.config.postBuildTests;
|
|
13220
|
+
};
|
|
13221
|
+
/**
|
|
13222
|
+
* whether the build output is a node project, so the job has to install
|
|
13223
|
+
* the dependencies before running the tests
|
|
13224
|
+
*/
|
|
13225
|
+
const isNodeBuild = (context) => {
|
|
13226
|
+
if (context.type === "workspace") {
|
|
13227
|
+
return true; // workspace builds are node builds
|
|
13228
|
+
}
|
|
13229
|
+
if (context.build.type === "fromWorkspace") {
|
|
13230
|
+
return true;
|
|
13231
|
+
}
|
|
13232
|
+
if (context.build.type === "standalone") {
|
|
13233
|
+
return (0, types_1.isOfBuildType)(context.build.config, "node", "node-static", "storybook", "meteor");
|
|
13234
|
+
}
|
|
13235
|
+
return false;
|
|
13236
|
+
};
|
|
13237
|
+
const hasBuildCommand = (buildCommand) => buildCommand !== null && buildCommand !== false;
|
|
13238
|
+
/**
|
|
13239
|
+
* whether the build creates an app build job with artifacts. Rails builds
|
|
13240
|
+
* and builds with `buildCommand: false` only build the docker image.
|
|
13241
|
+
*/
|
|
13242
|
+
const hasBuildArtifacts = (context) => {
|
|
13243
|
+
if (context.type === "workspace") {
|
|
13244
|
+
return hasBuildCommand(context.build.config.buildCommand);
|
|
13245
|
+
}
|
|
13246
|
+
if (context.build.type === "fromWorkspace") {
|
|
13247
|
+
return hasBuildCommand(context.build.workspaceBuildConfig.buildCommand);
|
|
13248
|
+
}
|
|
13249
|
+
if (context.build.type === "standalone") {
|
|
13250
|
+
return (!(0, types_1.isOfBuildType)(context.build.config, "rails") &&
|
|
13251
|
+
hasBuildCommand(context.build.config.buildCommand));
|
|
13252
|
+
}
|
|
13253
|
+
return false;
|
|
13254
|
+
};
|
|
13255
|
+
const getDefaultImage = (context) => {
|
|
13256
|
+
if (context.type === "component" &&
|
|
13257
|
+
context.build.type === "standalone" &&
|
|
13258
|
+
(0, types_1.isOfBuildType)(context.build.config, "custom")) {
|
|
13259
|
+
// custom builds bring their own toolchain image
|
|
13260
|
+
return context.build.config.jobImage;
|
|
13261
|
+
}
|
|
13262
|
+
return (0, runner_1.getRunnerImage)("jobs-default");
|
|
13263
|
+
};
|
|
13264
|
+
/**
|
|
13265
|
+
* jobs for `postBuildTests`: they run after the build in the `post-build`
|
|
13266
|
+
* stage, against the build artifacts, and act as quality gates, so a
|
|
13267
|
+
* failing post-build test blocks the deploy.
|
|
13268
|
+
*/
|
|
13269
|
+
const createPostBuildTestJobs = async (context) => {
|
|
13270
|
+
var _a;
|
|
13271
|
+
// like lint and test: tagged releases deploy what was already tested
|
|
13272
|
+
if (context.trigger === "taggedRelease") {
|
|
13273
|
+
return [];
|
|
13274
|
+
}
|
|
13275
|
+
const tests = Object.entries((_a = getPostBuildTestsConfig(context)) !== null && _a !== void 0 ? _a : {}).filter((entry) => entry[1] !== false);
|
|
13276
|
+
if (tests.length === 0) {
|
|
13277
|
+
return [];
|
|
13278
|
+
}
|
|
13279
|
+
const nodeBuild = isNodeBuild(context);
|
|
13280
|
+
const [packageManagerInstall, nodeCache] = nodeBuild
|
|
13281
|
+
? await Promise.all([
|
|
13282
|
+
(0, packageManagerInstall_1.getPackageManagerInstall)(context),
|
|
13283
|
+
// pull-only: the build job is the designated cache writer
|
|
13284
|
+
(0, cache_1.getNodeCache)(context, "pull"),
|
|
13285
|
+
])
|
|
13286
|
+
: [null, null];
|
|
13287
|
+
// components built in a workspace test the workspace build output
|
|
13288
|
+
const from = context.type === "component" && context.build.type === "fromWorkspace"
|
|
13289
|
+
? { workspace: context.build.workspaceName }
|
|
13290
|
+
: undefined;
|
|
13291
|
+
const buildRequirement = hasBuildArtifacts(context)
|
|
13292
|
+
? { capability: "buildArtifacts", artifacts: true, strict: true, from }
|
|
13293
|
+
: // no build artifacts (e.g. rails): run after the build (docker image)
|
|
13294
|
+
{ capability: "build", artifacts: false, from };
|
|
13295
|
+
return tests.map(([name, test]) => {
|
|
13296
|
+
var _a, _b, _c;
|
|
13297
|
+
const artifactsConfig = (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, test.artifactsReports, test.artifacts);
|
|
13298
|
+
return new jobs_1.CatladderJob({
|
|
13299
|
+
name: (0, exports.postBuildTestJobName)(name),
|
|
13300
|
+
stage: exports.POST_BUILD_TEST_STAGE,
|
|
13301
|
+
envMode: "stagePerEnv",
|
|
13302
|
+
provides: ["qualityGate"],
|
|
13303
|
+
needs: [],
|
|
13304
|
+
requires: [buildRequirement],
|
|
13305
|
+
image: (_a = test.jobImage) !== null && _a !== void 0 ? _a : getDefaultImage(context),
|
|
13306
|
+
services: test.services,
|
|
13307
|
+
// neutral cache declarations, lowered by each backend
|
|
13308
|
+
caches: nodeCache !== null && nodeCache !== void 0 ? nodeCache : undefined,
|
|
13309
|
+
variables: {
|
|
13310
|
+
APP_PATH: context.build.dir,
|
|
13311
|
+
...(context.type === "component"
|
|
13312
|
+
? context.environment.jobOnlyVars.build.envVars
|
|
13313
|
+
: {}),
|
|
13314
|
+
...((_b = test.vars) !== null && _b !== void 0 ? _b : {}),
|
|
13315
|
+
},
|
|
13316
|
+
runnerVariables: {
|
|
13317
|
+
...(nodeBuild ? constants_1.NODE_RUNNER_BUILD_VARIABLES : {}),
|
|
13318
|
+
...((_c = test.runnerVariables) !== null && _c !== void 0 ? _c : {}),
|
|
13319
|
+
},
|
|
13320
|
+
script: [
|
|
13321
|
+
...(nodeBuild ? (0, packageManagerInstall_1.ensureNodeVersion)(context) : []),
|
|
13322
|
+
`cd ${context.build.dir}`,
|
|
13323
|
+
...(packageManagerInstall !== null && packageManagerInstall !== void 0 ? packageManagerInstall : []),
|
|
13324
|
+
...(0, utils_1.ensureArray)(test.command),
|
|
13325
|
+
],
|
|
13326
|
+
allow_failure: test.allowFailure,
|
|
13327
|
+
// reports and screenshots are most needed when the tests fail
|
|
13328
|
+
...(artifactsConfig
|
|
13329
|
+
? {
|
|
13330
|
+
artifacts: {
|
|
13331
|
+
when: "always",
|
|
13332
|
+
...artifactsConfig.artifacts,
|
|
13333
|
+
},
|
|
13334
|
+
}
|
|
13335
|
+
: {}),
|
|
13336
|
+
});
|
|
13337
|
+
});
|
|
13338
|
+
};
|
|
13339
|
+
exports.createPostBuildTestJobs = createPostBuildTestJobs;
|
|
13340
|
+
const jobIdOf = (jobName) => jobName
|
|
13341
|
+
.toLowerCase()
|
|
13342
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
13343
|
+
.replace(/^-+|-+$/g, "");
|
|
13344
|
+
/**
|
|
13345
|
+
* post-build test names are chosen by the user. Github job ids drop the
|
|
13346
|
+
* emoji of the job name, so e.g. a post-build test named `test` would
|
|
13347
|
+
* clash with the `🧪 test` job.
|
|
13348
|
+
*/
|
|
13349
|
+
const assertUniquePostBuildTestNames = (context, postBuildTestJobs, otherJobs) => {
|
|
13350
|
+
const seenIds = new Set(otherJobs.map((job) => jobIdOf(job.name)));
|
|
13351
|
+
// also catches two post-build tests that only differ in case or
|
|
13352
|
+
// punctuation (e.g. `e2e` and `E2E`)
|
|
13353
|
+
const clash = postBuildTestJobs.find((job) => {
|
|
13354
|
+
const id = jobIdOf(job.name);
|
|
13355
|
+
const isClash = seenIds.has(id);
|
|
13356
|
+
seenIds.add(id);
|
|
13357
|
+
return isClash;
|
|
13358
|
+
});
|
|
13359
|
+
if (clash) {
|
|
13360
|
+
throw new Error(`${context.name}: post-build test '${clash.name}' clashes with another job of the same name, please rename it in postBuildTests`);
|
|
13361
|
+
}
|
|
13362
|
+
};
|
|
13363
|
+
exports.assertUniquePostBuildTestNames = assertUniquePostBuildTestNames;
|
|
13364
|
+
//# sourceMappingURL=createPostBuildTestJobs.js.map
|
|
13365
|
+
|
|
13366
|
+
/***/ }),
|
|
13367
|
+
|
|
13368
|
+
/***/ 28458:
|
|
13369
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
13370
|
+
|
|
13371
|
+
"use strict";
|
|
13372
|
+
|
|
13373
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13374
|
+
if (k2 === undefined) k2 = k;
|
|
13375
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13376
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13377
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13378
|
+
}
|
|
13379
|
+
Object.defineProperty(o, k2, desc);
|
|
13380
|
+
}) : (function(o, m, k, k2) {
|
|
13381
|
+
if (k2 === undefined) k2 = k;
|
|
13382
|
+
o[k2] = m[k];
|
|
13383
|
+
}));
|
|
13384
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
13385
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
13386
|
+
};
|
|
13387
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
13388
|
+
__exportStar(__nccwpck_require__(92967), exports);
|
|
13389
|
+
__exportStar(__nccwpck_require__(61844), exports);
|
|
13390
|
+
//# sourceMappingURL=index.js.map
|
|
13391
|
+
|
|
13392
|
+
/***/ }),
|
|
13393
|
+
|
|
13394
|
+
/***/ 92967:
|
|
13395
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
13396
|
+
|
|
13397
|
+
"use strict";
|
|
13398
|
+
|
|
13399
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
13400
|
+
//# sourceMappingURL=types.js.map
|
|
13401
|
+
|
|
13402
|
+
/***/ }),
|
|
13403
|
+
|
|
13086
13404
|
/***/ 26041:
|
|
13087
13405
|
/***/ ((__unused_webpack_module, exports) => {
|
|
13088
13406
|
|
|
@@ -13416,6 +13734,7 @@ exports.BASE_STAGES = [
|
|
|
13416
13734
|
"setup",
|
|
13417
13735
|
"test",
|
|
13418
13736
|
"build",
|
|
13737
|
+
"post-build",
|
|
13419
13738
|
"deploy",
|
|
13420
13739
|
"verify",
|
|
13421
13740
|
"agents",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|