@catladder/cli 0.0.0-main-085e963c → 0.0.0-main-46c5c159
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 +190 -180
- package/dist/bundles/cli/index.js +308 -285
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +22 -19
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandOpenDashboard.js +10 -9
- package/dist/cli/src/apps/cli/commands/project/commandOpenDashboard.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandPortForward.js +18 -16
- package/dist/cli/src/apps/cli/commands/project/commandPortForward.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +10 -9
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js +9 -8
- package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +23 -22
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js +10 -9
- package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js.map +1 -1
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js +6 -5
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -1
- package/dist/cli/src/kubernetes/openKubernetesDashboards.js +10 -8
- package/dist/cli/src/kubernetes/openKubernetesDashboards.js.map +1 -1
- package/dist/pipeline/src/build/base/createAppBuildJob.js +8 -6
- package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
- package/dist/pipeline/src/build/base/writeBuildInfo.js +1 -1
- package/dist/pipeline/src/build/base/writeBuildInfo.js.map +1 -1
- package/dist/pipeline/src/build/base/writeDotEnv.js +1 -1
- package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
- package/dist/pipeline/src/build/custom/buildJob.js +4 -4
- package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/custom/testJob.js +5 -5
- package/dist/pipeline/src/build/custom/testJob.js.map +1 -1
- package/dist/pipeline/src/build/docker.d.ts +2 -2
- package/dist/pipeline/src/build/docker.js +13 -10
- package/dist/pipeline/src/build/docker.js.map +1 -1
- package/dist/pipeline/src/build/node/buildJob.js +8 -8
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.js +1 -1
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/node/meteor.js +9 -9
- package/dist/pipeline/src/build/node/meteor.js.map +1 -1
- package/dist/pipeline/src/build/node/testJob.js +12 -12
- package/dist/pipeline/src/build/node/testJob.js.map +1 -1
- package/dist/pipeline/src/build/rails/build.js +3 -3
- package/dist/pipeline/src/build/rails/build.js.map +1 -1
- package/dist/pipeline/src/build/rails/test.js +4 -4
- package/dist/pipeline/src/build/rails/test.js.map +1 -1
- package/dist/pipeline/src/build/sbom.js +3 -3
- package/dist/pipeline/src/build/sbom.js.map +1 -1
- package/dist/pipeline/src/context/getLabels.js +1 -1
- package/dist/pipeline/src/context/getLabels.js.map +1 -1
- package/dist/pipeline/src/context/index.js +37 -15
- package/dist/pipeline/src/context/index.js.map +1 -1
- package/dist/pipeline/src/deploy/base/deploy.js +10 -17
- package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.d.ts +1 -1
- package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js +8 -9
- package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.js +4 -5
- package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/common.d.ts +4 -4
- package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js +2 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/index.js +2 -4
- package/dist/pipeline/src/deploy/cloudRun/createJobs/index.js.map +1 -1
- package/dist/pipeline/src/deploy/custom/deployJob.js +7 -10
- package/dist/pipeline/src/deploy/custom/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/dockerTag/deployJob.js +3 -5
- package/dist/pipeline/src/deploy/dockerTag/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js +11 -9
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/deployJob.js +3 -6
- package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeEnv.js +2 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeEnv.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.js +6 -6
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/mongodb.js +11 -11
- package/dist/pipeline/src/deploy/kubernetes/mongodb.js.map +1 -1
- package/dist/pipeline/src/deploy/sbom.js +1 -2
- package/dist/pipeline/src/deploy/sbom.js.map +1 -1
- package/dist/pipeline/src/deploy/types/index.d.ts +1 -1
- package/dist/pipeline/src/deploy/types/index.js +1 -1
- package/dist/pipeline/src/deploy/types/index.js.map +1 -1
- package/dist/pipeline/src/deploy/utils.js +2 -1
- package/dist/pipeline/src/deploy/utils.js.map +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.js +6 -8
- package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
- package/dist/pipeline/src/types/config.d.ts +1 -1
- package/dist/pipeline/src/types/context.d.ts +13 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +6 -9
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +2 -2
- package/src/apps/cli/commands/project/commandPortForward.ts +4 -4
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupContext.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +1 -1
- package/src/apps/cli/commands/project/utils/ensureCluster.ts +2 -4
- package/src/gcloud/cloudRun/openCloudRunDashboards.ts +2 -2
- package/src/kubernetes/openKubernetesDashboards.ts +2 -2
|
@@ -2267,17 +2267,19 @@ var createAppBuildJob = function (context, _a) {
|
|
|
2267
2267
|
image: (0, __1.getRunnerImage)("jobs-default"),
|
|
2268
2268
|
needs: [],
|
|
2269
2269
|
cache: [],
|
|
2270
|
-
variables: __assign(__assign(__assign(__assign({}, (variables !== null && variables !== void 0 ? variables : {})), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), ((_b = context.
|
|
2271
|
-
runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), (runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {})), ((_c = context.
|
|
2270
|
+
variables: __assign(__assign(__assign(__assign({}, (variables !== null && variables !== void 0 ? variables : {})), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), ((_b = context.build.config.extraVars) !== null && _b !== void 0 ? _b : {})),
|
|
2271
|
+
runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), (runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {})), ((_c = context.build.config.runnerVariables) !== null && _c !== void 0 ? _c : {})),
|
|
2272
2272
|
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((context.componentConfig.dotEnv === true // don't build when set to `local`
|
|
2273
2273
|
? (0, writeDotEnv_1.writeDotEnv)(context)
|
|
2274
|
-
: [])), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context.
|
|
2275
|
-
"cd ".concat(context.
|
|
2274
|
+
: [])), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
|
|
2275
|
+
"cd ".concat(context.build.dir)
|
|
2276
2276
|
], false), __read(((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : [])), false),
|
|
2277
2277
|
artifacts: {
|
|
2278
|
-
paths: [(0, path_1.join)(context.
|
|
2278
|
+
paths: [(0, path_1.join)(context.build.dir, "__build_info.json")],
|
|
2279
2279
|
reports: {
|
|
2280
|
-
junit: (_f = (_e = context.
|
|
2280
|
+
junit: (_f = (_e = context.build.config.artifactsReports) === null || _e === void 0 ? void 0 : _e.junit) === null || _f === void 0 ? void 0 : _f.map(function (p) {
|
|
2281
|
+
return (0, path_1.join)(context.build.dir, p);
|
|
2282
|
+
}),
|
|
2281
2283
|
},
|
|
2282
2284
|
},
|
|
2283
2285
|
}, def);
|
|
@@ -2425,7 +2427,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
2425
2427
|
exports.writeBuildInfo = void 0;
|
|
2426
2428
|
var writeBuildInfo = function (context) {
|
|
2427
2429
|
return [
|
|
2428
|
-
"echo '{\"id\":\"".concat(context.environment.envVars.BUILD_INFO_BUILD_ID, "\",\"time\":\"").concat(context.environment.envVars.BUILD_INFO_BUILD_TIME, "\"}' > ").concat(context.
|
|
2430
|
+
"echo '{\"id\":\"".concat(context.environment.envVars.BUILD_INFO_BUILD_ID, "\",\"time\":\"").concat(context.environment.envVars.BUILD_INFO_BUILD_TIME, "\"}' > ").concat(context.build.dir, "/__build_info.json"),
|
|
2429
2431
|
];
|
|
2430
2432
|
};
|
|
2431
2433
|
exports.writeBuildInfo = writeBuildInfo;
|
|
@@ -2477,7 +2479,7 @@ var writeDotEnv = function (context) {
|
|
|
2477
2479
|
})
|
|
2478
2480
|
.join("\n");
|
|
2479
2481
|
return [
|
|
2480
|
-
"cat <<EOF > ".concat(context.
|
|
2482
|
+
"cat <<EOF > ".concat(context.build.dir, "/.env\n").concat(keyValueString, "\nEOF"),
|
|
2481
2483
|
];
|
|
2482
2484
|
};
|
|
2483
2485
|
exports.writeDotEnv = writeDotEnv;
|
|
@@ -2529,7 +2531,7 @@ var RUNNER_BUILD_VARIABLES = {
|
|
|
2529
2531
|
};
|
|
2530
2532
|
var createCustomBuildJobs = function (context) {
|
|
2531
2533
|
var _a, _b, _c, _d;
|
|
2532
|
-
var buildConfig = context.
|
|
2534
|
+
var buildConfig = context.build.config;
|
|
2533
2535
|
if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
|
|
2534
2536
|
throw new Error("deploy config is not custom");
|
|
2535
2537
|
}
|
|
@@ -2543,10 +2545,10 @@ var createCustomBuildJobs = function (context) {
|
|
|
2543
2545
|
script: __spreadArray([], __read(((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : [])), false),
|
|
2544
2546
|
artifacts: {
|
|
2545
2547
|
paths: __spreadArray([
|
|
2546
|
-
(0, path_1.join)(context.
|
|
2547
|
-
(0, path_1.join)(context.
|
|
2548
|
+
(0, path_1.join)(context.build.dir, "__build_info.json"),
|
|
2549
|
+
(0, path_1.join)(context.build.dir, "dist")
|
|
2548
2550
|
], __read(((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
|
|
2549
|
-
return (0, path_1.join)(context.
|
|
2551
|
+
return (0, path_1.join)(context.build.dir, path);
|
|
2550
2552
|
})) !== null && _c !== void 0 ? _c : [])), false),
|
|
2551
2553
|
expire_in: "1 day",
|
|
2552
2554
|
},
|
|
@@ -2663,12 +2665,12 @@ var createCustomTestJobs = function (context) {
|
|
|
2663
2665
|
if (context.trigger === "taggedRelease") {
|
|
2664
2666
|
return [];
|
|
2665
2667
|
}
|
|
2666
|
-
var buildConfig = context.
|
|
2668
|
+
var buildConfig = context.build.config;
|
|
2667
2669
|
if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
|
|
2668
2670
|
throw new Error("deploy config is not custom");
|
|
2669
2671
|
}
|
|
2670
2672
|
var base = {
|
|
2671
|
-
variables: __assign(__assign({ APP_PATH: context.
|
|
2673
|
+
variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
|
|
2672
2674
|
runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
|
|
2673
2675
|
services: buildConfig.jobServices,
|
|
2674
2676
|
cache: buildConfig.jobCache,
|
|
@@ -2677,11 +2679,11 @@ var createCustomTestJobs = function (context) {
|
|
|
2677
2679
|
envMode: "none",
|
|
2678
2680
|
};
|
|
2679
2681
|
var auditJob = buildConfig.audit
|
|
2680
|
-
? __assign(__assign(__assign({ name: "🛡 audit" }, base), { image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage, cache: undefined, script: __spreadArray([], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
2682
|
+
? __assign(__assign(__assign({ name: "🛡 audit" }, base), { image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage, cache: undefined, script: __spreadArray([], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts)) : null;
|
|
2681
2683
|
var lintJob = buildConfig.lint
|
|
2682
|
-
? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : buildConfig.jobImage, script: __spreadArray([], __read(((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
2684
|
+
? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : buildConfig.jobImage, script: __spreadArray([], __read(((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts)) : null;
|
|
2683
2685
|
var testJob = buildConfig.test
|
|
2684
|
-
? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : buildConfig.jobImage, script: __spreadArray([], __read(((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : [])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
2686
|
+
? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : buildConfig.jobImage, script: __spreadArray([], __read(((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : [])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
|
|
2685
2687
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
2686
2688
|
};
|
|
2687
2689
|
exports.createCustomTestJobs = createCustomTestJobs;
|
|
@@ -2760,7 +2762,9 @@ var DOCKER_BUILD_RUNNER_REQUESTS = {
|
|
|
2760
2762
|
KUBERNETES_MEMORY_LIMIT: "2Gi",
|
|
2761
2763
|
};
|
|
2762
2764
|
var getDockerImageVariables = function (context) {
|
|
2763
|
-
|
|
2765
|
+
var _a;
|
|
2766
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
2767
|
+
return __assign(__assign({}, ((0, deploy_1.isOfDeployType)(deployConfig, "google-cloudrun")
|
|
2764
2768
|
? {
|
|
2765
2769
|
DOCKER_REGISTRY: (0, artifactsRegistry_1.getArtifactsRegistryHost)(context),
|
|
2766
2770
|
DOCKER_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryImageName)(context),
|
|
@@ -2779,10 +2783,11 @@ exports.getDockerImageVariables = getDockerImageVariables;
|
|
|
2779
2783
|
/**
|
|
2780
2784
|
* Weather the context requires a docker build
|
|
2781
2785
|
*/
|
|
2782
|
-
var requiresDockerBuild = function (
|
|
2783
|
-
var
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
+
var requiresDockerBuild = function (context) {
|
|
2787
|
+
var _a;
|
|
2788
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
2789
|
+
return ((0, deploy_1.isOfDeployType)(deployConfig, "kubernetes", "google-cloudrun", "dockerTag") ||
|
|
2790
|
+
((0, deploy_1.isOfDeployType)(deployConfig, "custom") && deployConfig.requiresDocker));
|
|
2786
2791
|
};
|
|
2787
2792
|
exports.requiresDockerBuild = requiresDockerBuild;
|
|
2788
2793
|
// those need to be runner variables
|
|
@@ -2794,11 +2799,11 @@ var getDockerBuildRunnerVariables = function () { return ({
|
|
|
2794
2799
|
}); };
|
|
2795
2800
|
var getDockerBuildVariables = function (context) {
|
|
2796
2801
|
var _a, _b, _c, _d;
|
|
2797
|
-
return __assign({ DOCKERFILE_ADDITIONS: (_b = (_a = context.
|
|
2802
|
+
return __assign({ DOCKERFILE_ADDITIONS: (_b = (_a = context.build.config.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"), DOCKERFILE_ADDITIONS_END: (_d = (_c = context.build.config.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"), APP_DIR: context.build.dir, DOCKER_DIR: "." }, (0, exports.getDockerImageVariables)(context));
|
|
2798
2803
|
};
|
|
2799
2804
|
exports.getDockerBuildVariables = getDockerBuildVariables;
|
|
2800
2805
|
exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
|
|
2801
|
-
var getDockerJobBaseProps = function (
|
|
2806
|
+
var getDockerJobBaseProps = function () {
|
|
2802
2807
|
return {
|
|
2803
2808
|
image: (0, runner_1.getRunnerImage)("docker-build"),
|
|
2804
2809
|
services: [
|
|
@@ -2814,14 +2819,14 @@ var getDockerJobBaseProps = function (context) {
|
|
|
2814
2819
|
exports.getDockerJobBaseProps = getDockerJobBaseProps;
|
|
2815
2820
|
var createDockerBuildJobBase = function (context, _a) {
|
|
2816
2821
|
var script = _a.script, def = __rest(_a, ["script"]);
|
|
2817
|
-
return (0, lodash_1.merge)(__assign(__assign({ name: exports.DOCKER_BUILD_JOB_NAME, envMode: "jobPerEnv", stage: "build" }, (0, exports.getDockerJobBaseProps)(
|
|
2822
|
+
return (0, lodash_1.merge)(__assign(__assign({ name: exports.DOCKER_BUILD_JOB_NAME, envMode: "jobPerEnv", stage: "build" }, (0, exports.getDockerJobBaseProps)()), { script: script || [] }), {
|
|
2818
2823
|
variables: (0, exports.getDockerBuildVariables)(context),
|
|
2819
2824
|
runnerVariables: __assign(__assign({}, DOCKER_BUILD_RUNNER_REQUESTS), getDockerBuildRunnerVariables()),
|
|
2820
2825
|
}, def);
|
|
2821
2826
|
};
|
|
2822
2827
|
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
2823
2828
|
var gitlabDockerLogin = function (context) {
|
|
2824
|
-
return (0, deploy_1.isOfDeployType)(context.
|
|
2829
|
+
return context.deploy && (0, deploy_1.isOfDeployType)(context.deploy.config, "google-cloudrun")
|
|
2825
2830
|
? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [
|
|
2826
2831
|
"gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context)),
|
|
2827
2832
|
], false) : [
|
|
@@ -2842,7 +2847,7 @@ var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
|
2842
2847
|
};
|
|
2843
2848
|
exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
|
|
2844
2849
|
var hasDockerfile = function (context) {
|
|
2845
|
-
return (0, fs_1.existsSync)(path_1.default.join(context.
|
|
2850
|
+
return (0, fs_1.existsSync)(path_1.default.join(context.build.dir, "Dockerfile"));
|
|
2846
2851
|
};
|
|
2847
2852
|
exports.hasDockerfile = hasDockerfile;
|
|
2848
2853
|
//# sourceMappingURL=docker.js.map
|
|
@@ -2963,23 +2968,23 @@ var constants_1 = __nccwpck_require__(1765);
|
|
|
2963
2968
|
var yarn_1 = __nccwpck_require__(5043);
|
|
2964
2969
|
var createNodeBuildJobs = function (context) {
|
|
2965
2970
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2966
|
-
var buildConfig = context.
|
|
2971
|
+
var buildConfig = context.build.config;
|
|
2967
2972
|
if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
|
|
2968
2973
|
throw new Error("deploy config is not node, node-static or storybook");
|
|
2969
2974
|
}
|
|
2970
2975
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
2971
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
2976
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
2972
2977
|
return (0, base_1.createBuildJobs)(context, {
|
|
2973
2978
|
appBuild: buildConfig.buildCommand !== null
|
|
2974
2979
|
? {
|
|
2975
2980
|
image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
|
|
2976
2981
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
2977
|
-
cache: __spreadArray(__spreadArray(__spreadArray([], __read(((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : [])), false), __read((0, cache_1.getNodeCache)(context.
|
|
2982
|
+
cache: __spreadArray(__spreadArray(__spreadArray([], __read(((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : [])), false), __read((0, cache_1.getNodeCache)(context.build)), false), __read((0, cache_1.getNextCache)(context)), false),
|
|
2978
2983
|
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
|
|
2979
2984
|
artifacts: {
|
|
2980
2985
|
paths: __spreadArray([
|
|
2981
|
-
context.
|
|
2982
|
-
], __read(((_e = (_d = context.
|
|
2986
|
+
context.build.dir
|
|
2987
|
+
], __read(((_e = (_d = context.build.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : [])), false).flatMap(function (dir) {
|
|
2983
2988
|
var _a, _b;
|
|
2984
2989
|
return __spreadArray([
|
|
2985
2990
|
(0, path_1.join)(dir, "__build_info.json"),
|
|
@@ -2999,11 +3004,11 @@ var createNodeBuildJobs = function (context) {
|
|
|
2999
3004
|
script: (0, docker_1.getDockerBuildDefaultScript)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
|
|
3000
3005
|
? "ensureNginxDockerfile"
|
|
3001
3006
|
: "ensureNodeDockerfile"),
|
|
3002
|
-
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.
|
|
3007
|
+
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.build, "pull")), false),
|
|
3003
3008
|
variables: {
|
|
3004
3009
|
// only required for non static
|
|
3005
|
-
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.
|
|
3006
|
-
DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.
|
|
3010
|
+
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.build),
|
|
3011
|
+
DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.pathsToCopyInDocker.map(function (dir) { return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir); })) === null || _g === void 0 ? void 0 : _g.join("\n"),
|
|
3007
3012
|
},
|
|
3008
3013
|
},
|
|
3009
3014
|
});
|
|
@@ -3103,7 +3108,7 @@ var getNextCache = function (context) { return [
|
|
|
3103
3108
|
{
|
|
3104
3109
|
key: context.componentName + "-next-cache",
|
|
3105
3110
|
policy: "pull-push",
|
|
3106
|
-
paths: [context.
|
|
3111
|
+
paths: [context.build.dir + "/.next/cache/"],
|
|
3107
3112
|
},
|
|
3108
3113
|
]; };
|
|
3109
3114
|
exports.getNextCache = getNextCache;
|
|
@@ -3222,23 +3227,23 @@ var getMeteorCache = function (context) { return [
|
|
|
3222
3227
|
key: context.componentName + "meteor-build-cache",
|
|
3223
3228
|
policy: "pull-push",
|
|
3224
3229
|
paths: [
|
|
3225
|
-
(0, path_1.join)(context.
|
|
3226
|
-
(0, path_1.join)(context.
|
|
3227
|
-
(0, path_1.join)(context.
|
|
3228
|
-
(0, path_1.join)(context.
|
|
3230
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"),
|
|
3231
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/plugin-cache"),
|
|
3232
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/isopacks"),
|
|
3233
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/bundler-cache/scanner"),
|
|
3229
3234
|
],
|
|
3230
3235
|
},
|
|
3231
3236
|
]; };
|
|
3232
3237
|
var createMeteorBuildJobs = function (context) {
|
|
3233
|
-
var buildConfig = context.
|
|
3238
|
+
var buildConfig = context.build.config;
|
|
3234
3239
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
3235
3240
|
throw new Error("deploy config is not meteor");
|
|
3236
3241
|
}
|
|
3237
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
3242
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
3238
3243
|
return (0, base_1.createBuildJobs)(context, {
|
|
3239
3244
|
appBuild: buildConfig.buildCommand !== null
|
|
3240
3245
|
? {
|
|
3241
|
-
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.
|
|
3246
|
+
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.build)), false), __read(getMeteorCache(context)), false),
|
|
3242
3247
|
image: (0, runner_1.getRunnerImage)("jobs-meteor"),
|
|
3243
3248
|
variables: {
|
|
3244
3249
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1", // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
@@ -3252,8 +3257,8 @@ var createMeteorBuildJobs = function (context) {
|
|
|
3252
3257
|
], false),
|
|
3253
3258
|
artifacts: {
|
|
3254
3259
|
paths: [
|
|
3255
|
-
context.
|
|
3256
|
-
context.
|
|
3260
|
+
context.build.dir + "/__build_info.json",
|
|
3261
|
+
context.build.dir + "/dist",
|
|
3257
3262
|
],
|
|
3258
3263
|
},
|
|
3259
3264
|
}
|
|
@@ -3327,32 +3332,32 @@ var createNodeTestJobs = function (context) {
|
|
|
3327
3332
|
if (context.trigger === "taggedRelease") {
|
|
3328
3333
|
return [];
|
|
3329
3334
|
}
|
|
3330
|
-
var buildConfig = context.
|
|
3335
|
+
var buildConfig = context.build.config;
|
|
3331
3336
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
3332
3337
|
var base = {
|
|
3333
|
-
variables: __assign(__assign({ APP_PATH: context.
|
|
3338
|
+
variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
|
|
3334
3339
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
3335
3340
|
stage: "test",
|
|
3336
3341
|
needs: [],
|
|
3337
3342
|
envMode: "none",
|
|
3338
3343
|
};
|
|
3339
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
3344
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
3340
3345
|
var auditJob = buildConfig.audit !== false
|
|
3341
3346
|
? __assign(__assign(__assign({ name: "🛡 audit" }, base), { image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage, cache: undefined, script: __spreadArray([
|
|
3342
|
-
"cd ".concat(context.
|
|
3347
|
+
"cd ".concat(context.build.dir)
|
|
3343
3348
|
], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
|
|
3344
|
-
((_f = context.
|
|
3349
|
+
((_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic)
|
|
3345
3350
|
? "yarn audit"
|
|
3346
3351
|
: "yarn npm audit --environment production", // yarn 2
|
|
3347
|
-
])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
3352
|
+
])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifactsReports, (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.artifacts)) : null;
|
|
3348
3353
|
var lintJob = buildConfig.lint !== false
|
|
3349
|
-
? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_k = (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.jobImage) !== null && _k !== void 0 ? _k : defaultImage, cache: (0, cache_1.getNodeCache)(context.
|
|
3350
|
-
"cd ".concat(context.
|
|
3351
|
-
], false), __read(yarnInstall), false), __read(((_m = (0, utils_1.ensureArray)((_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.command)) !== null && _m !== void 0 ? _m : ["yarn lint"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
3354
|
+
? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_k = (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.jobImage) !== null && _k !== void 0 ? _k : defaultImage, cache: (0, cache_1.getNodeCache)(context.build), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
|
|
3355
|
+
"cd ".concat(context.build.dir)
|
|
3356
|
+
], false), __read(yarnInstall), false), __read(((_m = (0, utils_1.ensureArray)((_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.command)) !== null && _m !== void 0 ? _m : ["yarn lint"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifactsReports, (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.artifacts)) : null;
|
|
3352
3357
|
var testJob = buildConfig.test !== false
|
|
3353
|
-
? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_r = (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.jobImage) !== null && _r !== void 0 ? _r : (0, runner_1.getRunnerImage)("jobs-testing-chrome"), cache: (0, cache_1.getNodeCache)(context.
|
|
3354
|
-
"cd ".concat(context.
|
|
3355
|
-
], false), __read(yarnInstall), false), __read(((_t = (0, utils_1.ensureArray)((_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.command)) !== null && _t !== void 0 ? _t : ["yarn test"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
3358
|
+
? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_r = (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.jobImage) !== null && _r !== void 0 ? _r : (0, runner_1.getRunnerImage)("jobs-testing-chrome"), cache: (0, cache_1.getNodeCache)(context.build), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
|
|
3359
|
+
"cd ".concat(context.build.dir)
|
|
3360
|
+
], false), __read(yarnInstall), false), __read(((_t = (0, utils_1.ensureArray)((_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.command)) !== null && _t !== void 0 ? _t : ["yarn test"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifactsReports, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifacts)) : null;
|
|
3356
3361
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
3357
3362
|
};
|
|
3358
3363
|
exports.createNodeTestJobs = createNodeTestJobs;
|
|
@@ -3489,7 +3494,7 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
3489
3494
|
var types_1 = __nccwpck_require__(4466);
|
|
3490
3495
|
var createRailsBuildJobs = function (context) {
|
|
3491
3496
|
var _a, _b, _c;
|
|
3492
|
-
var buildConfig = context.
|
|
3497
|
+
var buildConfig = context.build.config;
|
|
3493
3498
|
if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
|
|
3494
3499
|
// should not happen
|
|
3495
3500
|
throw new Error("build type is not rails");
|
|
@@ -3513,10 +3518,10 @@ var createRailsBuildJobs = function (context) {
|
|
|
3513
3518
|
return (0, base_1.createBuildJobs)(context, {
|
|
3514
3519
|
appBuild: undefined,
|
|
3515
3520
|
dockerBuild: {
|
|
3516
|
-
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.
|
|
3521
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
|
|
3517
3522
|
// custom script
|
|
3518
3523
|
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
|
|
3519
|
-
"cd ".concat(context.
|
|
3524
|
+
"cd ".concat(context.build.dir),
|
|
3520
3525
|
"docker pull $DOCKER_CACHE_IMAGE || true",
|
|
3521
3526
|
"wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"),
|
|
3522
3527
|
"chmod +x /usr/local/bin/pack",
|
|
@@ -3625,7 +3630,7 @@ var createRailsTestJobs = function (context) {
|
|
|
3625
3630
|
if (context.trigger === "taggedRelease") {
|
|
3626
3631
|
return [];
|
|
3627
3632
|
}
|
|
3628
|
-
var buildConfig = context.
|
|
3633
|
+
var buildConfig = context.build.config;
|
|
3629
3634
|
var base = {
|
|
3630
3635
|
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
|
|
3631
3636
|
stage: "test",
|
|
@@ -3647,20 +3652,20 @@ var createRailsTestJobs = function (context) {
|
|
|
3647
3652
|
};
|
|
3648
3653
|
var auditJob = buildConfig.audit !== false
|
|
3649
3654
|
? __assign(__assign({ name: "🛡 audit" }, base), { cache: undefined, image: (_d = (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage) !== null && _d !== void 0 ? _d : defaultImage, script: __spreadArray([
|
|
3650
|
-
"cd ".concat(context.
|
|
3655
|
+
"cd ".concat(context.build.dir)
|
|
3651
3656
|
], __read(((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
3652
3657
|
"gem install bundler-audit",
|
|
3653
3658
|
"bundle audit check",
|
|
3654
3659
|
])), false), allow_failure: true }) : null;
|
|
3655
3660
|
var lintJob = buildConfig.lint !== false
|
|
3656
3661
|
? __assign(__assign({ name: "👮 lint" }, base), { cache: bundlerCache, image: (_j = (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : buildConfig.jobImage) !== null && _j !== void 0 ? _j : defaultImage, script: __spreadArray(__spreadArray([
|
|
3657
|
-
"cd ".concat(context.
|
|
3662
|
+
"cd ".concat(context.build.dir)
|
|
3658
3663
|
], __read(bundlerInstall), false), __read(((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [
|
|
3659
3664
|
"bundle exec rubocop",
|
|
3660
3665
|
])), false) }) : null;
|
|
3661
3666
|
var testJob = buildConfig.test !== false
|
|
3662
3667
|
? __assign(__assign({ name: "🧪 test" }, base), { cache: bundlerCache, image: (_p = (_o = (_m = buildConfig.test) === null || _m === void 0 ? void 0 : _m.jobImage) !== null && _o !== void 0 ? _o : buildConfig.jobImage) !== null && _p !== void 0 ? _p : defaultImage, script: __spreadArray(__spreadArray([
|
|
3663
|
-
"cd ".concat(context.
|
|
3668
|
+
"cd ".concat(context.build.dir)
|
|
3664
3669
|
], __read(bundlerInstall), false), __read(((_r = (0, utils_1.ensureArray)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : [
|
|
3665
3670
|
"bundle exec rspec",
|
|
3666
3671
|
])), false) }) : null;
|
|
@@ -3683,12 +3688,12 @@ exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
|
|
|
3683
3688
|
exports.SBOM_FILE = "__sbom.json";
|
|
3684
3689
|
var createSbomBuildJob = function (context) {
|
|
3685
3690
|
var _a, _b, _c, _d, _e;
|
|
3686
|
-
var buildConfig = context.
|
|
3691
|
+
var buildConfig = context.build.config;
|
|
3687
3692
|
var defaultImage = "aquasec/trivy:0.38.3";
|
|
3688
3693
|
var defaultScript = [
|
|
3689
|
-
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.
|
|
3694
|
+
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.build.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace)
|
|
3690
3695
|
? "."
|
|
3691
|
-
: context.
|
|
3696
|
+
: context.build.dir),
|
|
3692
3697
|
];
|
|
3693
3698
|
var image = buildConfig.type === "custom" && buildConfig.sbom !== false
|
|
3694
3699
|
? (_c = (_b = buildConfig.sbom) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage
|
|
@@ -4314,7 +4319,7 @@ var sanitize = function (value) {
|
|
|
4314
4319
|
};
|
|
4315
4320
|
var getLabels = function (context) {
|
|
4316
4321
|
var _a, _b, _c;
|
|
4317
|
-
var labels = __assign({ "customer-name": sanitize(context.fullConfig.customerName), "component-name": sanitize(context.componentName), "app-name": sanitize(context.fullConfig.appName), "env-type": sanitize(context.environment.envType), "env-name": sanitize(context.environment.shortName), "build-type": sanitize((_a = context.
|
|
4322
|
+
var labels = __assign({ "customer-name": sanitize(context.fullConfig.customerName), "component-name": sanitize(context.componentName), "app-name": sanitize(context.fullConfig.appName), "env-type": sanitize(context.environment.envType), "env-name": sanitize(context.environment.shortName), "build-type": sanitize((_a = context.build.config) === null || _a === void 0 ? void 0 : _a.type) }, ((_c = (_b = context.fullConfig.meta) === null || _b === void 0 ? void 0 : _b.labels) !== null && _c !== void 0 ? _c : {}));
|
|
4318
4323
|
return labels;
|
|
4319
4324
|
};
|
|
4320
4325
|
exports.getLabels = getLabels;
|
|
@@ -4353,6 +4358,17 @@ exports.getReviewSlug = getReviewSlug;
|
|
|
4353
4358
|
|
|
4354
4359
|
"use strict";
|
|
4355
4360
|
|
|
4361
|
+
var __assign = (this && this.__assign) || function () {
|
|
4362
|
+
__assign = Object.assign || function(t) {
|
|
4363
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4364
|
+
s = arguments[i];
|
|
4365
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
4366
|
+
t[p] = s[p];
|
|
4367
|
+
}
|
|
4368
|
+
return t;
|
|
4369
|
+
};
|
|
4370
|
+
return __assign.apply(this, arguments);
|
|
4371
|
+
};
|
|
4356
4372
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4357
4373
|
if (k2 === undefined) k2 = k;
|
|
4358
4374
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -4405,6 +4421,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
4405
4421
|
};
|
|
4406
4422
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4407
4423
|
exports.createContext = exports.createComponentContext = void 0;
|
|
4424
|
+
var lodash_1 = __nccwpck_require__(3255);
|
|
4408
4425
|
var build_1 = __nccwpck_require__(7862);
|
|
4409
4426
|
var deploy_1 = __nccwpck_require__(8483);
|
|
4410
4427
|
var utils_1 = __nccwpck_require__(2497);
|
|
@@ -4413,10 +4430,9 @@ var getEnvironmentContext_1 = __nccwpck_require__(3663);
|
|
|
4413
4430
|
__exportStar(__nccwpck_require__(5699), exports);
|
|
4414
4431
|
__exportStar(__nccwpck_require__(5133), exports);
|
|
4415
4432
|
var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4416
|
-
var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
switch (_b.label) {
|
|
4433
|
+
var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
4434
|
+
return __generator(this, function (_a) {
|
|
4435
|
+
switch (_a.label) {
|
|
4420
4436
|
case 0:
|
|
4421
4437
|
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
4422
4438
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
@@ -4433,22 +4449,33 @@ var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, v
|
|
|
4433
4449
|
deploy: {},
|
|
4434
4450
|
};
|
|
4435
4451
|
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
4436
|
-
|
|
4452
|
+
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
|
|
4453
|
+
case 1:
|
|
4454
|
+
environment = _a.sent();
|
|
4455
|
+
deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
|
|
4456
|
+
context = {
|
|
4437
4457
|
fullConfig: ctx.config,
|
|
4438
4458
|
componentConfig: componentConfig,
|
|
4439
|
-
|
|
4440
|
-
dir:
|
|
4459
|
+
build: {
|
|
4460
|
+
dir: dir,
|
|
4441
4461
|
packageManagerInfo: ctx.packageManagerInfo,
|
|
4442
|
-
config:
|
|
4462
|
+
config: build,
|
|
4443
4463
|
},
|
|
4444
|
-
|
|
4464
|
+
deploy: deploy
|
|
4465
|
+
? {
|
|
4466
|
+
config: deploy,
|
|
4467
|
+
}
|
|
4468
|
+
: null,
|
|
4469
|
+
componentName: ctx.componentName,
|
|
4470
|
+
environment: environment,
|
|
4471
|
+
packageManagerInfo: ctx.packageManagerInfo,
|
|
4472
|
+
pipelineType: ctx.pipelineType,
|
|
4473
|
+
trigger: ctx.trigger,
|
|
4445
4474
|
};
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
_a.trigger = ctx.trigger,
|
|
4451
|
-
_a)];
|
|
4475
|
+
resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs)
|
|
4476
|
+
? customJobs(context)
|
|
4477
|
+
: customJobs;
|
|
4478
|
+
return [2 /*return*/, __assign(__assign({}, context), { customJobs: resolvedCustomJobs })];
|
|
4452
4479
|
}
|
|
4453
4480
|
});
|
|
4454
4481
|
}); };
|
|
@@ -4863,7 +4890,7 @@ var stop_1 = __nccwpck_require__(2846);
|
|
|
4863
4890
|
var variables_1 = __nccwpck_require__(2422);
|
|
4864
4891
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
4865
4892
|
var createDeployJob = function (context, jobDefinition) {
|
|
4866
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4893
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4867
4894
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
4868
4895
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
4869
4896
|
var autoStop = context.environment.envType === "review"
|
|
@@ -4871,14 +4898,13 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
4871
4898
|
: context.environment.envType === "dev"
|
|
4872
4899
|
? "4 weeks"
|
|
4873
4900
|
: undefined;
|
|
4901
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
4874
4902
|
// if auto or manual is configured explicitly, use that
|
|
4875
|
-
var whenDeployDefined =
|
|
4876
|
-
? context.componentConfig.deploy.when
|
|
4877
|
-
: undefined;
|
|
4903
|
+
var whenDeployDefined = deployConfig && deployConfig.when ? deployConfig.when : undefined;
|
|
4878
4904
|
// otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
|
|
4879
4905
|
var whenDeployDefault = context.environment.envType !== "prod"
|
|
4880
4906
|
? "auto" // is not stage, auto deploy
|
|
4881
|
-
: ((
|
|
4907
|
+
: ((_b = context.componentConfig.env) === null || _b === void 0 ? void 0 : _b.stage) === false
|
|
4882
4908
|
? "auto" // is prod, but no staging, auto deploy
|
|
4883
4909
|
: "manual"; // manually deploy
|
|
4884
4910
|
var whenDeploy = whenDeployDefined ? whenDeployDefined : whenDeployDefault;
|
|
@@ -4892,12 +4918,12 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
4892
4918
|
envMode: "stagePerEnv", // makes it easier to run manual tasks er env
|
|
4893
4919
|
needs: __spreadArray(__spreadArray([], __read(((0, sbom_2.sbomDeactivated)(context)
|
|
4894
4920
|
? []
|
|
4895
|
-
: [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((
|
|
4896
|
-
? (
|
|
4921
|
+
: [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((deployConfig
|
|
4922
|
+
? (_d = (_c = deployConfig.waitFor) === null || _c === void 0 ? void 0 : _c.map(function (c) { return ({
|
|
4897
4923
|
componentName: c,
|
|
4898
4924
|
job: exports.DEPLOY_JOB_NAME,
|
|
4899
4925
|
artifacts: false,
|
|
4900
|
-
}); })) !== null &&
|
|
4926
|
+
}); })) !== null && _d !== void 0 ? _d : []
|
|
4901
4927
|
: [])), false),
|
|
4902
4928
|
// we don't want to deploy when there is a broken test
|
|
4903
4929
|
needsStages: [
|
|
@@ -4913,21 +4939,15 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
4913
4939
|
when: whenDeploy === "auto" ? "on_success" : "manual",
|
|
4914
4940
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
4915
4941
|
stage: "deploy",
|
|
4916
|
-
variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), (hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {})), context.environment.jobOnlyVars.deploy.envVars), (
|
|
4917
|
-
|
|
4918
|
-
: {})), jobDefinition.variables),
|
|
4919
|
-
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), ((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {})), (context.componentConfig.deploy
|
|
4920
|
-
? (_f = context.componentConfig.deploy.runnerVariables) !== null && _f !== void 0 ? _f : {}
|
|
4921
|
-
: {})),
|
|
4942
|
+
variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), (hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {})), context.environment.jobOnlyVars.deploy.envVars), (deployConfig ? (_e = deployConfig.extraVars) !== null && _e !== void 0 ? _e : {} : {})), jobDefinition.variables),
|
|
4943
|
+
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), ((_f = jobDefinition.runnerVariables) !== null && _f !== void 0 ? _f : {})), (deployConfig ? (_g = deployConfig.runnerVariables) !== null && _g !== void 0 ? _g : {} : {})),
|
|
4922
4944
|
environment: isStoppable
|
|
4923
4945
|
? {
|
|
4924
4946
|
on_stop: stop_1.STOP_JOB_NAME,
|
|
4925
4947
|
auto_stop_in: autoStop,
|
|
4926
4948
|
}
|
|
4927
4949
|
: undefined,
|
|
4928
|
-
jobTags:
|
|
4929
|
-
? context.componentConfig.deploy.jobTags
|
|
4930
|
-
: undefined,
|
|
4950
|
+
jobTags: deployConfig ? deployConfig.jobTags : undefined,
|
|
4931
4951
|
};
|
|
4932
4952
|
};
|
|
4933
4953
|
exports.createDeployJob = createDeployJob;
|
|
@@ -5125,17 +5145,18 @@ var BashExpression_1 = __nccwpck_require__(2376);
|
|
|
5125
5145
|
var gitlab_1 = __nccwpck_require__(8490);
|
|
5126
5146
|
var types_1 = __nccwpck_require__(5781);
|
|
5127
5147
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(4398);
|
|
5128
|
-
var getArtifactsRegistryHost = function (
|
|
5129
|
-
var
|
|
5130
|
-
if (!(0, types_1.isOfDeployType)(deploy, "google-cloudrun")) {
|
|
5148
|
+
var getArtifactsRegistryHost = function (context) {
|
|
5149
|
+
var _a;
|
|
5150
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun")) {
|
|
5131
5151
|
// should not happen
|
|
5132
5152
|
throw new Error("deploy config is wrong");
|
|
5133
5153
|
}
|
|
5134
|
-
return "".concat(deploy.region, "-docker.pkg.dev");
|
|
5154
|
+
return "".concat(context.deploy.config.region, "-docker.pkg.dev");
|
|
5135
5155
|
};
|
|
5136
5156
|
exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
|
|
5137
5157
|
var getArtifactsRegistryDockerUrl = function (context) {
|
|
5138
|
-
var
|
|
5158
|
+
var _a;
|
|
5159
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5139
5160
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5140
5161
|
// should not happen
|
|
5141
5162
|
throw new Error("deploy config is wrong");
|
|
@@ -5198,11 +5219,9 @@ var getDeleteImageCommands = function (fullImageName, keepNewest) {
|
|
|
5198
5219
|
* @returns
|
|
5199
5220
|
*/
|
|
5200
5221
|
var getDeleteUnusedImagesCommands = function (context, keep) {
|
|
5222
|
+
var _a;
|
|
5201
5223
|
if (keep === void 0) { keep = 0; }
|
|
5202
|
-
var deployConfig = context.
|
|
5203
|
-
if (deployConfig === false) {
|
|
5204
|
-
return [];
|
|
5205
|
-
}
|
|
5224
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5206
5225
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5207
5226
|
// should not happen
|
|
5208
5227
|
throw new Error("deploy config is wrong");
|
|
@@ -5293,8 +5312,9 @@ var createArgsString_1 = __nccwpck_require__(9598);
|
|
|
5293
5312
|
var getServiceName_1 = __nccwpck_require__(8128);
|
|
5294
5313
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(4398);
|
|
5295
5314
|
var getListRevisionsCommand = function (context, args) {
|
|
5315
|
+
var _a;
|
|
5296
5316
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
5297
|
-
var deployConfig = context.
|
|
5317
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5298
5318
|
if (!deployConfig || !(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5299
5319
|
// should not happen
|
|
5300
5320
|
throw new Error("deploy config is wrong");
|
|
@@ -5306,10 +5326,8 @@ var getListRevisionsCommand = function (context, args) {
|
|
|
5306
5326
|
return "gcloud run revisions list ".concat((0, createArgsString_1.createArgsString)(filterRevisionArgs));
|
|
5307
5327
|
};
|
|
5308
5328
|
var getDeleteUnusedRevisionsCommands = function (context, keep) {
|
|
5309
|
-
var
|
|
5310
|
-
|
|
5311
|
-
return [];
|
|
5312
|
-
}
|
|
5329
|
+
var _a;
|
|
5330
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5313
5331
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5314
5332
|
// should not happen
|
|
5315
5333
|
throw new Error("deploy config is wrong");
|
|
@@ -5578,7 +5596,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
|
5578
5596
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
5579
5597
|
var customConfig = service !== true ? service : undefined;
|
|
5580
5598
|
var command = service !== true
|
|
5581
|
-
? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.
|
|
5599
|
+
? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.build.config.startCommand
|
|
5582
5600
|
: undefined;
|
|
5583
5601
|
var commandArray = command
|
|
5584
5602
|
? Array.isArray(command)
|
|
@@ -5673,7 +5691,8 @@ var makeLabelString = function (obj) {
|
|
|
5673
5691
|
};
|
|
5674
5692
|
exports.makeLabelString = makeLabelString;
|
|
5675
5693
|
var getCloudRunDeployConfig = function (context) {
|
|
5676
|
-
var
|
|
5694
|
+
var _a;
|
|
5695
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5677
5696
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5678
5697
|
// should not happen
|
|
5679
5698
|
throw new Error("deploy config is wrong");
|
|
@@ -5855,10 +5874,8 @@ var constants_1 = __nccwpck_require__(8865);
|
|
|
5855
5874
|
var getCloudRunDeployScripts_1 = __nccwpck_require__(3695);
|
|
5856
5875
|
var getCloudRunStopScripts_1 = __nccwpck_require__(3747);
|
|
5857
5876
|
var createGoogleCloudRunDeployJobs = function (context) {
|
|
5858
|
-
var
|
|
5859
|
-
|
|
5860
|
-
return [];
|
|
5861
|
-
}
|
|
5877
|
+
var _a;
|
|
5878
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5862
5879
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5863
5880
|
// should not happen
|
|
5864
5881
|
throw new Error("deploy config is wrong");
|
|
@@ -6338,31 +6355,28 @@ var base_1 = __nccwpck_require__(2024);
|
|
|
6338
6355
|
var sbom_1 = __nccwpck_require__(4986);
|
|
6339
6356
|
var types_1 = __nccwpck_require__(5781);
|
|
6340
6357
|
var createCustomDeployJobs = function (context) {
|
|
6341
|
-
var _a, _b, _c;
|
|
6342
|
-
var deployConfig = context.
|
|
6343
|
-
if (deployConfig === false) {
|
|
6344
|
-
return [];
|
|
6345
|
-
}
|
|
6358
|
+
var _a, _b, _c, _d;
|
|
6359
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6346
6360
|
if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
|
|
6347
6361
|
// should not happen
|
|
6348
6362
|
throw new Error("deploy config is not custom");
|
|
6349
6363
|
}
|
|
6350
6364
|
// FIXME: custom deploy currently assumes yarn-based project
|
|
6351
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
6365
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build, {
|
|
6352
6366
|
noCustomPostInstall: true,
|
|
6353
6367
|
});
|
|
6354
6368
|
return (0, base_1.createDeployementJobs)(context, {
|
|
6355
6369
|
deploy: {
|
|
6356
|
-
image: (
|
|
6357
|
-
cache: (
|
|
6370
|
+
image: (_b = deployConfig.jobImage) !== null && _b !== void 0 ? _b : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
6371
|
+
cache: (_c = deployConfig.jobCache) !== null && _c !== void 0 ? _c : [],
|
|
6358
6372
|
script: __spreadArray(__spreadArray(__spreadArray([
|
|
6359
|
-
"cd ".concat(context.
|
|
6373
|
+
"cd ".concat(context.build.dir)
|
|
6360
6374
|
], __read((deployConfig.requiresYarnInstall ? yarnInstall : [])), false), __read(deployConfig.script), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false),
|
|
6361
6375
|
variables: {},
|
|
6362
6376
|
},
|
|
6363
6377
|
stop: deployConfig.stopScript
|
|
6364
6378
|
? {
|
|
6365
|
-
image: (
|
|
6379
|
+
image: (_d = deployConfig.jobImage) !== null && _d !== void 0 ? _d : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
6366
6380
|
script: __spreadArray(__spreadArray([], __read(deployConfig.stopScript), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false),
|
|
6367
6381
|
variables: {},
|
|
6368
6382
|
}
|
|
@@ -6439,17 +6453,15 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
6439
6453
|
var base_1 = __nccwpck_require__(2024);
|
|
6440
6454
|
var types_1 = __nccwpck_require__(5781);
|
|
6441
6455
|
var createDockerTagDeployJobs = function (context) {
|
|
6442
|
-
var
|
|
6443
|
-
|
|
6444
|
-
return [];
|
|
6445
|
-
}
|
|
6456
|
+
var _a;
|
|
6457
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6446
6458
|
if (!(0, types_1.isOfDeployType)(deployConfig, "dockerTag")) {
|
|
6447
6459
|
// should not happen
|
|
6448
6460
|
throw new Error("deploy config is not dockerTag");
|
|
6449
6461
|
}
|
|
6450
6462
|
var tag = deployConfig.tag;
|
|
6451
6463
|
return (0, base_1.createDeployementJobs)(context, {
|
|
6452
|
-
deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)(
|
|
6464
|
+
deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)()), { script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
|
|
6453
6465
|
"docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG",
|
|
6454
6466
|
"docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag),
|
|
6455
6467
|
"docker push $DOCKER_IMAGE:".concat(tag),
|
|
@@ -6561,32 +6573,34 @@ var context_1 = __nccwpck_require__(5875);
|
|
|
6561
6573
|
var utils_1 = __nccwpck_require__(2089);
|
|
6562
6574
|
var types_1 = __nccwpck_require__(5781);
|
|
6563
6575
|
var hasKubernetesCloudSQL = function (context) {
|
|
6564
|
-
var _a, _b;
|
|
6565
|
-
|
|
6566
|
-
|
|
6576
|
+
var _a, _b, _c;
|
|
6577
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6578
|
+
if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
6579
|
+
return (_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql) === null || _c === void 0 ? void 0 : _c.enabled;
|
|
6567
6580
|
}
|
|
6568
6581
|
return false;
|
|
6569
6582
|
};
|
|
6570
6583
|
exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
|
|
6571
6584
|
var createKubernetesCloudsqlBaseValues = function (context) {
|
|
6572
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6573
|
-
|
|
6585
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6586
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6587
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
6574
6588
|
throw new Error("cannot get cloud sql config");
|
|
6575
6589
|
}
|
|
6576
|
-
var config = (
|
|
6590
|
+
var config = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql;
|
|
6577
6591
|
if (!config) {
|
|
6578
6592
|
throw new Error("cannot get cloud sql config");
|
|
6579
6593
|
}
|
|
6580
6594
|
var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
|
|
6581
6595
|
if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
|
|
6582
|
-
var instanceConnectionName = "".concat((
|
|
6596
|
+
var instanceConnectionName = "".concat((_c = config.projectId) !== null && _c !== void 0 ? _c : "skynet-164509", ":").concat((_d = config.region) !== null && _d !== void 0 ? _d : "europe-west6", ":").concat((_e = config.instanceId) !== null && _e !== void 0 ? _e : context.environment.envVars.KUBE_NAMESPACE);
|
|
6583
6597
|
return {
|
|
6584
6598
|
cloudsql: {
|
|
6585
6599
|
enabled: config.enabled,
|
|
6586
6600
|
dbUser: "postgres",
|
|
6587
6601
|
instanceConnectionName: instanceConnectionName,
|
|
6588
6602
|
proxyCredentials: proxyCredentials,
|
|
6589
|
-
fullDbName: (
|
|
6603
|
+
fullDbName: (_f = context.environment.envVars.KUBE_APP_NAME) !== null && _f !== void 0 ? _f : "",
|
|
6590
6604
|
},
|
|
6591
6605
|
};
|
|
6592
6606
|
}
|
|
@@ -6594,7 +6608,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
|
|
|
6594
6608
|
return {
|
|
6595
6609
|
cloudsql: {
|
|
6596
6610
|
enabled: config.enabled,
|
|
6597
|
-
dbUser: (
|
|
6611
|
+
dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
|
|
6598
6612
|
instanceConnectionName: config.instanceConnectionName,
|
|
6599
6613
|
proxyCredentials: proxyCredentials,
|
|
6600
6614
|
fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName),
|
|
@@ -6663,11 +6677,8 @@ var bashYaml_1 = __nccwpck_require__(4660);
|
|
|
6663
6677
|
var gitlab_1 = __nccwpck_require__(8490);
|
|
6664
6678
|
var ALL_VALUES_FILE = "__all_values.yml";
|
|
6665
6679
|
var createKubernetesDeployJobs = function (context) {
|
|
6666
|
-
var _a, _b;
|
|
6667
|
-
var deployConfig = context.
|
|
6668
|
-
if (deployConfig === false) {
|
|
6669
|
-
return [];
|
|
6670
|
-
}
|
|
6680
|
+
var _a, _b, _c;
|
|
6681
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6671
6682
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
6672
6683
|
// should not happen
|
|
6673
6684
|
throw new Error("deploy config is not kubernetes");
|
|
@@ -6681,7 +6692,7 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
6681
6692
|
when: "always",
|
|
6682
6693
|
},
|
|
6683
6694
|
}
|
|
6684
|
-
: {})), { variables: __assign(__assign({}, context.environment.envVars), { RELEASE_NAME: context.environment.fullName, HELM_EXPERIMENTAL_OCI: "1", KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.componentName), HELM_GITLAB_CHART_NAME: (
|
|
6695
|
+
: {})), { variables: __assign(__assign({}, context.environment.envVars), { RELEASE_NAME: context.environment.fullName, HELM_EXPERIMENTAL_OCI: "1", KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.componentName), HELM_GITLAB_CHART_NAME: (_b = deployConfig.chartName) !== null && _b !== void 0 ? _b : "/helm-charts/the-panter-chart", HELM_ARGS: __spreadArray(__spreadArray([], __read((deployConfig.debug ? ["--debug"] : [])), false), __read(((_c = deployConfig.additionalHelmArgs) !== null && _c !== void 0 ? _c : [])), false).join(" "), COMPONENT_NAME: context.componentName,
|
|
6685
6696
|
/** @deprecated */
|
|
6686
6697
|
BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID }) });
|
|
6687
6698
|
var clusterName = "kube-".concat(context.environment.fullName);
|
|
@@ -6847,7 +6858,8 @@ var shouldGoIntoSecrets = function (key, value) {
|
|
|
6847
6858
|
* we evalulate the actual values later, but want to store the secrets in kubernetes secrets
|
|
6848
6859
|
*/
|
|
6849
6860
|
var createKubeEnv = function (context) {
|
|
6850
|
-
|
|
6861
|
+
var _a;
|
|
6862
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
6851
6863
|
// should not happen
|
|
6852
6864
|
throw new Error("deploy config is not kubernetes");
|
|
6853
6865
|
}
|
|
@@ -6933,7 +6945,7 @@ var createAppConfig = function (context, application) {
|
|
|
6933
6945
|
var _a = application !== null && application !== void 0 ? application : {}, healthRoute = _a.healthRoute, command = _a.command, rest = __rest(_a, ["healthRoute", "command"]);
|
|
6934
6946
|
return (0, utils_1.mergeWithMergingArrays)({
|
|
6935
6947
|
host: context.environment.host,
|
|
6936
|
-
command: command !== null && command !== void 0 ? command : context.
|
|
6948
|
+
command: command !== null && command !== void 0 ? command : context.build.config.startCommand,
|
|
6937
6949
|
livenessProbe: {
|
|
6938
6950
|
httpGet: {
|
|
6939
6951
|
path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health",
|
|
@@ -6961,9 +6973,9 @@ var removeFalsy = function (record) {
|
|
|
6961
6973
|
}));
|
|
6962
6974
|
};
|
|
6963
6975
|
var createKubeValues = function (context) {
|
|
6964
|
-
var _a, _b;
|
|
6965
|
-
var deployConfig = context.
|
|
6966
|
-
if (deployConfig
|
|
6976
|
+
var _a, _b, _c;
|
|
6977
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6978
|
+
if (!deployConfig) {
|
|
6967
6979
|
return [];
|
|
6968
6980
|
}
|
|
6969
6981
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
@@ -6973,14 +6985,14 @@ var createKubeValues = function (context) {
|
|
|
6973
6985
|
var values = deployConfig.values;
|
|
6974
6986
|
// we remove the application config because it can be just the value `false` which is a convenience feature, but not supported in the helm chart
|
|
6975
6987
|
// we only merge the rest of the values in
|
|
6976
|
-
var
|
|
6988
|
+
var _d = values !== null && values !== void 0 ? values : {}, application = _d.application, jobs = _d.jobs, cronjobs = _d.cronjobs, rest = __rest(_d, ["application", "jobs", "cronjobs"]);
|
|
6977
6989
|
var env = (0, kubeEnv_1.createKubeEnv)(context);
|
|
6978
6990
|
var defaultKubeValues = (0, lodash_1.merge)({
|
|
6979
6991
|
env: env,
|
|
6980
6992
|
application: createAppConfig(context, application),
|
|
6981
6993
|
}, (0, cloudSql_1.hasKubernetesCloudSQL)(context)
|
|
6982
6994
|
? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context)
|
|
6983
|
-
: {}, ((
|
|
6995
|
+
: {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled)
|
|
6984
6996
|
? (0, mongodb_1.createMongodbBaseConfig)(context)
|
|
6985
6997
|
: {});
|
|
6986
6998
|
var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({ jobs: removeFalsy(jobs), cronjobs: removeFalsy(cronjobs) }, rest)));
|
|
@@ -7028,15 +7040,15 @@ var getMongodbReplicasetHost = function (context, index) {
|
|
|
7028
7040
|
return getMongodbHost(context, "".concat(fullAppname, "-mongodb-").concat(index, ".").concat(fullAppname, "-mongodb-headless"));
|
|
7029
7041
|
};
|
|
7030
7042
|
var createMongodbUrl = function (context, dbName) {
|
|
7031
|
-
var _a, _b;
|
|
7032
|
-
if (!(0, types_1.isOfDeployType)(context.
|
|
7043
|
+
var _a, _b, _c, _d;
|
|
7044
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
7033
7045
|
throw new Error("can only createMongodbUrl on supported deploys");
|
|
7034
7046
|
}
|
|
7035
|
-
var mongodbConfig = (
|
|
7047
|
+
var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
|
|
7036
7048
|
var queryParams = undefined;
|
|
7037
7049
|
var hosts = "";
|
|
7038
7050
|
if ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset") {
|
|
7039
|
-
hosts = (0, lodash_1.range)(0, (
|
|
7051
|
+
hosts = (0, lodash_1.range)(0, (_d = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.replicaCount) !== null && _d !== void 0 ? _d : 2)
|
|
7040
7052
|
.map(function (i) { return getMongodbReplicasetHost(context, i); })
|
|
7041
7053
|
.join(",");
|
|
7042
7054
|
queryParams = "replicaSet=rs0&authSource=admin";
|
|
@@ -7048,11 +7060,11 @@ var createMongodbUrl = function (context, dbName) {
|
|
|
7048
7060
|
return "mongodb://".concat(getCredentialString(context)).concat(hosts, "/").concat(dbName).concat(queryParams ? "?".concat(queryParams) : "");
|
|
7049
7061
|
};
|
|
7050
7062
|
var createMongoBackupDefaultConfig = function (context) {
|
|
7051
|
-
var _a;
|
|
7052
|
-
if (!(0, types_1.isOfDeployType)(context.
|
|
7063
|
+
var _a, _b, _c;
|
|
7064
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
7053
7065
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
7054
7066
|
}
|
|
7055
|
-
var mongodbConfig = (
|
|
7067
|
+
var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
|
|
7056
7068
|
var fullAppName = context.environment.envVars.KUBE_APP_NAME;
|
|
7057
7069
|
var backupEnabled = ["prod", "stage"].includes(context.environment.envType);
|
|
7058
7070
|
var hostToBackup;
|
|
@@ -7082,11 +7094,11 @@ var createMongoBackupDefaultConfig = function (context) {
|
|
|
7082
7094
|
};
|
|
7083
7095
|
};
|
|
7084
7096
|
var createMongodbBaseConfig = function (context) {
|
|
7085
|
-
var _a, _b;
|
|
7086
|
-
if (!(0, types_1.isOfDeployType)(context.
|
|
7097
|
+
var _a, _b, _c, _d;
|
|
7098
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
7087
7099
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
7088
7100
|
}
|
|
7089
|
-
var mongodbConfig = (
|
|
7101
|
+
var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
|
|
7090
7102
|
return {
|
|
7091
7103
|
mongodb: {
|
|
7092
7104
|
enabled: true,
|
|
@@ -7101,7 +7113,7 @@ var createMongodbBaseConfig = function (context) {
|
|
|
7101
7113
|
backup: createMongoBackupDefaultConfig(context),
|
|
7102
7114
|
},
|
|
7103
7115
|
env: {
|
|
7104
|
-
secret: __assign({ MONGO_URL: createMongodbUrl(context, (
|
|
7116
|
+
secret: __assign({ MONGO_URL: createMongodbUrl(context, (_d = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.dbName) !== null && _d !== void 0 ? _d : "app") }, ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset"
|
|
7105
7117
|
? { MONGO_OPLOG_URL: createMongodbUrl(context, "local") } // oplog only works with replicasets
|
|
7106
7118
|
: {})),
|
|
7107
7119
|
},
|
|
@@ -7157,8 +7169,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
7157
7169
|
exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
|
|
7158
7170
|
var sbom_1 = __nccwpck_require__(7038);
|
|
7159
7171
|
var sbomDeactivated = function (context) {
|
|
7160
|
-
return context.
|
|
7161
|
-
context.componentConfig.build.sbom === false;
|
|
7172
|
+
return context.build.config.type === "custom" && context.build.config.sbom === false;
|
|
7162
7173
|
};
|
|
7163
7174
|
exports.sbomDeactivated = sbomDeactivated;
|
|
7164
7175
|
var getDependencyTrackUploadScript = function (context) {
|
|
@@ -7243,7 +7254,7 @@ var isOfDeployType = function (t) {
|
|
|
7243
7254
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7244
7255
|
types[_i - 1] = arguments[_i];
|
|
7245
7256
|
}
|
|
7246
|
-
return t && types.includes(t.type);
|
|
7257
|
+
return t && types.includes(t.type) ? true : false;
|
|
7247
7258
|
};
|
|
7248
7259
|
exports.isOfDeployType = isOfDeployType;
|
|
7249
7260
|
//# sourceMappingURL=index.js.map
|
|
@@ -7279,7 +7290,8 @@ var getKubernetesNamespace = function (config, env) {
|
|
|
7279
7290
|
};
|
|
7280
7291
|
exports.getKubernetesNamespace = getKubernetesNamespace;
|
|
7281
7292
|
var contextIsStoppable = function (context) {
|
|
7282
|
-
var
|
|
7293
|
+
var _a;
|
|
7294
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
7283
7295
|
if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
7284
7296
|
return true;
|
|
7285
7297
|
}
|
|
@@ -7615,7 +7627,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7615
7627
|
};
|
|
7616
7628
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7617
7629
|
exports.createJobsForComponent = void 0;
|
|
7618
|
-
var lodash_1 = __nccwpck_require__(3255);
|
|
7619
7630
|
var build_1 = __nccwpck_require__(7862);
|
|
7620
7631
|
var context_1 = __nccwpck_require__(5875);
|
|
7621
7632
|
var deploy_1 = __nccwpck_require__(8483);
|
|
@@ -7628,18 +7639,17 @@ var injectDefaultVarsInCustomJobs = function (context, jobs) {
|
|
|
7628
7639
|
});
|
|
7629
7640
|
};
|
|
7630
7641
|
var getCustomJobs = function (context) {
|
|
7631
|
-
if (!context.
|
|
7642
|
+
if (!context.customJobs) {
|
|
7632
7643
|
return [];
|
|
7633
7644
|
}
|
|
7634
|
-
var rawJobs =
|
|
7635
|
-
? context.componentConfig.customJobs(context)
|
|
7636
|
-
: context.componentConfig.customJobs;
|
|
7645
|
+
var rawJobs = context.customJobs;
|
|
7637
7646
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
7638
7647
|
};
|
|
7639
7648
|
var createRawJobs = function (context) {
|
|
7640
|
-
var
|
|
7641
|
-
var
|
|
7642
|
-
|
|
7649
|
+
var _a, _b;
|
|
7650
|
+
var buildJobs = build_1.BUILD_TYPES[context.build.config.type].jobs(context);
|
|
7651
|
+
var deployJobs = ((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config)
|
|
7652
|
+
? deploy_1.DEPLOY_TYPES[(_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.type].jobs(context)
|
|
7643
7653
|
: [];
|
|
7644
7654
|
var customJobs = getCustomJobs(context);
|
|
7645
7655
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|