@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
|
@@ -9679,6 +9679,97 @@ exports.makeAggregateCheckJob = makeAggregateCheckJob;
|
|
|
9679
9679
|
|
|
9680
9680
|
/***/ }),
|
|
9681
9681
|
|
|
9682
|
+
/***/ 75125:
|
|
9683
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
9684
|
+
|
|
9685
|
+
"use strict";
|
|
9686
|
+
|
|
9687
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9688
|
+
exports.createArtifactDownloadSteps = exports.createArtifactUploadSteps = exports.artifactArchiveFile = void 0;
|
|
9689
|
+
/**
|
|
9690
|
+
* Artifacts are handed between github jobs as ONE tar archive instead
|
|
9691
|
+
* of letting upload-artifact walk the paths itself.
|
|
9692
|
+
*
|
|
9693
|
+
* upload-artifact does not preserve symlinks (it uploads the target's
|
|
9694
|
+
* content) nor file modes, and it strips the paths' common ancestor.
|
|
9695
|
+
* Gitlab artifacts keep all of that, and builds rely on it: next.js
|
|
9696
|
+
* with turbopack writes `.next/node_modules/<pkg>-<hash>` as relative
|
|
9697
|
+
* symlinks into the pnpm virtual store. Copied as plain directories,
|
|
9698
|
+
* node resolves the package's own dependencies from the wrong place
|
|
9699
|
+
* and the app crashes with ERR_MODULE_NOT_FOUND at runtime. tar keeps
|
|
9700
|
+
* symlinks, modes and the paths relative to the repo root (github's
|
|
9701
|
+
* own docs recommend it for exactly this).
|
|
9702
|
+
*
|
|
9703
|
+
* The archive is not hidden (upload-artifact skips hidden files) and
|
|
9704
|
+
* lives in the workspace, the one path run steps and actions agree on
|
|
9705
|
+
* inside job containers too.
|
|
9706
|
+
*/
|
|
9707
|
+
const artifactArchiveFile = (jobId) => `catladder-artifacts-${jobId}.tar`;
|
|
9708
|
+
exports.artifactArchiveFile = artifactArchiveFile;
|
|
9709
|
+
const createArtifactUploadSteps = (jobId, paths, condition) => {
|
|
9710
|
+
const archive = (0, exports.artifactArchiveFile)(jobId);
|
|
9711
|
+
const ifCondition = condition ? { if: condition } : {};
|
|
9712
|
+
return [
|
|
9713
|
+
{
|
|
9714
|
+
name: "Archive artifacts",
|
|
9715
|
+
...ifCondition,
|
|
9716
|
+
run: [
|
|
9717
|
+
"shopt -s nullglob globstar",
|
|
9718
|
+
"paths=()",
|
|
9719
|
+
// unquoted on purpose: artifact paths may be globs. Non-matching
|
|
9720
|
+
// globs vanish (nullglob), missing literal paths are skipped —
|
|
9721
|
+
// gitlab only warns about both, so do we
|
|
9722
|
+
`for path in ${paths.join(" ")}; do`,
|
|
9723
|
+
' if [ -e "$path" ] || [ -L "$path" ]; then paths+=("$path"); else echo "::warning::artifact path not found: $path"; fi',
|
|
9724
|
+
"done",
|
|
9725
|
+
"if [ ${#paths[@]} -eq 0 ]; then",
|
|
9726
|
+
// an empty archive keeps downstream downloads from failing.
|
|
9727
|
+
// Written by hand: busybox tar (alpine job images) refuses to
|
|
9728
|
+
// create one, and zero blocks are what an empty tar is
|
|
9729
|
+
` head -c 10240 /dev/zero > ${archive}`,
|
|
9730
|
+
"else",
|
|
9731
|
+
` tar -cf ${archive} -- "\${paths[@]}"`,
|
|
9732
|
+
"fi",
|
|
9733
|
+
].join("\n"),
|
|
9734
|
+
shell: "bash",
|
|
9735
|
+
},
|
|
9736
|
+
{
|
|
9737
|
+
name: "Upload artifacts",
|
|
9738
|
+
...ifCondition,
|
|
9739
|
+
uses: "actions/upload-artifact@v4",
|
|
9740
|
+
with: {
|
|
9741
|
+
name: jobId,
|
|
9742
|
+
path: archive,
|
|
9743
|
+
"if-no-files-found": "error",
|
|
9744
|
+
},
|
|
9745
|
+
},
|
|
9746
|
+
];
|
|
9747
|
+
};
|
|
9748
|
+
exports.createArtifactUploadSteps = createArtifactUploadSteps;
|
|
9749
|
+
const createArtifactDownloadSteps = (providerIds) => providerIds.length === 0
|
|
9750
|
+
? []
|
|
9751
|
+
: [
|
|
9752
|
+
...providerIds.map((id) => ({
|
|
9753
|
+
name: `Download artifacts from ${id}`,
|
|
9754
|
+
uses: "actions/download-artifact@v4",
|
|
9755
|
+
with: { name: id },
|
|
9756
|
+
})),
|
|
9757
|
+
{
|
|
9758
|
+
name: "Extract artifacts",
|
|
9759
|
+
run: providerIds
|
|
9760
|
+
.flatMap((id) => [
|
|
9761
|
+
`tar -xf ${(0, exports.artifactArchiveFile)(id)}`,
|
|
9762
|
+
`rm ${(0, exports.artifactArchiveFile)(id)}`,
|
|
9763
|
+
])
|
|
9764
|
+
.join("\n"),
|
|
9765
|
+
shell: "bash",
|
|
9766
|
+
},
|
|
9767
|
+
];
|
|
9768
|
+
exports.createArtifactDownloadSteps = createArtifactDownloadSteps;
|
|
9769
|
+
//# sourceMappingURL=artifactArchive.js.map
|
|
9770
|
+
|
|
9771
|
+
/***/ }),
|
|
9772
|
+
|
|
9682
9773
|
/***/ 17300:
|
|
9683
9774
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
9684
9775
|
|
|
@@ -9748,6 +9839,7 @@ const utils_1 = __nccwpck_require__(49401);
|
|
|
9748
9839
|
const gitlab_1 = __nccwpck_require__(86962);
|
|
9749
9840
|
const scriptFunctions_1 = __nccwpck_require__(85873);
|
|
9750
9841
|
const ciVariables_1 = __nccwpck_require__(17300);
|
|
9842
|
+
const artifactArchive_1 = __nccwpck_require__(75125);
|
|
9751
9843
|
/**
|
|
9752
9844
|
* runner variables that only make sense on gitlab runners and must not
|
|
9753
9845
|
* leak into github jobs (docker-in-docker daemon config, kubernetes
|
|
@@ -9958,7 +10050,7 @@ const getReferencedSecretsEnv = (script, kinds) => Object.fromEntries([...script
|
|
|
9958
10050
|
.filter((name) => !ciVariables_1.GITHUB_INJECTED_WORKFLOW_ENV_NAMES.has(name))
|
|
9959
10051
|
.map((name) => [name, vaultValueExpression(name, kinds)]));
|
|
9960
10052
|
const makeGithubJob = (context, job, allJobs, uploadProviderIds, images, scripts, secretKinds = new Map()) => {
|
|
9961
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10053
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
9962
10054
|
const id = (0, exports.githubJobId)(context, job.name);
|
|
9963
10055
|
const isComponent = context.type === "component";
|
|
9964
10056
|
const createsJobEnv = !!job.environment &&
|
|
@@ -10103,13 +10195,7 @@ const makeGithubJob = (context, job, allJobs, uploadProviderIds, images, scripts
|
|
|
10103
10195
|
? []
|
|
10104
10196
|
: [{ name: "Checkout", uses: "actions/checkout@v4" }]),
|
|
10105
10197
|
...createCacheSteps(context, job),
|
|
10106
|
-
...needs
|
|
10107
|
-
.filter((n) => n.artifacts)
|
|
10108
|
-
.map((n) => ({
|
|
10109
|
-
name: `Download artifacts from ${n.id}`,
|
|
10110
|
-
uses: "actions/download-artifact@v4",
|
|
10111
|
-
with: { name: n.id },
|
|
10112
|
-
})),
|
|
10198
|
+
...(0, artifactArchive_1.createArtifactDownloadSteps)(needs.filter((n) => n.artifacts).map((n) => n.id)),
|
|
10113
10199
|
{
|
|
10114
10200
|
name: job.name,
|
|
10115
10201
|
id: "main",
|
|
@@ -10130,27 +10216,15 @@ const makeGithubJob = (context, job, allJobs, uploadProviderIds, images, scripts
|
|
|
10130
10216
|
},
|
|
10131
10217
|
]
|
|
10132
10218
|
: []),
|
|
10133
|
-
...(pagesPublishDir
|
|
10134
|
-
?
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
name: id,
|
|
10143
|
-
path: artifactPaths.join("\n"),
|
|
10144
|
-
"if-no-files-found": "warn",
|
|
10145
|
-
// gitlab artifacts include everything; upload-artifact
|
|
10146
|
-
// silently drops hidden files by default — which is
|
|
10147
|
-
// exactly where next.js builds live (.next)
|
|
10148
|
-
"include-hidden-files": true,
|
|
10149
|
-
},
|
|
10150
|
-
},
|
|
10151
|
-
]
|
|
10152
|
-
: []
|
|
10153
|
-
: []),
|
|
10219
|
+
...(!pagesPublishDir && artifactPaths.length > 0
|
|
10220
|
+
? (0, artifactArchive_1.createArtifactUploadSteps)(id, artifactPaths,
|
|
10221
|
+
// gitlab's `artifacts.when`: steps only run on success by default
|
|
10222
|
+
((_k = job.artifacts) === null || _k === void 0 ? void 0 : _k.when) === "always"
|
|
10223
|
+
? "always()"
|
|
10224
|
+
: ((_l = job.artifacts) === null || _l === void 0 ? void 0 : _l.when) === "on_failure"
|
|
10225
|
+
? "failure()"
|
|
10226
|
+
: undefined)
|
|
10227
|
+
: []),
|
|
10154
10228
|
],
|
|
10155
10229
|
};
|
|
10156
10230
|
return [id, githubJob];
|
|
@@ -10843,7 +10917,6 @@ class GitlabBackend {
|
|
|
10843
10917
|
return [mainInclude, ...componentIncludes];
|
|
10844
10918
|
}
|
|
10845
10919
|
async createPipeline(config, images) {
|
|
10846
|
-
const stages = (0, getPipelineStages_1.getPipelineStages)(config);
|
|
10847
10920
|
// register the release image first: the per-trigger job creation
|
|
10848
10921
|
// below emits the build jobs of all images registered so far. The
|
|
10849
10922
|
// release jobs themselves are created afterwards — they need the
|
|
@@ -10862,6 +10935,9 @@ class GitlabBackend {
|
|
|
10862
10935
|
jobs: await (0, createGitlabJobs_1.createGitlabJobs)(await (0, createAllJobs_1.createAllJobs)({ config, trigger, pipelineType: this.type }), images, getGitlabRulesForTrigger(trigger)),
|
|
10863
10936
|
})));
|
|
10864
10937
|
const allJobsPerTrigger = jobsPerTrigger.flatMap(({ jobs }) => jobs);
|
|
10938
|
+
const stages = (0, getPipelineStages_1.getPipelineStages)(config, new Set(allJobsPerTrigger
|
|
10939
|
+
.map(({ gitlabJob }) => gitlabJob.stage)
|
|
10940
|
+
.filter((stage) => typeof stage === "string")));
|
|
10865
10941
|
// the jobs the queued-release executor waits for: everything that
|
|
10866
10942
|
// runs automatically in a main-branch pipeline. Manual jobs (stop,
|
|
10867
10943
|
// rollback, gates) are excluded — gitlab skips a job whose needs
|
|
@@ -11516,14 +11592,23 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
11516
11592
|
exports.getPipelineStages = void 0;
|
|
11517
11593
|
const config_1 = __nccwpck_require__(11646);
|
|
11518
11594
|
const jobs_1 = __nccwpck_require__(98521);
|
|
11595
|
+
/**
|
|
11596
|
+
* stages that only appear in the pipeline when a job uses them, so that
|
|
11597
|
+
* projects not using the feature keep their generated files unchanged
|
|
11598
|
+
*/
|
|
11599
|
+
const OPTIONAL_STAGES = ["post-build"];
|
|
11519
11600
|
/**
|
|
11520
11601
|
* while technically not required, we group different envs in its own stage
|
|
11521
11602
|
* each job from `createJobs` that is defined as `envMode: "stagePerEnv"` will have `deploy dev`, etc. instead of just `deploy`
|
|
11522
11603
|
* this is just so that it looks nicer in gitlab and makes running mutliple manual tasks more easy to use
|
|
11604
|
+
*
|
|
11605
|
+
* `usedStages` are the stages of all generated jobs; optional stages are
|
|
11606
|
+
* dropped when none of them is used.
|
|
11523
11607
|
*/
|
|
11524
|
-
function getPipelineStages(config) {
|
|
11608
|
+
function getPipelineStages(config, usedStages = new Set()) {
|
|
11525
11609
|
const allEnvs = (0, config_1.getAllEnvsInAllComponents)(config).filter((e) => e !== "local");
|
|
11526
|
-
const
|
|
11610
|
+
const isUsed = (baseStage) => [...usedStages].some((stage) => stage === baseStage || stage.startsWith(`${baseStage} `));
|
|
11611
|
+
const stages = jobs_1.BASE_STAGES.filter((baseStage) => !OPTIONAL_STAGES.includes(baseStage) || isUsed(baseStage)).reduce((acc, baseStage) => [
|
|
11527
11612
|
...acc,
|
|
11528
11613
|
baseStage,
|
|
11529
11614
|
...allEnvs.map((e) => `${baseStage} ${e}`),
|
|
@@ -12659,7 +12744,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12659
12744
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12660
12745
|
};
|
|
12661
12746
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12662
|
-
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;
|
|
12747
|
+
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;
|
|
12663
12748
|
const fs_1 = __nccwpck_require__(79896);
|
|
12664
12749
|
const lodash_es_1 = __nccwpck_require__(50210);
|
|
12665
12750
|
const path_1 = __importDefault(__nccwpck_require__(16928));
|
|
@@ -12667,6 +12752,7 @@ const deploy_1 = __nccwpck_require__(3659);
|
|
|
12667
12752
|
const artifactsRegistry_1 = __nccwpck_require__(44330);
|
|
12668
12753
|
const gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(54799);
|
|
12669
12754
|
const ciVariables_1 = __nccwpck_require__(91215);
|
|
12755
|
+
const configruedEnvs_1 = __nccwpck_require__(38866);
|
|
12670
12756
|
const runner_1 = __nccwpck_require__(92146);
|
|
12671
12757
|
const jobs_1 = __nccwpck_require__(98521);
|
|
12672
12758
|
const gitlab_1 = __nccwpck_require__(86962);
|
|
@@ -12698,6 +12784,52 @@ const getDockerImageVariables = (context) => {
|
|
|
12698
12784
|
};
|
|
12699
12785
|
};
|
|
12700
12786
|
exports.getDockerImageVariables = getDockerImageVariables;
|
|
12787
|
+
const shellQuote = (value) => `'${value.replace(/'/g, `'\\''`)}'`;
|
|
12788
|
+
/**
|
|
12789
|
+
* script that copies the main branch image instead of building it, see
|
|
12790
|
+
* `build.reuseMainBranchImage`. Exits the job when it
|
|
12791
|
+
* reused an image, so the build script after it only runs as fallback.
|
|
12792
|
+
*/
|
|
12793
|
+
const getReuseMainBranchImageScript = (context) => {
|
|
12794
|
+
var _a, _b;
|
|
12795
|
+
const buildConfig = context.build.config;
|
|
12796
|
+
// only standalone builds have the option, workspace builds don't
|
|
12797
|
+
const option = "reuseMainBranchImage" in buildConfig
|
|
12798
|
+
? buildConfig.reuseMainBranchImage
|
|
12799
|
+
: undefined;
|
|
12800
|
+
const { fullConfig, name, env } = context;
|
|
12801
|
+
if (!option ||
|
|
12802
|
+
!(0, configruedEnvs_1.getAllEnvsByTrigger)(fullConfig, name, "taggedRelease").includes(env)) {
|
|
12803
|
+
return [];
|
|
12804
|
+
}
|
|
12805
|
+
if ((0, deploy_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun")) {
|
|
12806
|
+
throw new Error(`${name}: build.reuseMainBranchImage is not supported for google-cloudrun deploys`);
|
|
12807
|
+
}
|
|
12808
|
+
const [mainBranchEnv] = (0, configruedEnvs_1.getAllEnvsByTrigger)(fullConfig, name, "mainBranch");
|
|
12809
|
+
if (!mainBranchEnv) {
|
|
12810
|
+
throw new Error(`${name}: build.reuseMainBranchImage needs an env that builds on the main branch (e.g. dev)`);
|
|
12811
|
+
}
|
|
12812
|
+
const releaseFiles = (_b = (option === true ? undefined : option.releaseFiles)) !== null && _b !== void 0 ? _b : [
|
|
12813
|
+
"CHANGELOG.md",
|
|
12814
|
+
];
|
|
12815
|
+
const sha = (0, ciVariables_1.getCiVariable)(context, "commitSha");
|
|
12816
|
+
return [
|
|
12817
|
+
...(0, exports.gitlabDockerLogin)(context),
|
|
12818
|
+
`REUSE_IMAGE="${(0, ciVariables_1.getCiVariable)(context, "registryImage")}/${mainBranchEnv}/${name}"`,
|
|
12819
|
+
`reuse_sha=""
|
|
12820
|
+
if docker buildx imagetools inspect "$REUSE_IMAGE:${sha}" >/dev/null 2>&1; then
|
|
12821
|
+
reuse_sha="${sha}"
|
|
12822
|
+
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
|
|
12823
|
+
reuse_sha="$(git rev-parse "${sha}^")"
|
|
12824
|
+
fi
|
|
12825
|
+
if [ -n "$reuse_sha" ] && docker buildx imagetools create --prefer-index=false --tag "$DOCKER_IMAGE:$DOCKER_IMAGE_TAG" "$REUSE_IMAGE:$reuse_sha"; then
|
|
12826
|
+
echo "♻️ reused $REUSE_IMAGE:$reuse_sha, skipping the build"
|
|
12827
|
+
exit 0
|
|
12828
|
+
fi
|
|
12829
|
+
echo "no main branch image to reuse, building the image"`,
|
|
12830
|
+
];
|
|
12831
|
+
};
|
|
12832
|
+
exports.getReuseMainBranchImageScript = getReuseMainBranchImageScript;
|
|
12701
12833
|
/**
|
|
12702
12834
|
* Weather the context requires a docker build
|
|
12703
12835
|
*/
|
|
@@ -12769,7 +12901,7 @@ class DockerBuildJob extends jobs_1.CatladderJob {
|
|
|
12769
12901
|
provides: ["dockerImage"],
|
|
12770
12902
|
caches: cache,
|
|
12771
12903
|
...(0, exports.getDockerJobBaseProps)(),
|
|
12772
|
-
script: script || [],
|
|
12904
|
+
script: [...(0, exports.getReuseMainBranchImageScript)(context), ...(script || [])],
|
|
12773
12905
|
variables: {
|
|
12774
12906
|
...(0, removeUndefined_1.removeUndefined)((0, exports.getDockerBuildVariables)(context)),
|
|
12775
12907
|
...(0, removeUndefined_1.removeUndefined)(variables !== null && variables !== void 0 ? variables : {}),
|
|
@@ -13925,6 +14057,9 @@ const getEnvType_1 = __nccwpck_require__(46080);
|
|
|
13925
14057
|
const getConfiguredAndDefaultEnvs = (config, componentName, envTypes) => {
|
|
13926
14058
|
var _a, _b;
|
|
13927
14059
|
const configuredEnvs = (_a = config.components[componentName].env) !== null && _a !== void 0 ? _a : {};
|
|
14060
|
+
if ((0, types_1.isEnvironmentDisabled)(config.environments, "local")) {
|
|
14061
|
+
throw new Error(`environment "local" cannot be disabled (environments.local: false) — it is only used for local development`);
|
|
14062
|
+
}
|
|
13928
14063
|
// the default envs have the same name as the env types
|
|
13929
14064
|
// these can be disabled with settimg them to `false`
|
|
13930
14065
|
// this is the list of all not disabled envs. These are always returned
|
|
@@ -13933,6 +14068,7 @@ const getConfiguredAndDefaultEnvs = (config, componentName, envTypes) => {
|
|
|
13933
14068
|
// component deploys to them unless it opts out with `env.<name>: false`
|
|
13934
14069
|
const declaredEnvs = Object.keys((_b = config.environments) !== null && _b !== void 0 ? _b : {})
|
|
13935
14070
|
.filter((envName) => !(0, types_1.isKnowEnvType)(envName)) // default envs are already handled above
|
|
14071
|
+
.filter((envName) => !(0, types_1.isEnvironmentDisabled)(config.environments, envName))
|
|
13936
14072
|
.map((envName) => {
|
|
13937
14073
|
const envType = (0, getEnvType_1.getDeclaredEnvType)(config.environments, envName);
|
|
13938
14074
|
if (!envType) {
|
|
@@ -13949,13 +14085,15 @@ const getConfiguredAndDefaultEnvs = (config, componentName, envTypes) => {
|
|
|
13949
14085
|
config.type &&
|
|
13950
14086
|
envTypes.includes(config.type))
|
|
13951
14087
|
.map(([envName]) => envName);
|
|
14088
|
+
// envs disabled project-wide (`environments.<name>: false`) exist for
|
|
14089
|
+
// no component — this wins over any per-component config of the env
|
|
13952
14090
|
return [
|
|
13953
14091
|
...new Set([
|
|
13954
14092
|
...enabledDefaultEnvs,
|
|
13955
14093
|
...declaredEnvs,
|
|
13956
14094
|
...configuredCustomEnvs,
|
|
13957
14095
|
]),
|
|
13958
|
-
];
|
|
14096
|
+
].filter((envName) => !(0, types_1.isEnvironmentDisabled)(config.environments, envName));
|
|
13959
14097
|
};
|
|
13960
14098
|
const getAllEnvs = (config, componentName) => {
|
|
13961
14099
|
return getConfiguredAndDefaultEnvs(config, componentName, types_1.DEFAULT_ENV_TYPES);
|
|
@@ -14402,6 +14540,9 @@ const assertValidInheritTarget = (environments, env, target) => {
|
|
|
14402
14540
|
if (target === "local") {
|
|
14403
14541
|
throw new Error(`environment "${env}" cannot inherit from "local" — local is not a deployment environment`);
|
|
14404
14542
|
}
|
|
14543
|
+
if ((0, config_1.isEnvironmentDisabled)(environments, target)) {
|
|
14544
|
+
throw new Error(`environment "${env}" inherits from "${target}", which is disabled (environments.${target}: false)`);
|
|
14545
|
+
}
|
|
14405
14546
|
if (!(0, config_1.isKnowEnvType)(target) && !(environments === null || environments === void 0 ? void 0 : environments[target])) {
|
|
14406
14547
|
throw new Error(`environment "${env}" inherits from unknown environment "${target}"`);
|
|
14407
14548
|
}
|
|
@@ -14417,7 +14558,7 @@ const getInheritedConfigChain = (environments, env) => {
|
|
|
14417
14558
|
const seen = new Set([env]);
|
|
14418
14559
|
let current = env;
|
|
14419
14560
|
for (;;) {
|
|
14420
|
-
const target = (0, exports.normalizeEnvInherit)((_a =
|
|
14561
|
+
const target = (0, exports.normalizeEnvInherit)((_a = (0, config_1.getEnvironmentConfig)(environments, current)) === null || _a === void 0 ? void 0 : _a.inherit).config;
|
|
14421
14562
|
if (!target)
|
|
14422
14563
|
break;
|
|
14423
14564
|
assertValidInheritTarget(environments, current, target);
|
|
@@ -14441,7 +14582,7 @@ const getSecretsEnv = (environments, env) => {
|
|
|
14441
14582
|
const seen = new Set([env]);
|
|
14442
14583
|
let current = env;
|
|
14443
14584
|
for (;;) {
|
|
14444
|
-
const target = (0, exports.normalizeEnvInherit)((_a =
|
|
14585
|
+
const target = (0, exports.normalizeEnvInherit)((_a = (0, config_1.getEnvironmentConfig)(environments, current)) === null || _a === void 0 ? void 0 : _a.inherit).secrets;
|
|
14445
14586
|
if (!target)
|
|
14446
14587
|
return current;
|
|
14447
14588
|
assertValidInheritTarget(environments, current, target);
|
|
@@ -14514,7 +14655,7 @@ const getDefaultOnForType = (envType) => {
|
|
|
14514
14655
|
*/
|
|
14515
14656
|
const getEnvOn = (env, envConfig, environments) => {
|
|
14516
14657
|
var _a;
|
|
14517
|
-
const on = (_a =
|
|
14658
|
+
const on = (_a = (0, types_1.getEnvironmentConfig)(environments, env)) === null || _a === void 0 ? void 0 : _a.on;
|
|
14518
14659
|
if (on !== undefined)
|
|
14519
14660
|
return on;
|
|
14520
14661
|
return getDefaultOnForType((0, getEnvType_1.getEnvType)(env, envConfig, environments));
|
|
@@ -14539,7 +14680,7 @@ const getEnvInherit_1 = __nccwpck_require__(52181);
|
|
|
14539
14680
|
* the type of the env they inherit their config from
|
|
14540
14681
|
*/
|
|
14541
14682
|
const getDeclaredEnvType = (environments, env, seen = new Set()) => {
|
|
14542
|
-
const declared =
|
|
14683
|
+
const declared = (0, types_1.getEnvironmentConfig)(environments, env);
|
|
14543
14684
|
if (declared === null || declared === void 0 ? void 0 : declared.type)
|
|
14544
14685
|
return declared.type;
|
|
14545
14686
|
if ((0, types_1.isKnowEnvType)(env))
|
|
@@ -14606,6 +14747,7 @@ exports.getEnvironment = getEnvironment;
|
|
|
14606
14747
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14607
14748
|
exports.getEnvironmentContext = void 0;
|
|
14608
14749
|
const bash_1 = __nccwpck_require__(94143);
|
|
14750
|
+
const config_1 = __nccwpck_require__(75591);
|
|
14609
14751
|
const getEnvConfig_1 = __nccwpck_require__(69578);
|
|
14610
14752
|
const getEnvInstance_1 = __nccwpck_require__(13055);
|
|
14611
14753
|
const getEnvInherit_1 = __nccwpck_require__(52181);
|
|
@@ -14617,7 +14759,7 @@ const getEnvironmentSlugPrefix = (env, instance) => {
|
|
|
14617
14759
|
return env;
|
|
14618
14760
|
};
|
|
14619
14761
|
const getEnvironmentContext = ({ env, componentName, config, pipelineType, }) => {
|
|
14620
|
-
var _a
|
|
14762
|
+
var _a;
|
|
14621
14763
|
const envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env);
|
|
14622
14764
|
const envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw, config.environments);
|
|
14623
14765
|
const instance = (0, getEnvInstance_1.getEnvInstance)(envConfigRaw, env, pipelineType, config.environments);
|
|
@@ -14625,7 +14767,7 @@ const getEnvironmentContext = ({ env, componentName, config, pipelineType, }) =>
|
|
|
14625
14767
|
// config; undefined means the env type's default applies
|
|
14626
14768
|
const autoStop = envConfigRaw.autoStop !== undefined
|
|
14627
14769
|
? envConfigRaw.autoStop
|
|
14628
|
-
: (
|
|
14770
|
+
: (_a = (0, config_1.getEnvironmentConfig)(config.environments, env)) === null || _a === void 0 ? void 0 : _a.autoStop;
|
|
14629
14771
|
const environmentSlugPrefix = getEnvironmentSlugPrefix(env, instance);
|
|
14630
14772
|
const environmentSlug = environmentSlugPrefix.concat(`-${componentName}`);
|
|
14631
14773
|
const fullName = (0, bash_1.joinBashExpressions)([config.customerName, config.appName, environmentSlug], "-");
|
|
@@ -15550,14 +15692,20 @@ class DeployJob extends jobs_1.CatladderJob {
|
|
|
15550
15692
|
: []),
|
|
15551
15693
|
];
|
|
15552
15694
|
// we don't want to deploy when there is a broken test
|
|
15553
|
-
const
|
|
15554
|
-
|
|
15555
|
-
artifacts: false,
|
|
15556
|
-
//
|
|
15557
|
-
|
|
15558
|
-
?
|
|
15559
|
-
|
|
15560
|
-
|
|
15695
|
+
const qualityGateRequirements = [
|
|
15696
|
+
// the component's own gates (e.g. post-build tests, custom test jobs)
|
|
15697
|
+
{ capability: "qualityGate", artifacts: false },
|
|
15698
|
+
// ...and the gates of the workspace build it is built in
|
|
15699
|
+
...((0, context_1.componentContextHasWorkspaceBuild)(context)
|
|
15700
|
+
? [
|
|
15701
|
+
{
|
|
15702
|
+
capability: "qualityGate",
|
|
15703
|
+
artifacts: false,
|
|
15704
|
+
from: { workspace: context.build.workspaceName },
|
|
15705
|
+
},
|
|
15706
|
+
]
|
|
15707
|
+
: []),
|
|
15708
|
+
];
|
|
15561
15709
|
super({
|
|
15562
15710
|
name: exports.DEPLOY_JOB_NAME,
|
|
15563
15711
|
script: jobDefinition.script,
|
|
@@ -15574,7 +15722,7 @@ class DeployJob extends jobs_1.CatladderJob {
|
|
|
15574
15722
|
...waitForRequirements,
|
|
15575
15723
|
// if the build is disabled, we don't need to wait for it
|
|
15576
15724
|
...(context.build.type !== "disabled"
|
|
15577
|
-
? [...buildRequirements,
|
|
15725
|
+
? [...buildRequirements, ...qualityGateRequirements]
|
|
15578
15726
|
: []),
|
|
15579
15727
|
],
|
|
15580
15728
|
gate: whenDeploy,
|
|
@@ -16438,7 +16586,9 @@ const getSchedulerArgs = (scheduler, context) => {
|
|
|
16438
16586
|
appFullName: context.environment.fullName,
|
|
16439
16587
|
projectId,
|
|
16440
16588
|
region,
|
|
16441
|
-
|
|
16589
|
+
// lands in a script line (not an exported variable), so the
|
|
16590
|
+
// raw expression is what the shell has to see
|
|
16591
|
+
}).toString(),
|
|
16442
16592
|
"message-body": body
|
|
16443
16593
|
? '"' + (0, bash_1.bashEscape)(JSON.stringify(body)) + '"'
|
|
16444
16594
|
: undefined,
|
|
@@ -16878,11 +17028,16 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
|
16878
17028
|
|
|
16879
17029
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
16880
17030
|
exports.getCloudRunJobExecuteUrl = void 0;
|
|
17031
|
+
const bash_1 = __nccwpck_require__(94143);
|
|
16881
17032
|
const jobName_1 = __nccwpck_require__(65576);
|
|
16882
17033
|
function getCloudRunJobExecuteUrl(jobName, { region, projectId, appFullName, }) {
|
|
16883
17034
|
const uriBase = `https://${region}-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/${projectId}/jobs`;
|
|
16884
17035
|
const fullJobName = (0, jobName_1.getCloudRunJobName)(appFullName, jobName);
|
|
16885
|
-
|
|
17036
|
+
// joined, not interpolated: on review envs the job name is a bash
|
|
17037
|
+
// expression (the review slug), and a template string would demote
|
|
17038
|
+
// it to a plain string — its quotes then get escaped as literal
|
|
17039
|
+
// characters when the variable is exported
|
|
17040
|
+
return (0, bash_1.joinBashExpressions)([uriBase, "/", fullJobName, ":run"]);
|
|
16886
17041
|
}
|
|
16887
17042
|
exports.getCloudRunJobExecuteUrl = getCloudRunJobExecuteUrl;
|
|
16888
17043
|
//# sourceMappingURL=cloudRunExecutionUrl.js.map
|
|
@@ -18343,6 +18498,7 @@ __exportStar(__nccwpck_require__(15707), exports);
|
|
|
18343
18498
|
__exportStar(__nccwpck_require__(45492), exports);
|
|
18344
18499
|
__exportStar(__nccwpck_require__(3659), exports);
|
|
18345
18500
|
__exportStar(__nccwpck_require__(50713), exports);
|
|
18501
|
+
__exportStar(__nccwpck_require__(28458), exports);
|
|
18346
18502
|
__exportStar(__nccwpck_require__(26041), exports);
|
|
18347
18503
|
__exportStar(__nccwpck_require__(47663), exports);
|
|
18348
18504
|
__exportStar(__nccwpck_require__(91804), exports);
|
|
@@ -18940,6 +19096,7 @@ exports.createJobsForComponentContext = void 0;
|
|
|
18940
19096
|
const build_1 = __nccwpck_require__(45492);
|
|
18941
19097
|
const deploy_1 = __nccwpck_require__(3659);
|
|
18942
19098
|
const jobs_1 = __nccwpck_require__(98521);
|
|
19099
|
+
const createPostBuildTestJobs_1 = __nccwpck_require__(61844);
|
|
18943
19100
|
const createVerifyJobs_1 = __nccwpck_require__(66900);
|
|
18944
19101
|
const injectDefaultVarsInCustomJobs = (context, jobs) => jobs.map(({ variables, ...job }) => {
|
|
18945
19102
|
var _a;
|
|
@@ -18959,17 +19116,26 @@ const getCustomJobs = (context) => {
|
|
|
18959
19116
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
18960
19117
|
};
|
|
18961
19118
|
const createJobsForComponentContext = async (context) => {
|
|
18962
|
-
const [buildJobs, deployJobs, verifyJobs] = await Promise.all([
|
|
19119
|
+
const [buildJobs, postBuildTestJobs, deployJobs, verifyJobs] = await Promise.all([
|
|
18963
19120
|
context.build.type !== "disabled"
|
|
18964
19121
|
? build_1.BUILD_TYPES[context.build.buildType].jobs(context)
|
|
18965
19122
|
: [],
|
|
19123
|
+
(0, createPostBuildTestJobs_1.createPostBuildTestJobs)(context),
|
|
18966
19124
|
context.componentConfig.deploy !== false
|
|
18967
19125
|
? deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context)
|
|
18968
19126
|
: [],
|
|
18969
19127
|
(0, createVerifyJobs_1.createVerifyJobs)(context),
|
|
18970
19128
|
]);
|
|
18971
19129
|
const customJobs = getCustomJobs(context);
|
|
18972
|
-
|
|
19130
|
+
const otherJobs = [...buildJobs, ...deployJobs, ...verifyJobs, ...customJobs];
|
|
19131
|
+
(0, createPostBuildTestJobs_1.assertUniquePostBuildTestNames)(context, postBuildTestJobs, otherJobs);
|
|
19132
|
+
return [
|
|
19133
|
+
...buildJobs,
|
|
19134
|
+
...postBuildTestJobs,
|
|
19135
|
+
...deployJobs,
|
|
19136
|
+
...verifyJobs,
|
|
19137
|
+
...customJobs,
|
|
19138
|
+
];
|
|
18973
19139
|
};
|
|
18974
19140
|
exports.createJobsForComponentContext = createJobsForComponentContext;
|
|
18975
19141
|
//# sourceMappingURL=createJobsForComponent.js.map
|
|
@@ -18984,9 +19150,14 @@ exports.createJobsForComponentContext = createJobsForComponentContext;
|
|
|
18984
19150
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
18985
19151
|
exports.createJobsForWorkspace = void 0;
|
|
18986
19152
|
const build_1 = __nccwpck_require__(45492);
|
|
19153
|
+
const createPostBuildTestJobs_1 = __nccwpck_require__(61844);
|
|
18987
19154
|
const createJobsForWorkspace = async (context) => {
|
|
18988
|
-
const buildJobs = await
|
|
18989
|
-
|
|
19155
|
+
const [buildJobs, postBuildTestJobs] = await Promise.all([
|
|
19156
|
+
build_1.WORKSPACE_BUILD_TYPES[context.build.buildType].jobs(context),
|
|
19157
|
+
(0, createPostBuildTestJobs_1.createPostBuildTestJobs)(context),
|
|
19158
|
+
]);
|
|
19159
|
+
(0, createPostBuildTestJobs_1.assertUniquePostBuildTestNames)(context, postBuildTestJobs, buildJobs);
|
|
19160
|
+
return [...buildJobs, ...postBuildTestJobs];
|
|
18990
19161
|
};
|
|
18991
19162
|
exports.createJobsForWorkspace = createJobsForWorkspace;
|
|
18992
19163
|
//# sourceMappingURL=createJobsForWorkspace.js.map
|
|
@@ -19264,15 +19435,18 @@ const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
|
19264
19435
|
const patchFiles = baseInfo.type === "pnpm"
|
|
19265
19436
|
? (0, pnpmUtils_1.getPnpmPatchFiles)(componentIsInWorkspace ? workspaceRoot : component.dir)
|
|
19266
19437
|
: [];
|
|
19438
|
+
// sort the variable parts: their order depends on package.json key order
|
|
19439
|
+
// and dependency traversal, and an unstable order rewrites the generated
|
|
19440
|
+
// pipeline files on every regeneration without any real change
|
|
19267
19441
|
const pathsToCopyInDocker = [
|
|
19268
19442
|
...new Set([
|
|
19269
19443
|
packageJson,
|
|
19270
19444
|
...(workspacePackageJson ? [workspacePackageJson] : []),
|
|
19271
19445
|
lockFile,
|
|
19272
19446
|
...configFilePaths,
|
|
19273
|
-
...allWorkspaceManifests,
|
|
19274
|
-
...patchFiles,
|
|
19275
|
-
...currentWorkspaceDependencies,
|
|
19447
|
+
...[...allWorkspaceManifests].sort(),
|
|
19448
|
+
...[...patchFiles].sort(),
|
|
19449
|
+
...[...currentWorkspaceDependencies].sort(),
|
|
19276
19450
|
]),
|
|
19277
19451
|
];
|
|
19278
19452
|
return {
|
|
@@ -19452,6 +19626,7 @@ exports.resolveRequirements = void 0;
|
|
|
19452
19626
|
const DEFAULT_STAGE_CAPABILITIES = {
|
|
19453
19627
|
build: "build",
|
|
19454
19628
|
test: "qualityGate",
|
|
19629
|
+
"post-build": "qualityGate",
|
|
19455
19630
|
deploy: "deployment",
|
|
19456
19631
|
};
|
|
19457
19632
|
/**
|
|
@@ -19593,6 +19768,216 @@ exports.getWorkspaceDependencies = getWorkspaceDependencies;
|
|
|
19593
19768
|
|
|
19594
19769
|
/***/ }),
|
|
19595
19770
|
|
|
19771
|
+
/***/ 61844:
|
|
19772
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
19773
|
+
|
|
19774
|
+
"use strict";
|
|
19775
|
+
|
|
19776
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
19777
|
+
exports.assertUniquePostBuildTestNames = exports.createPostBuildTestJobs = exports.postBuildTestJobName = exports.POST_BUILD_TEST_STAGE = void 0;
|
|
19778
|
+
const createArtifactsConfig_1 = __nccwpck_require__(14149);
|
|
19779
|
+
const cache_1 = __nccwpck_require__(74559);
|
|
19780
|
+
const constants_1 = __nccwpck_require__(5576);
|
|
19781
|
+
const packageManagerInstall_1 = __nccwpck_require__(28419);
|
|
19782
|
+
const types_1 = __nccwpck_require__(35249);
|
|
19783
|
+
const runner_1 = __nccwpck_require__(92146);
|
|
19784
|
+
const jobs_1 = __nccwpck_require__(98521);
|
|
19785
|
+
const utils_1 = __nccwpck_require__(49401);
|
|
19786
|
+
exports.POST_BUILD_TEST_STAGE = "post-build";
|
|
19787
|
+
const postBuildTestJobName = (name) => `🔬 ${name}`;
|
|
19788
|
+
exports.postBuildTestJobName = postBuildTestJobName;
|
|
19789
|
+
const getPostBuildTestsConfig = (context) => {
|
|
19790
|
+
if (context.type === "workspace") {
|
|
19791
|
+
return context.build.config.postBuildTests;
|
|
19792
|
+
}
|
|
19793
|
+
if (context.build.type === "disabled") {
|
|
19794
|
+
return undefined;
|
|
19795
|
+
}
|
|
19796
|
+
return context.build.config.postBuildTests;
|
|
19797
|
+
};
|
|
19798
|
+
/**
|
|
19799
|
+
* whether the build output is a node project, so the job has to install
|
|
19800
|
+
* the dependencies before running the tests
|
|
19801
|
+
*/
|
|
19802
|
+
const isNodeBuild = (context) => {
|
|
19803
|
+
if (context.type === "workspace") {
|
|
19804
|
+
return true; // workspace builds are node builds
|
|
19805
|
+
}
|
|
19806
|
+
if (context.build.type === "fromWorkspace") {
|
|
19807
|
+
return true;
|
|
19808
|
+
}
|
|
19809
|
+
if (context.build.type === "standalone") {
|
|
19810
|
+
return (0, types_1.isOfBuildType)(context.build.config, "node", "node-static", "storybook", "meteor");
|
|
19811
|
+
}
|
|
19812
|
+
return false;
|
|
19813
|
+
};
|
|
19814
|
+
const hasBuildCommand = (buildCommand) => buildCommand !== null && buildCommand !== false;
|
|
19815
|
+
/**
|
|
19816
|
+
* whether the build creates an app build job with artifacts. Rails builds
|
|
19817
|
+
* and builds with `buildCommand: false` only build the docker image.
|
|
19818
|
+
*/
|
|
19819
|
+
const hasBuildArtifacts = (context) => {
|
|
19820
|
+
if (context.type === "workspace") {
|
|
19821
|
+
return hasBuildCommand(context.build.config.buildCommand);
|
|
19822
|
+
}
|
|
19823
|
+
if (context.build.type === "fromWorkspace") {
|
|
19824
|
+
return hasBuildCommand(context.build.workspaceBuildConfig.buildCommand);
|
|
19825
|
+
}
|
|
19826
|
+
if (context.build.type === "standalone") {
|
|
19827
|
+
return (!(0, types_1.isOfBuildType)(context.build.config, "rails") &&
|
|
19828
|
+
hasBuildCommand(context.build.config.buildCommand));
|
|
19829
|
+
}
|
|
19830
|
+
return false;
|
|
19831
|
+
};
|
|
19832
|
+
const getDefaultImage = (context) => {
|
|
19833
|
+
if (context.type === "component" &&
|
|
19834
|
+
context.build.type === "standalone" &&
|
|
19835
|
+
(0, types_1.isOfBuildType)(context.build.config, "custom")) {
|
|
19836
|
+
// custom builds bring their own toolchain image
|
|
19837
|
+
return context.build.config.jobImage;
|
|
19838
|
+
}
|
|
19839
|
+
return (0, runner_1.getRunnerImage)("jobs-default");
|
|
19840
|
+
};
|
|
19841
|
+
/**
|
|
19842
|
+
* jobs for `postBuildTests`: they run after the build in the `post-build`
|
|
19843
|
+
* stage, against the build artifacts, and act as quality gates, so a
|
|
19844
|
+
* failing post-build test blocks the deploy.
|
|
19845
|
+
*/
|
|
19846
|
+
const createPostBuildTestJobs = async (context) => {
|
|
19847
|
+
var _a;
|
|
19848
|
+
// like lint and test: tagged releases deploy what was already tested
|
|
19849
|
+
if (context.trigger === "taggedRelease") {
|
|
19850
|
+
return [];
|
|
19851
|
+
}
|
|
19852
|
+
const tests = Object.entries((_a = getPostBuildTestsConfig(context)) !== null && _a !== void 0 ? _a : {}).filter((entry) => entry[1] !== false);
|
|
19853
|
+
if (tests.length === 0) {
|
|
19854
|
+
return [];
|
|
19855
|
+
}
|
|
19856
|
+
const nodeBuild = isNodeBuild(context);
|
|
19857
|
+
const [packageManagerInstall, nodeCache] = nodeBuild
|
|
19858
|
+
? await Promise.all([
|
|
19859
|
+
(0, packageManagerInstall_1.getPackageManagerInstall)(context),
|
|
19860
|
+
// pull-only: the build job is the designated cache writer
|
|
19861
|
+
(0, cache_1.getNodeCache)(context, "pull"),
|
|
19862
|
+
])
|
|
19863
|
+
: [null, null];
|
|
19864
|
+
// components built in a workspace test the workspace build output
|
|
19865
|
+
const from = context.type === "component" && context.build.type === "fromWorkspace"
|
|
19866
|
+
? { workspace: context.build.workspaceName }
|
|
19867
|
+
: undefined;
|
|
19868
|
+
const buildRequirement = hasBuildArtifacts(context)
|
|
19869
|
+
? { capability: "buildArtifacts", artifacts: true, strict: true, from }
|
|
19870
|
+
: // no build artifacts (e.g. rails): run after the build (docker image)
|
|
19871
|
+
{ capability: "build", artifacts: false, from };
|
|
19872
|
+
return tests.map(([name, test]) => {
|
|
19873
|
+
var _a, _b, _c;
|
|
19874
|
+
const artifactsConfig = (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, test.artifactsReports, test.artifacts);
|
|
19875
|
+
return new jobs_1.CatladderJob({
|
|
19876
|
+
name: (0, exports.postBuildTestJobName)(name),
|
|
19877
|
+
stage: exports.POST_BUILD_TEST_STAGE,
|
|
19878
|
+
envMode: "stagePerEnv",
|
|
19879
|
+
provides: ["qualityGate"],
|
|
19880
|
+
needs: [],
|
|
19881
|
+
requires: [buildRequirement],
|
|
19882
|
+
image: (_a = test.jobImage) !== null && _a !== void 0 ? _a : getDefaultImage(context),
|
|
19883
|
+
services: test.services,
|
|
19884
|
+
// neutral cache declarations, lowered by each backend
|
|
19885
|
+
caches: nodeCache !== null && nodeCache !== void 0 ? nodeCache : undefined,
|
|
19886
|
+
variables: {
|
|
19887
|
+
APP_PATH: context.build.dir,
|
|
19888
|
+
...(context.type === "component"
|
|
19889
|
+
? context.environment.jobOnlyVars.build.envVars
|
|
19890
|
+
: {}),
|
|
19891
|
+
...((_b = test.vars) !== null && _b !== void 0 ? _b : {}),
|
|
19892
|
+
},
|
|
19893
|
+
runnerVariables: {
|
|
19894
|
+
...(nodeBuild ? constants_1.NODE_RUNNER_BUILD_VARIABLES : {}),
|
|
19895
|
+
...((_c = test.runnerVariables) !== null && _c !== void 0 ? _c : {}),
|
|
19896
|
+
},
|
|
19897
|
+
script: [
|
|
19898
|
+
...(nodeBuild ? (0, packageManagerInstall_1.ensureNodeVersion)(context) : []),
|
|
19899
|
+
`cd ${context.build.dir}`,
|
|
19900
|
+
...(packageManagerInstall !== null && packageManagerInstall !== void 0 ? packageManagerInstall : []),
|
|
19901
|
+
...(0, utils_1.ensureArray)(test.command),
|
|
19902
|
+
],
|
|
19903
|
+
allow_failure: test.allowFailure,
|
|
19904
|
+
// reports and screenshots are most needed when the tests fail
|
|
19905
|
+
...(artifactsConfig
|
|
19906
|
+
? {
|
|
19907
|
+
artifacts: {
|
|
19908
|
+
when: "always",
|
|
19909
|
+
...artifactsConfig.artifacts,
|
|
19910
|
+
},
|
|
19911
|
+
}
|
|
19912
|
+
: {}),
|
|
19913
|
+
});
|
|
19914
|
+
});
|
|
19915
|
+
};
|
|
19916
|
+
exports.createPostBuildTestJobs = createPostBuildTestJobs;
|
|
19917
|
+
const jobIdOf = (jobName) => jobName
|
|
19918
|
+
.toLowerCase()
|
|
19919
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
19920
|
+
.replace(/^-+|-+$/g, "");
|
|
19921
|
+
/**
|
|
19922
|
+
* post-build test names are chosen by the user. Github job ids drop the
|
|
19923
|
+
* emoji of the job name, so e.g. a post-build test named `test` would
|
|
19924
|
+
* clash with the `🧪 test` job.
|
|
19925
|
+
*/
|
|
19926
|
+
const assertUniquePostBuildTestNames = (context, postBuildTestJobs, otherJobs) => {
|
|
19927
|
+
const seenIds = new Set(otherJobs.map((job) => jobIdOf(job.name)));
|
|
19928
|
+
// also catches two post-build tests that only differ in case or
|
|
19929
|
+
// punctuation (e.g. `e2e` and `E2E`)
|
|
19930
|
+
const clash = postBuildTestJobs.find((job) => {
|
|
19931
|
+
const id = jobIdOf(job.name);
|
|
19932
|
+
const isClash = seenIds.has(id);
|
|
19933
|
+
seenIds.add(id);
|
|
19934
|
+
return isClash;
|
|
19935
|
+
});
|
|
19936
|
+
if (clash) {
|
|
19937
|
+
throw new Error(`${context.name}: post-build test '${clash.name}' clashes with another job of the same name, please rename it in postBuildTests`);
|
|
19938
|
+
}
|
|
19939
|
+
};
|
|
19940
|
+
exports.assertUniquePostBuildTestNames = assertUniquePostBuildTestNames;
|
|
19941
|
+
//# sourceMappingURL=createPostBuildTestJobs.js.map
|
|
19942
|
+
|
|
19943
|
+
/***/ }),
|
|
19944
|
+
|
|
19945
|
+
/***/ 28458:
|
|
19946
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
19947
|
+
|
|
19948
|
+
"use strict";
|
|
19949
|
+
|
|
19950
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
19951
|
+
if (k2 === undefined) k2 = k;
|
|
19952
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19953
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19954
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19955
|
+
}
|
|
19956
|
+
Object.defineProperty(o, k2, desc);
|
|
19957
|
+
}) : (function(o, m, k, k2) {
|
|
19958
|
+
if (k2 === undefined) k2 = k;
|
|
19959
|
+
o[k2] = m[k];
|
|
19960
|
+
}));
|
|
19961
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19962
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19963
|
+
};
|
|
19964
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
19965
|
+
__exportStar(__nccwpck_require__(92967), exports);
|
|
19966
|
+
__exportStar(__nccwpck_require__(61844), exports);
|
|
19967
|
+
//# sourceMappingURL=index.js.map
|
|
19968
|
+
|
|
19969
|
+
/***/ }),
|
|
19970
|
+
|
|
19971
|
+
/***/ 92967:
|
|
19972
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
19973
|
+
|
|
19974
|
+
"use strict";
|
|
19975
|
+
|
|
19976
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
19977
|
+
//# sourceMappingURL=types.js.map
|
|
19978
|
+
|
|
19979
|
+
/***/ }),
|
|
19980
|
+
|
|
19596
19981
|
/***/ 26041:
|
|
19597
19982
|
/***/ ((__unused_webpack_module, exports) => {
|
|
19598
19983
|
|
|
@@ -19789,7 +20174,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
19789
20174
|
"use strict";
|
|
19790
20175
|
|
|
19791
20176
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
19792
|
-
exports.isKnowEnvType = exports.DEFAULT_ENV_TYPES = exports.DEFAULT_ENVS = exports.ENV_TYPES = exports.envTriggerEquals = exports.isBranchTrigger = exports.ALL_PIPELINE_TRIGGERS = void 0;
|
|
20177
|
+
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;
|
|
19793
20178
|
exports.ALL_PIPELINE_TRIGGERS = [
|
|
19794
20179
|
"mainBranch",
|
|
19795
20180
|
"mr",
|
|
@@ -19832,6 +20217,14 @@ const isKnowEnvType = (env) => {
|
|
|
19832
20217
|
return env in exports.ENV_TYPES;
|
|
19833
20218
|
};
|
|
19834
20219
|
exports.isKnowEnvType = isKnowEnvType;
|
|
20220
|
+
/**
|
|
20221
|
+
* the project-wide config of `env` (undefined when not declared or
|
|
20222
|
+
* disabled)
|
|
20223
|
+
*/
|
|
20224
|
+
const getEnvironmentConfig = (environments, env) => (environments === null || environments === void 0 ? void 0 : environments[env]) || undefined;
|
|
20225
|
+
exports.getEnvironmentConfig = getEnvironmentConfig;
|
|
20226
|
+
const isEnvironmentDisabled = (environments, env) => (environments === null || environments === void 0 ? void 0 : environments[env]) === false;
|
|
20227
|
+
exports.isEnvironmentDisabled = isEnvironmentDisabled;
|
|
19835
20228
|
//# sourceMappingURL=config.js.map
|
|
19836
20229
|
|
|
19837
20230
|
/***/ }),
|
|
@@ -19918,6 +20311,7 @@ exports.BASE_STAGES = [
|
|
|
19918
20311
|
"setup",
|
|
19919
20312
|
"test",
|
|
19920
20313
|
"build",
|
|
20314
|
+
"post-build",
|
|
19921
20315
|
"deploy",
|
|
19922
20316
|
"verify",
|
|
19923
20317
|
"agents",
|