@catladder/cli 0.0.0-fix-materialize-binary-image-files-37469f1f → 0.0.0-fix-github-artifact-symlinks-3a2c1c28
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 +454 -60
- 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 +454 -60
- 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 +54 -2
- package/dist/bundles/skills/catladder-builds/references/build-types.md +11 -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/docker.d.ts +6 -0
- package/dist/packages/pipeline/src/build/docker.js +49 -2
- package/dist/packages/pipeline/src/build/docker.js.map +1 -1
- package/dist/packages/pipeline/src/build/types.d.ts +33 -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/deploy/cloudRun/createJobs/execute/schedules.js +3 -1
- package/dist/packages/pipeline/src/deploy/cloudRun/createJobs/execute/schedules.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/cloudRun/utils/cloudRunExecutionUrl.d.ts +1 -1
- package/dist/packages/pipeline/src/deploy/cloudRun/utils/cloudRunExecutionUrl.js +6 -1
- package/dist/packages/pipeline/src/deploy/cloudRun/utils/cloudRunExecutionUrl.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/packageManager.js +6 -3
- package/dist/packages/pipeline/src/pipeline/packageManager.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 +54 -2
- package/dist/skills/catladder-builds/references/build-types.md +11 -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
|
@@ -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}`),
|
|
@@ -6082,7 +6167,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6082
6167
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6083
6168
|
};
|
|
6084
6169
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6085
|
-
exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.getDockerBuildScriptWithBuiltInDockerFile = exports.gitlabDockerLogin = exports.DockerBuildJob = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
|
|
6170
|
+
exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.getDockerBuildScriptWithBuiltInDockerFile = exports.gitlabDockerLogin = exports.DockerBuildJob = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getReuseMainBranchImageScript = exports.getDockerImageVariables = void 0;
|
|
6086
6171
|
const fs_1 = __nccwpck_require__(79896);
|
|
6087
6172
|
const lodash_es_1 = __nccwpck_require__(50210);
|
|
6088
6173
|
const path_1 = __importDefault(__nccwpck_require__(16928));
|
|
@@ -6090,6 +6175,7 @@ const deploy_1 = __nccwpck_require__(3659);
|
|
|
6090
6175
|
const artifactsRegistry_1 = __nccwpck_require__(44330);
|
|
6091
6176
|
const gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(54799);
|
|
6092
6177
|
const ciVariables_1 = __nccwpck_require__(91215);
|
|
6178
|
+
const configruedEnvs_1 = __nccwpck_require__(38866);
|
|
6093
6179
|
const runner_1 = __nccwpck_require__(92146);
|
|
6094
6180
|
const jobs_1 = __nccwpck_require__(98521);
|
|
6095
6181
|
const gitlab_1 = __nccwpck_require__(86962);
|
|
@@ -6121,6 +6207,52 @@ const getDockerImageVariables = (context) => {
|
|
|
6121
6207
|
};
|
|
6122
6208
|
};
|
|
6123
6209
|
exports.getDockerImageVariables = getDockerImageVariables;
|
|
6210
|
+
const shellQuote = (value) => `'${value.replace(/'/g, `'\\''`)}'`;
|
|
6211
|
+
/**
|
|
6212
|
+
* script that copies the main branch image instead of building it, see
|
|
6213
|
+
* `build.reuseMainBranchImage`. Exits the job when it
|
|
6214
|
+
* reused an image, so the build script after it only runs as fallback.
|
|
6215
|
+
*/
|
|
6216
|
+
const getReuseMainBranchImageScript = (context) => {
|
|
6217
|
+
var _a, _b;
|
|
6218
|
+
const buildConfig = context.build.config;
|
|
6219
|
+
// only standalone builds have the option, workspace builds don't
|
|
6220
|
+
const option = "reuseMainBranchImage" in buildConfig
|
|
6221
|
+
? buildConfig.reuseMainBranchImage
|
|
6222
|
+
: undefined;
|
|
6223
|
+
const { fullConfig, name, env } = context;
|
|
6224
|
+
if (!option ||
|
|
6225
|
+
!(0, configruedEnvs_1.getAllEnvsByTrigger)(fullConfig, name, "taggedRelease").includes(env)) {
|
|
6226
|
+
return [];
|
|
6227
|
+
}
|
|
6228
|
+
if ((0, deploy_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun")) {
|
|
6229
|
+
throw new Error(`${name}: build.reuseMainBranchImage is not supported for google-cloudrun deploys`);
|
|
6230
|
+
}
|
|
6231
|
+
const [mainBranchEnv] = (0, configruedEnvs_1.getAllEnvsByTrigger)(fullConfig, name, "mainBranch");
|
|
6232
|
+
if (!mainBranchEnv) {
|
|
6233
|
+
throw new Error(`${name}: build.reuseMainBranchImage needs an env that builds on the main branch (e.g. dev)`);
|
|
6234
|
+
}
|
|
6235
|
+
const releaseFiles = (_b = (option === true ? undefined : option.releaseFiles)) !== null && _b !== void 0 ? _b : [
|
|
6236
|
+
"CHANGELOG.md",
|
|
6237
|
+
];
|
|
6238
|
+
const sha = (0, ciVariables_1.getCiVariable)(context, "commitSha");
|
|
6239
|
+
return [
|
|
6240
|
+
...(0, exports.gitlabDockerLogin)(context),
|
|
6241
|
+
`REUSE_IMAGE="${(0, ciVariables_1.getCiVariable)(context, "registryImage")}/${mainBranchEnv}/${name}"`,
|
|
6242
|
+
`reuse_sha=""
|
|
6243
|
+
if docker buildx imagetools inspect "$REUSE_IMAGE:${sha}" >/dev/null 2>&1; then
|
|
6244
|
+
reuse_sha="${sha}"
|
|
6245
|
+
elif git fetch --quiet --depth=2 origin "${sha}" && [ -z "$(git diff --name-only "${sha}^" "${sha}" | grep -vxF ${releaseFiles.map((f) => `-e ${shellQuote(f)}`).join(" ")})" ]; then
|
|
6246
|
+
reuse_sha="$(git rev-parse "${sha}^")"
|
|
6247
|
+
fi
|
|
6248
|
+
if [ -n "$reuse_sha" ] && docker buildx imagetools create --prefer-index=false --tag "$DOCKER_IMAGE:$DOCKER_IMAGE_TAG" "$REUSE_IMAGE:$reuse_sha"; then
|
|
6249
|
+
echo "♻️ reused $REUSE_IMAGE:$reuse_sha, skipping the build"
|
|
6250
|
+
exit 0
|
|
6251
|
+
fi
|
|
6252
|
+
echo "no main branch image to reuse, building the image"`,
|
|
6253
|
+
];
|
|
6254
|
+
};
|
|
6255
|
+
exports.getReuseMainBranchImageScript = getReuseMainBranchImageScript;
|
|
6124
6256
|
/**
|
|
6125
6257
|
* Weather the context requires a docker build
|
|
6126
6258
|
*/
|
|
@@ -6192,7 +6324,7 @@ class DockerBuildJob extends jobs_1.CatladderJob {
|
|
|
6192
6324
|
provides: ["dockerImage"],
|
|
6193
6325
|
caches: cache,
|
|
6194
6326
|
...(0, exports.getDockerJobBaseProps)(),
|
|
6195
|
-
script: script || [],
|
|
6327
|
+
script: [...(0, exports.getReuseMainBranchImageScript)(context), ...(script || [])],
|
|
6196
6328
|
variables: {
|
|
6197
6329
|
...(0, removeUndefined_1.removeUndefined)((0, exports.getDockerBuildVariables)(context)),
|
|
6198
6330
|
...(0, removeUndefined_1.removeUndefined)(variables !== null && variables !== void 0 ? variables : {}),
|
|
@@ -7348,6 +7480,9 @@ const getEnvType_1 = __nccwpck_require__(46080);
|
|
|
7348
7480
|
const getConfiguredAndDefaultEnvs = (config, componentName, envTypes) => {
|
|
7349
7481
|
var _a, _b;
|
|
7350
7482
|
const configuredEnvs = (_a = config.components[componentName].env) !== null && _a !== void 0 ? _a : {};
|
|
7483
|
+
if ((0, types_1.isEnvironmentDisabled)(config.environments, "local")) {
|
|
7484
|
+
throw new Error(`environment "local" cannot be disabled (environments.local: false) — it is only used for local development`);
|
|
7485
|
+
}
|
|
7351
7486
|
// the default envs have the same name as the env types
|
|
7352
7487
|
// these can be disabled with settimg them to `false`
|
|
7353
7488
|
// this is the list of all not disabled envs. These are always returned
|
|
@@ -7356,6 +7491,7 @@ const getConfiguredAndDefaultEnvs = (config, componentName, envTypes) => {
|
|
|
7356
7491
|
// component deploys to them unless it opts out with `env.<name>: false`
|
|
7357
7492
|
const declaredEnvs = Object.keys((_b = config.environments) !== null && _b !== void 0 ? _b : {})
|
|
7358
7493
|
.filter((envName) => !(0, types_1.isKnowEnvType)(envName)) // default envs are already handled above
|
|
7494
|
+
.filter((envName) => !(0, types_1.isEnvironmentDisabled)(config.environments, envName))
|
|
7359
7495
|
.map((envName) => {
|
|
7360
7496
|
const envType = (0, getEnvType_1.getDeclaredEnvType)(config.environments, envName);
|
|
7361
7497
|
if (!envType) {
|
|
@@ -7372,13 +7508,15 @@ const getConfiguredAndDefaultEnvs = (config, componentName, envTypes) => {
|
|
|
7372
7508
|
config.type &&
|
|
7373
7509
|
envTypes.includes(config.type))
|
|
7374
7510
|
.map(([envName]) => envName);
|
|
7511
|
+
// envs disabled project-wide (`environments.<name>: false`) exist for
|
|
7512
|
+
// no component — this wins over any per-component config of the env
|
|
7375
7513
|
return [
|
|
7376
7514
|
...new Set([
|
|
7377
7515
|
...enabledDefaultEnvs,
|
|
7378
7516
|
...declaredEnvs,
|
|
7379
7517
|
...configuredCustomEnvs,
|
|
7380
7518
|
]),
|
|
7381
|
-
];
|
|
7519
|
+
].filter((envName) => !(0, types_1.isEnvironmentDisabled)(config.environments, envName));
|
|
7382
7520
|
};
|
|
7383
7521
|
const getAllEnvs = (config, componentName) => {
|
|
7384
7522
|
return getConfiguredAndDefaultEnvs(config, componentName, types_1.DEFAULT_ENV_TYPES);
|
|
@@ -7825,6 +7963,9 @@ const assertValidInheritTarget = (environments, env, target) => {
|
|
|
7825
7963
|
if (target === "local") {
|
|
7826
7964
|
throw new Error(`environment "${env}" cannot inherit from "local" — local is not a deployment environment`);
|
|
7827
7965
|
}
|
|
7966
|
+
if ((0, config_1.isEnvironmentDisabled)(environments, target)) {
|
|
7967
|
+
throw new Error(`environment "${env}" inherits from "${target}", which is disabled (environments.${target}: false)`);
|
|
7968
|
+
}
|
|
7828
7969
|
if (!(0, config_1.isKnowEnvType)(target) && !(environments === null || environments === void 0 ? void 0 : environments[target])) {
|
|
7829
7970
|
throw new Error(`environment "${env}" inherits from unknown environment "${target}"`);
|
|
7830
7971
|
}
|
|
@@ -7840,7 +7981,7 @@ const getInheritedConfigChain = (environments, env) => {
|
|
|
7840
7981
|
const seen = new Set([env]);
|
|
7841
7982
|
let current = env;
|
|
7842
7983
|
for (;;) {
|
|
7843
|
-
const target = (0, exports.normalizeEnvInherit)((_a =
|
|
7984
|
+
const target = (0, exports.normalizeEnvInherit)((_a = (0, config_1.getEnvironmentConfig)(environments, current)) === null || _a === void 0 ? void 0 : _a.inherit).config;
|
|
7844
7985
|
if (!target)
|
|
7845
7986
|
break;
|
|
7846
7987
|
assertValidInheritTarget(environments, current, target);
|
|
@@ -7864,7 +8005,7 @@ const getSecretsEnv = (environments, env) => {
|
|
|
7864
8005
|
const seen = new Set([env]);
|
|
7865
8006
|
let current = env;
|
|
7866
8007
|
for (;;) {
|
|
7867
|
-
const target = (0, exports.normalizeEnvInherit)((_a =
|
|
8008
|
+
const target = (0, exports.normalizeEnvInherit)((_a = (0, config_1.getEnvironmentConfig)(environments, current)) === null || _a === void 0 ? void 0 : _a.inherit).secrets;
|
|
7868
8009
|
if (!target)
|
|
7869
8010
|
return current;
|
|
7870
8011
|
assertValidInheritTarget(environments, current, target);
|
|
@@ -7937,7 +8078,7 @@ const getDefaultOnForType = (envType) => {
|
|
|
7937
8078
|
*/
|
|
7938
8079
|
const getEnvOn = (env, envConfig, environments) => {
|
|
7939
8080
|
var _a;
|
|
7940
|
-
const on = (_a =
|
|
8081
|
+
const on = (_a = (0, types_1.getEnvironmentConfig)(environments, env)) === null || _a === void 0 ? void 0 : _a.on;
|
|
7941
8082
|
if (on !== undefined)
|
|
7942
8083
|
return on;
|
|
7943
8084
|
return getDefaultOnForType((0, getEnvType_1.getEnvType)(env, envConfig, environments));
|
|
@@ -7962,7 +8103,7 @@ const getEnvInherit_1 = __nccwpck_require__(52181);
|
|
|
7962
8103
|
* the type of the env they inherit their config from
|
|
7963
8104
|
*/
|
|
7964
8105
|
const getDeclaredEnvType = (environments, env, seen = new Set()) => {
|
|
7965
|
-
const declared =
|
|
8106
|
+
const declared = (0, types_1.getEnvironmentConfig)(environments, env);
|
|
7966
8107
|
if (declared === null || declared === void 0 ? void 0 : declared.type)
|
|
7967
8108
|
return declared.type;
|
|
7968
8109
|
if ((0, types_1.isKnowEnvType)(env))
|
|
@@ -8029,6 +8170,7 @@ exports.getEnvironment = getEnvironment;
|
|
|
8029
8170
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8030
8171
|
exports.getEnvironmentContext = void 0;
|
|
8031
8172
|
const bash_1 = __nccwpck_require__(94143);
|
|
8173
|
+
const config_1 = __nccwpck_require__(75591);
|
|
8032
8174
|
const getEnvConfig_1 = __nccwpck_require__(69578);
|
|
8033
8175
|
const getEnvInstance_1 = __nccwpck_require__(13055);
|
|
8034
8176
|
const getEnvInherit_1 = __nccwpck_require__(52181);
|
|
@@ -8040,7 +8182,7 @@ const getEnvironmentSlugPrefix = (env, instance) => {
|
|
|
8040
8182
|
return env;
|
|
8041
8183
|
};
|
|
8042
8184
|
const getEnvironmentContext = ({ env, componentName, config, pipelineType, }) => {
|
|
8043
|
-
var _a
|
|
8185
|
+
var _a;
|
|
8044
8186
|
const envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env);
|
|
8045
8187
|
const envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw, config.environments);
|
|
8046
8188
|
const instance = (0, getEnvInstance_1.getEnvInstance)(envConfigRaw, env, pipelineType, config.environments);
|
|
@@ -8048,7 +8190,7 @@ const getEnvironmentContext = ({ env, componentName, config, pipelineType, }) =>
|
|
|
8048
8190
|
// config; undefined means the env type's default applies
|
|
8049
8191
|
const autoStop = envConfigRaw.autoStop !== undefined
|
|
8050
8192
|
? envConfigRaw.autoStop
|
|
8051
|
-
: (
|
|
8193
|
+
: (_a = (0, config_1.getEnvironmentConfig)(config.environments, env)) === null || _a === void 0 ? void 0 : _a.autoStop;
|
|
8052
8194
|
const environmentSlugPrefix = getEnvironmentSlugPrefix(env, instance);
|
|
8053
8195
|
const environmentSlug = environmentSlugPrefix.concat(`-${componentName}`);
|
|
8054
8196
|
const fullName = (0, bash_1.joinBashExpressions)([config.customerName, config.appName, environmentSlug], "-");
|
|
@@ -8973,14 +9115,20 @@ class DeployJob extends jobs_1.CatladderJob {
|
|
|
8973
9115
|
: []),
|
|
8974
9116
|
];
|
|
8975
9117
|
// we don't want to deploy when there is a broken test
|
|
8976
|
-
const
|
|
8977
|
-
|
|
8978
|
-
artifacts: false,
|
|
8979
|
-
//
|
|
8980
|
-
|
|
8981
|
-
?
|
|
8982
|
-
|
|
8983
|
-
|
|
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
|
+
];
|
|
8984
9132
|
super({
|
|
8985
9133
|
name: exports.DEPLOY_JOB_NAME,
|
|
8986
9134
|
script: jobDefinition.script,
|
|
@@ -8997,7 +9145,7 @@ class DeployJob extends jobs_1.CatladderJob {
|
|
|
8997
9145
|
...waitForRequirements,
|
|
8998
9146
|
// if the build is disabled, we don't need to wait for it
|
|
8999
9147
|
...(context.build.type !== "disabled"
|
|
9000
|
-
? [...buildRequirements,
|
|
9148
|
+
? [...buildRequirements, ...qualityGateRequirements]
|
|
9001
9149
|
: []),
|
|
9002
9150
|
],
|
|
9003
9151
|
gate: whenDeploy,
|
|
@@ -9861,7 +10009,9 @@ const getSchedulerArgs = (scheduler, context) => {
|
|
|
9861
10009
|
appFullName: context.environment.fullName,
|
|
9862
10010
|
projectId,
|
|
9863
10011
|
region,
|
|
9864
|
-
|
|
10012
|
+
// lands in a script line (not an exported variable), so the
|
|
10013
|
+
// raw expression is what the shell has to see
|
|
10014
|
+
}).toString(),
|
|
9865
10015
|
"message-body": body
|
|
9866
10016
|
? '"' + (0, bash_1.bashEscape)(JSON.stringify(body)) + '"'
|
|
9867
10017
|
: undefined,
|
|
@@ -10301,11 +10451,16 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
|
10301
10451
|
|
|
10302
10452
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10303
10453
|
exports.getCloudRunJobExecuteUrl = void 0;
|
|
10454
|
+
const bash_1 = __nccwpck_require__(94143);
|
|
10304
10455
|
const jobName_1 = __nccwpck_require__(65576);
|
|
10305
10456
|
function getCloudRunJobExecuteUrl(jobName, { region, projectId, appFullName, }) {
|
|
10306
10457
|
const uriBase = `https://${region}-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/${projectId}/jobs`;
|
|
10307
10458
|
const fullJobName = (0, jobName_1.getCloudRunJobName)(appFullName, jobName);
|
|
10308
|
-
|
|
10459
|
+
// joined, not interpolated: on review envs the job name is a bash
|
|
10460
|
+
// expression (the review slug), and a template string would demote
|
|
10461
|
+
// it to a plain string — its quotes then get escaped as literal
|
|
10462
|
+
// characters when the variable is exported
|
|
10463
|
+
return (0, bash_1.joinBashExpressions)([uriBase, "/", fullJobName, ":run"]);
|
|
10309
10464
|
}
|
|
10310
10465
|
exports.getCloudRunJobExecuteUrl = getCloudRunJobExecuteUrl;
|
|
10311
10466
|
//# sourceMappingURL=cloudRunExecutionUrl.js.map
|
|
@@ -11766,6 +11921,7 @@ __exportStar(__nccwpck_require__(15707), exports);
|
|
|
11766
11921
|
__exportStar(__nccwpck_require__(45492), exports);
|
|
11767
11922
|
__exportStar(__nccwpck_require__(3659), exports);
|
|
11768
11923
|
__exportStar(__nccwpck_require__(50713), exports);
|
|
11924
|
+
__exportStar(__nccwpck_require__(28458), exports);
|
|
11769
11925
|
__exportStar(__nccwpck_require__(26041), exports);
|
|
11770
11926
|
__exportStar(__nccwpck_require__(47663), exports);
|
|
11771
11927
|
__exportStar(__nccwpck_require__(91804), exports);
|
|
@@ -12363,6 +12519,7 @@ exports.createJobsForComponentContext = void 0;
|
|
|
12363
12519
|
const build_1 = __nccwpck_require__(45492);
|
|
12364
12520
|
const deploy_1 = __nccwpck_require__(3659);
|
|
12365
12521
|
const jobs_1 = __nccwpck_require__(98521);
|
|
12522
|
+
const createPostBuildTestJobs_1 = __nccwpck_require__(61844);
|
|
12366
12523
|
const createVerifyJobs_1 = __nccwpck_require__(66900);
|
|
12367
12524
|
const injectDefaultVarsInCustomJobs = (context, jobs) => jobs.map(({ variables, ...job }) => {
|
|
12368
12525
|
var _a;
|
|
@@ -12382,17 +12539,26 @@ const getCustomJobs = (context) => {
|
|
|
12382
12539
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
12383
12540
|
};
|
|
12384
12541
|
const createJobsForComponentContext = async (context) => {
|
|
12385
|
-
const [buildJobs, deployJobs, verifyJobs] = await Promise.all([
|
|
12542
|
+
const [buildJobs, postBuildTestJobs, deployJobs, verifyJobs] = await Promise.all([
|
|
12386
12543
|
context.build.type !== "disabled"
|
|
12387
12544
|
? build_1.BUILD_TYPES[context.build.buildType].jobs(context)
|
|
12388
12545
|
: [],
|
|
12546
|
+
(0, createPostBuildTestJobs_1.createPostBuildTestJobs)(context),
|
|
12389
12547
|
context.componentConfig.deploy !== false
|
|
12390
12548
|
? deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context)
|
|
12391
12549
|
: [],
|
|
12392
12550
|
(0, createVerifyJobs_1.createVerifyJobs)(context),
|
|
12393
12551
|
]);
|
|
12394
12552
|
const customJobs = getCustomJobs(context);
|
|
12395
|
-
|
|
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
|
+
];
|
|
12396
12562
|
};
|
|
12397
12563
|
exports.createJobsForComponentContext = createJobsForComponentContext;
|
|
12398
12564
|
//# sourceMappingURL=createJobsForComponent.js.map
|
|
@@ -12407,9 +12573,14 @@ exports.createJobsForComponentContext = createJobsForComponentContext;
|
|
|
12407
12573
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12408
12574
|
exports.createJobsForWorkspace = void 0;
|
|
12409
12575
|
const build_1 = __nccwpck_require__(45492);
|
|
12576
|
+
const createPostBuildTestJobs_1 = __nccwpck_require__(61844);
|
|
12410
12577
|
const createJobsForWorkspace = async (context) => {
|
|
12411
|
-
const buildJobs = await
|
|
12412
|
-
|
|
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];
|
|
12413
12584
|
};
|
|
12414
12585
|
exports.createJobsForWorkspace = createJobsForWorkspace;
|
|
12415
12586
|
//# sourceMappingURL=createJobsForWorkspace.js.map
|
|
@@ -12687,15 +12858,18 @@ const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
|
12687
12858
|
const patchFiles = baseInfo.type === "pnpm"
|
|
12688
12859
|
? (0, pnpmUtils_1.getPnpmPatchFiles)(componentIsInWorkspace ? workspaceRoot : component.dir)
|
|
12689
12860
|
: [];
|
|
12861
|
+
// sort the variable parts: their order depends on package.json key order
|
|
12862
|
+
// and dependency traversal, and an unstable order rewrites the generated
|
|
12863
|
+
// pipeline files on every regeneration without any real change
|
|
12690
12864
|
const pathsToCopyInDocker = [
|
|
12691
12865
|
...new Set([
|
|
12692
12866
|
packageJson,
|
|
12693
12867
|
...(workspacePackageJson ? [workspacePackageJson] : []),
|
|
12694
12868
|
lockFile,
|
|
12695
12869
|
...configFilePaths,
|
|
12696
|
-
...allWorkspaceManifests,
|
|
12697
|
-
...patchFiles,
|
|
12698
|
-
...currentWorkspaceDependencies,
|
|
12870
|
+
...[...allWorkspaceManifests].sort(),
|
|
12871
|
+
...[...patchFiles].sort(),
|
|
12872
|
+
...[...currentWorkspaceDependencies].sort(),
|
|
12699
12873
|
]),
|
|
12700
12874
|
];
|
|
12701
12875
|
return {
|
|
@@ -12875,6 +13049,7 @@ exports.resolveRequirements = void 0;
|
|
|
12875
13049
|
const DEFAULT_STAGE_CAPABILITIES = {
|
|
12876
13050
|
build: "build",
|
|
12877
13051
|
test: "qualityGate",
|
|
13052
|
+
"post-build": "qualityGate",
|
|
12878
13053
|
deploy: "deployment",
|
|
12879
13054
|
};
|
|
12880
13055
|
/**
|
|
@@ -13016,6 +13191,216 @@ exports.getWorkspaceDependencies = getWorkspaceDependencies;
|
|
|
13016
13191
|
|
|
13017
13192
|
/***/ }),
|
|
13018
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
|
+
|
|
13019
13404
|
/***/ 26041:
|
|
13020
13405
|
/***/ ((__unused_webpack_module, exports) => {
|
|
13021
13406
|
|
|
@@ -13212,7 +13597,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
13212
13597
|
"use strict";
|
|
13213
13598
|
|
|
13214
13599
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
13215
|
-
exports.isKnowEnvType = exports.DEFAULT_ENV_TYPES = exports.DEFAULT_ENVS = exports.ENV_TYPES = exports.envTriggerEquals = exports.isBranchTrigger = exports.ALL_PIPELINE_TRIGGERS = void 0;
|
|
13600
|
+
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;
|
|
13216
13601
|
exports.ALL_PIPELINE_TRIGGERS = [
|
|
13217
13602
|
"mainBranch",
|
|
13218
13603
|
"mr",
|
|
@@ -13255,6 +13640,14 @@ const isKnowEnvType = (env) => {
|
|
|
13255
13640
|
return env in exports.ENV_TYPES;
|
|
13256
13641
|
};
|
|
13257
13642
|
exports.isKnowEnvType = isKnowEnvType;
|
|
13643
|
+
/**
|
|
13644
|
+
* the project-wide config of `env` (undefined when not declared or
|
|
13645
|
+
* disabled)
|
|
13646
|
+
*/
|
|
13647
|
+
const getEnvironmentConfig = (environments, env) => (environments === null || environments === void 0 ? void 0 : environments[env]) || undefined;
|
|
13648
|
+
exports.getEnvironmentConfig = getEnvironmentConfig;
|
|
13649
|
+
const isEnvironmentDisabled = (environments, env) => (environments === null || environments === void 0 ? void 0 : environments[env]) === false;
|
|
13650
|
+
exports.isEnvironmentDisabled = isEnvironmentDisabled;
|
|
13258
13651
|
//# sourceMappingURL=config.js.map
|
|
13259
13652
|
|
|
13260
13653
|
/***/ }),
|
|
@@ -13341,6 +13734,7 @@ exports.BASE_STAGES = [
|
|
|
13341
13734
|
"setup",
|
|
13342
13735
|
"test",
|
|
13343
13736
|
"build",
|
|
13737
|
+
"post-build",
|
|
13344
13738
|
"deploy",
|
|
13345
13739
|
"verify",
|
|
13346
13740
|
"agents",
|