@catladder/cli 0.0.0-refactor-docker-c24f8608 → 0.0.0-refactor-docker-45f6e733
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;
|
|
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
|
|
@@ -2808,11 +2813,11 @@ var getDockerAdditions = function (build) {
|
|
|
2808
2813
|
};
|
|
2809
2814
|
};
|
|
2810
2815
|
var getDockerBuildVariables = function (context) {
|
|
2811
|
-
return __assign(__assign(__assign({}, getDockerAdditions(context.
|
|
2816
|
+
return __assign(__assign(__assign({}, getDockerAdditions(context.build.config)), { APP_DIR: context.build.dir, DOCKER_DIR: "." }), (0, exports.getDockerImageVariables)(context));
|
|
2812
2817
|
};
|
|
2813
2818
|
exports.getDockerBuildVariables = getDockerBuildVariables;
|
|
2814
2819
|
exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
|
|
2815
|
-
var getDockerJobBaseProps = function (
|
|
2820
|
+
var getDockerJobBaseProps = function () {
|
|
2816
2821
|
return {
|
|
2817
2822
|
image: (0, runner_1.getRunnerImage)("docker-build"),
|
|
2818
2823
|
services: [
|
|
@@ -2828,14 +2833,14 @@ var getDockerJobBaseProps = function (context) {
|
|
|
2828
2833
|
exports.getDockerJobBaseProps = getDockerJobBaseProps;
|
|
2829
2834
|
var createDockerBuildJobBase = function (context, _a) {
|
|
2830
2835
|
var script = _a.script, def = __rest(_a, ["script"]);
|
|
2831
|
-
return (0, lodash_1.merge)(__assign(__assign({ name: exports.DOCKER_BUILD_JOB_NAME, envMode: "jobPerEnv", stage: "build" }, (0, exports.getDockerJobBaseProps)(
|
|
2836
|
+
return (0, lodash_1.merge)(__assign(__assign({ name: exports.DOCKER_BUILD_JOB_NAME, envMode: "jobPerEnv", stage: "build" }, (0, exports.getDockerJobBaseProps)()), { script: script || [] }), {
|
|
2832
2837
|
variables: (0, exports.getDockerBuildVariables)(context),
|
|
2833
2838
|
runnerVariables: __assign(__assign({}, DOCKER_BUILD_RUNNER_REQUESTS), getDockerBuildRunnerVariables()),
|
|
2834
2839
|
}, def);
|
|
2835
2840
|
};
|
|
2836
2841
|
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
2837
2842
|
var gitlabDockerLogin = function (context) {
|
|
2838
|
-
return (0, deploy_1.isOfDeployType)(context.
|
|
2843
|
+
return context.deploy && (0, deploy_1.isOfDeployType)(context.deploy.config, "google-cloudrun")
|
|
2839
2844
|
? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [
|
|
2840
2845
|
"gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context)),
|
|
2841
2846
|
], false) : [
|
|
@@ -2872,7 +2877,7 @@ var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
|
2872
2877
|
};
|
|
2873
2878
|
exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
|
|
2874
2879
|
var hasDockerfile = function (context) {
|
|
2875
|
-
return (0, fs_1.existsSync)(path_1.default.join(context.
|
|
2880
|
+
return (0, fs_1.existsSync)(path_1.default.join(context.build.dir, "Dockerfile"));
|
|
2876
2881
|
};
|
|
2877
2882
|
exports.hasDockerfile = hasDockerfile;
|
|
2878
2883
|
//# sourceMappingURL=docker.js.map
|
|
@@ -2993,23 +2998,23 @@ var constants_1 = __nccwpck_require__(1765);
|
|
|
2993
2998
|
var yarn_1 = __nccwpck_require__(5043);
|
|
2994
2999
|
var createNodeBuildJobs = function (context) {
|
|
2995
3000
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2996
|
-
var buildConfig = context.
|
|
3001
|
+
var buildConfig = context.build.config;
|
|
2997
3002
|
if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
|
|
2998
3003
|
throw new Error("deploy config is not node, node-static or storybook");
|
|
2999
3004
|
}
|
|
3000
3005
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
3001
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
3006
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
3002
3007
|
return (0, base_1.createBuildJobs)(context, {
|
|
3003
3008
|
appBuild: buildConfig.buildCommand !== null
|
|
3004
3009
|
? {
|
|
3005
3010
|
image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
|
|
3006
3011
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
3007
|
-
cache: __spreadArray(__spreadArray(__spreadArray([], __read(((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : [])), false), __read((0, cache_1.getNodeCache)(context.
|
|
3012
|
+
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),
|
|
3008
3013
|
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
|
|
3009
3014
|
artifacts: {
|
|
3010
3015
|
paths: __spreadArray([
|
|
3011
|
-
context.
|
|
3012
|
-
], __read(((_e = (_d = context.
|
|
3016
|
+
context.build.dir
|
|
3017
|
+
], __read(((_e = (_d = context.build.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : [])), false).flatMap(function (dir) {
|
|
3013
3018
|
var _a, _b;
|
|
3014
3019
|
return __spreadArray([
|
|
3015
3020
|
(0, path_1.join)(dir, "__build_info.json"),
|
|
@@ -3029,11 +3034,11 @@ var createNodeBuildJobs = function (context) {
|
|
|
3029
3034
|
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
|
|
3030
3035
|
? "nginx"
|
|
3031
3036
|
: "node"),
|
|
3032
|
-
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.
|
|
3037
|
+
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.build, "pull")), false),
|
|
3033
3038
|
variables: {
|
|
3034
3039
|
// only required for non static
|
|
3035
|
-
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.
|
|
3036
|
-
DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.
|
|
3040
|
+
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.build),
|
|
3041
|
+
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"),
|
|
3037
3042
|
},
|
|
3038
3043
|
},
|
|
3039
3044
|
});
|
|
@@ -3133,7 +3138,7 @@ var getNextCache = function (context) { return [
|
|
|
3133
3138
|
{
|
|
3134
3139
|
key: context.componentName + "-next-cache",
|
|
3135
3140
|
policy: "pull-push",
|
|
3136
|
-
paths: [context.
|
|
3141
|
+
paths: [context.build.dir + "/.next/cache/"],
|
|
3137
3142
|
},
|
|
3138
3143
|
]; };
|
|
3139
3144
|
exports.getNextCache = getNextCache;
|
|
@@ -3252,23 +3257,23 @@ var getMeteorCache = function (context) { return [
|
|
|
3252
3257
|
key: context.componentName + "meteor-build-cache",
|
|
3253
3258
|
policy: "pull-push",
|
|
3254
3259
|
paths: [
|
|
3255
|
-
(0, path_1.join)(context.
|
|
3256
|
-
(0, path_1.join)(context.
|
|
3257
|
-
(0, path_1.join)(context.
|
|
3258
|
-
(0, path_1.join)(context.
|
|
3260
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"),
|
|
3261
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/plugin-cache"),
|
|
3262
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/isopacks"),
|
|
3263
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/bundler-cache/scanner"),
|
|
3259
3264
|
],
|
|
3260
3265
|
},
|
|
3261
3266
|
]; };
|
|
3262
3267
|
var createMeteorBuildJobs = function (context) {
|
|
3263
|
-
var buildConfig = context.
|
|
3268
|
+
var buildConfig = context.build.config;
|
|
3264
3269
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
3265
3270
|
throw new Error("deploy config is not meteor");
|
|
3266
3271
|
}
|
|
3267
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
3272
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
3268
3273
|
return (0, base_1.createBuildJobs)(context, {
|
|
3269
3274
|
appBuild: buildConfig.buildCommand !== null
|
|
3270
3275
|
? {
|
|
3271
|
-
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.
|
|
3276
|
+
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.build)), false), __read(getMeteorCache(context)), false),
|
|
3272
3277
|
image: (0, runner_1.getRunnerImage)("jobs-meteor"),
|
|
3273
3278
|
variables: {
|
|
3274
3279
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1", // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
@@ -3282,8 +3287,8 @@ var createMeteorBuildJobs = function (context) {
|
|
|
3282
3287
|
], false),
|
|
3283
3288
|
artifacts: {
|
|
3284
3289
|
paths: [
|
|
3285
|
-
context.
|
|
3286
|
-
context.
|
|
3290
|
+
context.build.dir + "/__build_info.json",
|
|
3291
|
+
context.build.dir + "/dist",
|
|
3287
3292
|
],
|
|
3288
3293
|
},
|
|
3289
3294
|
}
|
|
@@ -3357,32 +3362,32 @@ var createNodeTestJobs = function (context) {
|
|
|
3357
3362
|
if (context.trigger === "taggedRelease") {
|
|
3358
3363
|
return [];
|
|
3359
3364
|
}
|
|
3360
|
-
var buildConfig = context.
|
|
3365
|
+
var buildConfig = context.build.config;
|
|
3361
3366
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
3362
3367
|
var base = {
|
|
3363
|
-
variables: __assign(__assign({ APP_PATH: context.
|
|
3368
|
+
variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
|
|
3364
3369
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
3365
3370
|
stage: "test",
|
|
3366
3371
|
needs: [],
|
|
3367
3372
|
envMode: "none",
|
|
3368
3373
|
};
|
|
3369
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
3374
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
3370
3375
|
var auditJob = buildConfig.audit !== false
|
|
3371
3376
|
? __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([
|
|
3372
|
-
"cd ".concat(context.
|
|
3377
|
+
"cd ".concat(context.build.dir)
|
|
3373
3378
|
], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
|
|
3374
|
-
((_f = context.
|
|
3379
|
+
((_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic)
|
|
3375
3380
|
? "yarn audit"
|
|
3376
3381
|
: "yarn npm audit --environment production", // yarn 2
|
|
3377
|
-
])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
3382
|
+
])), 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;
|
|
3378
3383
|
var lintJob = buildConfig.lint !== false
|
|
3379
|
-
? __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.
|
|
3380
|
-
"cd ".concat(context.
|
|
3381
|
-
], 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.
|
|
3384
|
+
? __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), [
|
|
3385
|
+
"cd ".concat(context.build.dir)
|
|
3386
|
+
], 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;
|
|
3382
3387
|
var testJob = buildConfig.test !== false
|
|
3383
|
-
? __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.
|
|
3384
|
-
"cd ".concat(context.
|
|
3385
|
-
], 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.
|
|
3388
|
+
? __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), [
|
|
3389
|
+
"cd ".concat(context.build.dir)
|
|
3390
|
+
], 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;
|
|
3386
3391
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
3387
3392
|
};
|
|
3388
3393
|
exports.createNodeTestJobs = createNodeTestJobs;
|
|
@@ -3519,7 +3524,7 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
3519
3524
|
var types_1 = __nccwpck_require__(4466);
|
|
3520
3525
|
var createRailsBuildJobs = function (context) {
|
|
3521
3526
|
var _a, _b, _c;
|
|
3522
|
-
var buildConfig = context.
|
|
3527
|
+
var buildConfig = context.build.config;
|
|
3523
3528
|
if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
|
|
3524
3529
|
// should not happen
|
|
3525
3530
|
throw new Error("build type is not rails");
|
|
@@ -3543,10 +3548,10 @@ var createRailsBuildJobs = function (context) {
|
|
|
3543
3548
|
return (0, base_1.createBuildJobs)(context, {
|
|
3544
3549
|
appBuild: undefined,
|
|
3545
3550
|
dockerBuild: {
|
|
3546
|
-
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.
|
|
3551
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
|
|
3547
3552
|
// custom script
|
|
3548
3553
|
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
|
|
3549
|
-
"cd ".concat(context.
|
|
3554
|
+
"cd ".concat(context.build.dir),
|
|
3550
3555
|
"docker pull $DOCKER_CACHE_IMAGE || true",
|
|
3551
3556
|
"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"),
|
|
3552
3557
|
"chmod +x /usr/local/bin/pack",
|
|
@@ -3655,7 +3660,7 @@ var createRailsTestJobs = function (context) {
|
|
|
3655
3660
|
if (context.trigger === "taggedRelease") {
|
|
3656
3661
|
return [];
|
|
3657
3662
|
}
|
|
3658
|
-
var buildConfig = context.
|
|
3663
|
+
var buildConfig = context.build.config;
|
|
3659
3664
|
var base = {
|
|
3660
3665
|
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
|
|
3661
3666
|
stage: "test",
|
|
@@ -3677,20 +3682,20 @@ var createRailsTestJobs = function (context) {
|
|
|
3677
3682
|
};
|
|
3678
3683
|
var auditJob = buildConfig.audit !== false
|
|
3679
3684
|
? __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([
|
|
3680
|
-
"cd ".concat(context.
|
|
3685
|
+
"cd ".concat(context.build.dir)
|
|
3681
3686
|
], __read(((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
3682
3687
|
"gem install bundler-audit",
|
|
3683
3688
|
"bundle audit check",
|
|
3684
3689
|
])), false), allow_failure: true }) : null;
|
|
3685
3690
|
var lintJob = buildConfig.lint !== false
|
|
3686
3691
|
? __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([
|
|
3687
|
-
"cd ".concat(context.
|
|
3692
|
+
"cd ".concat(context.build.dir)
|
|
3688
3693
|
], __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 : [
|
|
3689
3694
|
"bundle exec rubocop",
|
|
3690
3695
|
])), false) }) : null;
|
|
3691
3696
|
var testJob = buildConfig.test !== false
|
|
3692
3697
|
? __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([
|
|
3693
|
-
"cd ".concat(context.
|
|
3698
|
+
"cd ".concat(context.build.dir)
|
|
3694
3699
|
], __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 : [
|
|
3695
3700
|
"bundle exec rspec",
|
|
3696
3701
|
])), false) }) : null;
|
|
@@ -3713,12 +3718,12 @@ exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
|
|
|
3713
3718
|
exports.SBOM_FILE = "__sbom.json";
|
|
3714
3719
|
var createSbomBuildJob = function (context) {
|
|
3715
3720
|
var _a, _b, _c, _d, _e;
|
|
3716
|
-
var buildConfig = context.
|
|
3721
|
+
var buildConfig = context.build.config;
|
|
3717
3722
|
var defaultImage = "aquasec/trivy:0.38.3";
|
|
3718
3723
|
var defaultScript = [
|
|
3719
|
-
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.
|
|
3724
|
+
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.build.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace)
|
|
3720
3725
|
? "."
|
|
3721
|
-
: context.
|
|
3726
|
+
: context.build.dir),
|
|
3722
3727
|
];
|
|
3723
3728
|
var image = buildConfig.type === "custom" && buildConfig.sbom !== false
|
|
3724
3729
|
? (_c = (_b = buildConfig.sbom) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage
|
|
@@ -4344,7 +4349,7 @@ var sanitize = function (value) {
|
|
|
4344
4349
|
};
|
|
4345
4350
|
var getLabels = function (context) {
|
|
4346
4351
|
var _a, _b, _c;
|
|
4347
|
-
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.
|
|
4352
|
+
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 : {}));
|
|
4348
4353
|
return labels;
|
|
4349
4354
|
};
|
|
4350
4355
|
exports.getLabels = getLabels;
|
|
@@ -4383,6 +4388,17 @@ exports.getReviewSlug = getReviewSlug;
|
|
|
4383
4388
|
|
|
4384
4389
|
"use strict";
|
|
4385
4390
|
|
|
4391
|
+
var __assign = (this && this.__assign) || function () {
|
|
4392
|
+
__assign = Object.assign || function(t) {
|
|
4393
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4394
|
+
s = arguments[i];
|
|
4395
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
4396
|
+
t[p] = s[p];
|
|
4397
|
+
}
|
|
4398
|
+
return t;
|
|
4399
|
+
};
|
|
4400
|
+
return __assign.apply(this, arguments);
|
|
4401
|
+
};
|
|
4386
4402
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4387
4403
|
if (k2 === undefined) k2 = k;
|
|
4388
4404
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -4435,6 +4451,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
4435
4451
|
};
|
|
4436
4452
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4437
4453
|
exports.createContext = exports.createComponentContext = void 0;
|
|
4454
|
+
var lodash_1 = __nccwpck_require__(3255);
|
|
4438
4455
|
var build_1 = __nccwpck_require__(7862);
|
|
4439
4456
|
var deploy_1 = __nccwpck_require__(8483);
|
|
4440
4457
|
var utils_1 = __nccwpck_require__(2497);
|
|
@@ -4443,10 +4460,9 @@ var getEnvironmentContext_1 = __nccwpck_require__(3663);
|
|
|
4443
4460
|
__exportStar(__nccwpck_require__(5699), exports);
|
|
4444
4461
|
__exportStar(__nccwpck_require__(5133), exports);
|
|
4445
4462
|
var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4446
|
-
var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
switch (_b.label) {
|
|
4463
|
+
var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
4464
|
+
return __generator(this, function (_a) {
|
|
4465
|
+
switch (_a.label) {
|
|
4450
4466
|
case 0:
|
|
4451
4467
|
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
4452
4468
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
@@ -4463,22 +4479,33 @@ var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, v
|
|
|
4463
4479
|
deploy: {},
|
|
4464
4480
|
};
|
|
4465
4481
|
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
4466
|
-
|
|
4482
|
+
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
|
|
4483
|
+
case 1:
|
|
4484
|
+
environment = _a.sent();
|
|
4485
|
+
deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
|
|
4486
|
+
context = {
|
|
4467
4487
|
fullConfig: ctx.config,
|
|
4468
4488
|
componentConfig: componentConfig,
|
|
4469
|
-
|
|
4470
|
-
dir:
|
|
4489
|
+
build: {
|
|
4490
|
+
dir: dir,
|
|
4471
4491
|
packageManagerInfo: ctx.packageManagerInfo,
|
|
4472
|
-
config:
|
|
4492
|
+
config: build,
|
|
4473
4493
|
},
|
|
4474
|
-
|
|
4494
|
+
deploy: deploy
|
|
4495
|
+
? {
|
|
4496
|
+
config: deploy,
|
|
4497
|
+
}
|
|
4498
|
+
: null,
|
|
4499
|
+
componentName: ctx.componentName,
|
|
4500
|
+
environment: environment,
|
|
4501
|
+
packageManagerInfo: ctx.packageManagerInfo,
|
|
4502
|
+
pipelineType: ctx.pipelineType,
|
|
4503
|
+
trigger: ctx.trigger,
|
|
4475
4504
|
};
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
_a.trigger = ctx.trigger,
|
|
4481
|
-
_a)];
|
|
4505
|
+
resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs)
|
|
4506
|
+
? customJobs(context)
|
|
4507
|
+
: customJobs;
|
|
4508
|
+
return [2 /*return*/, __assign(__assign({}, context), { customJobs: resolvedCustomJobs })];
|
|
4482
4509
|
}
|
|
4483
4510
|
});
|
|
4484
4511
|
}); };
|
|
@@ -4893,7 +4920,7 @@ var stop_1 = __nccwpck_require__(2846);
|
|
|
4893
4920
|
var variables_1 = __nccwpck_require__(2422);
|
|
4894
4921
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
4895
4922
|
var createDeployJob = function (context, jobDefinition) {
|
|
4896
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4923
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4897
4924
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
4898
4925
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
4899
4926
|
var autoStop = context.environment.envType === "review"
|
|
@@ -4901,14 +4928,13 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
4901
4928
|
: context.environment.envType === "dev"
|
|
4902
4929
|
? "4 weeks"
|
|
4903
4930
|
: undefined;
|
|
4931
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
4904
4932
|
// if auto or manual is configured explicitly, use that
|
|
4905
|
-
var whenDeployDefined =
|
|
4906
|
-
? context.componentConfig.deploy.when
|
|
4907
|
-
: undefined;
|
|
4933
|
+
var whenDeployDefined = deployConfig && deployConfig.when ? deployConfig.when : undefined;
|
|
4908
4934
|
// otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
|
|
4909
4935
|
var whenDeployDefault = context.environment.envType !== "prod"
|
|
4910
4936
|
? "auto" // is not stage, auto deploy
|
|
4911
|
-
: ((
|
|
4937
|
+
: ((_b = context.componentConfig.env) === null || _b === void 0 ? void 0 : _b.stage) === false
|
|
4912
4938
|
? "auto" // is prod, but no staging, auto deploy
|
|
4913
4939
|
: "manual"; // manually deploy
|
|
4914
4940
|
var whenDeploy = whenDeployDefined ? whenDeployDefined : whenDeployDefault;
|
|
@@ -4922,12 +4948,12 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
4922
4948
|
envMode: "stagePerEnv", // makes it easier to run manual tasks er env
|
|
4923
4949
|
needs: __spreadArray(__spreadArray([], __read(((0, sbom_2.sbomDeactivated)(context)
|
|
4924
4950
|
? []
|
|
4925
|
-
: [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((
|
|
4926
|
-
? (
|
|
4951
|
+
: [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((deployConfig
|
|
4952
|
+
? (_d = (_c = deployConfig.waitFor) === null || _c === void 0 ? void 0 : _c.map(function (c) { return ({
|
|
4927
4953
|
componentName: c,
|
|
4928
4954
|
job: exports.DEPLOY_JOB_NAME,
|
|
4929
4955
|
artifacts: false,
|
|
4930
|
-
}); })) !== null &&
|
|
4956
|
+
}); })) !== null && _d !== void 0 ? _d : []
|
|
4931
4957
|
: [])), false),
|
|
4932
4958
|
// we don't want to deploy when there is a broken test
|
|
4933
4959
|
needsStages: [
|
|
@@ -4943,21 +4969,15 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
4943
4969
|
when: whenDeploy === "auto" ? "on_success" : "manual",
|
|
4944
4970
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
4945
4971
|
stage: "deploy",
|
|
4946
|
-
variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), (hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {})), context.environment.jobOnlyVars.deploy.envVars), (
|
|
4947
|
-
|
|
4948
|
-
: {})), jobDefinition.variables),
|
|
4949
|
-
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), ((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {})), (context.componentConfig.deploy
|
|
4950
|
-
? (_f = context.componentConfig.deploy.runnerVariables) !== null && _f !== void 0 ? _f : {}
|
|
4951
|
-
: {})),
|
|
4972
|
+
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),
|
|
4973
|
+
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 : {} : {})),
|
|
4952
4974
|
environment: isStoppable
|
|
4953
4975
|
? {
|
|
4954
4976
|
on_stop: stop_1.STOP_JOB_NAME,
|
|
4955
4977
|
auto_stop_in: autoStop,
|
|
4956
4978
|
}
|
|
4957
4979
|
: undefined,
|
|
4958
|
-
jobTags:
|
|
4959
|
-
? context.componentConfig.deploy.jobTags
|
|
4960
|
-
: undefined,
|
|
4980
|
+
jobTags: deployConfig ? deployConfig.jobTags : undefined,
|
|
4961
4981
|
};
|
|
4962
4982
|
};
|
|
4963
4983
|
exports.createDeployJob = createDeployJob;
|
|
@@ -5155,17 +5175,18 @@ var BashExpression_1 = __nccwpck_require__(2376);
|
|
|
5155
5175
|
var gitlab_1 = __nccwpck_require__(8490);
|
|
5156
5176
|
var types_1 = __nccwpck_require__(5781);
|
|
5157
5177
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(4398);
|
|
5158
|
-
var getArtifactsRegistryHost = function (
|
|
5159
|
-
var
|
|
5160
|
-
if (!(0, types_1.isOfDeployType)(deploy, "google-cloudrun")) {
|
|
5178
|
+
var getArtifactsRegistryHost = function (context) {
|
|
5179
|
+
var _a;
|
|
5180
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun")) {
|
|
5161
5181
|
// should not happen
|
|
5162
5182
|
throw new Error("deploy config is wrong");
|
|
5163
5183
|
}
|
|
5164
|
-
return "".concat(deploy.region, "-docker.pkg.dev");
|
|
5184
|
+
return "".concat(context.deploy.config.region, "-docker.pkg.dev");
|
|
5165
5185
|
};
|
|
5166
5186
|
exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
|
|
5167
5187
|
var getArtifactsRegistryDockerUrl = function (context) {
|
|
5168
|
-
var
|
|
5188
|
+
var _a;
|
|
5189
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5169
5190
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5170
5191
|
// should not happen
|
|
5171
5192
|
throw new Error("deploy config is wrong");
|
|
@@ -5228,11 +5249,9 @@ var getDeleteImageCommands = function (fullImageName, keepNewest) {
|
|
|
5228
5249
|
* @returns
|
|
5229
5250
|
*/
|
|
5230
5251
|
var getDeleteUnusedImagesCommands = function (context, keep) {
|
|
5252
|
+
var _a;
|
|
5231
5253
|
if (keep === void 0) { keep = 0; }
|
|
5232
|
-
var deployConfig = context.
|
|
5233
|
-
if (deployConfig === false) {
|
|
5234
|
-
return [];
|
|
5235
|
-
}
|
|
5254
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5236
5255
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5237
5256
|
// should not happen
|
|
5238
5257
|
throw new Error("deploy config is wrong");
|
|
@@ -5323,8 +5342,9 @@ var createArgsString_1 = __nccwpck_require__(9598);
|
|
|
5323
5342
|
var getServiceName_1 = __nccwpck_require__(8128);
|
|
5324
5343
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(4398);
|
|
5325
5344
|
var getListRevisionsCommand = function (context, args) {
|
|
5345
|
+
var _a;
|
|
5326
5346
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
5327
|
-
var deployConfig = context.
|
|
5347
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5328
5348
|
if (!deployConfig || !(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5329
5349
|
// should not happen
|
|
5330
5350
|
throw new Error("deploy config is wrong");
|
|
@@ -5336,10 +5356,8 @@ var getListRevisionsCommand = function (context, args) {
|
|
|
5336
5356
|
return "gcloud run revisions list ".concat((0, createArgsString_1.createArgsString)(filterRevisionArgs));
|
|
5337
5357
|
};
|
|
5338
5358
|
var getDeleteUnusedRevisionsCommands = function (context, keep) {
|
|
5339
|
-
var
|
|
5340
|
-
|
|
5341
|
-
return [];
|
|
5342
|
-
}
|
|
5359
|
+
var _a;
|
|
5360
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5343
5361
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5344
5362
|
// should not happen
|
|
5345
5363
|
throw new Error("deploy config is wrong");
|
|
@@ -5608,7 +5626,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
|
5608
5626
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
5609
5627
|
var customConfig = service !== true ? service : undefined;
|
|
5610
5628
|
var command = service !== true
|
|
5611
|
-
? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.
|
|
5629
|
+
? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.build.config.startCommand
|
|
5612
5630
|
: undefined;
|
|
5613
5631
|
var commandArray = command
|
|
5614
5632
|
? Array.isArray(command)
|
|
@@ -5703,7 +5721,8 @@ var makeLabelString = function (obj) {
|
|
|
5703
5721
|
};
|
|
5704
5722
|
exports.makeLabelString = makeLabelString;
|
|
5705
5723
|
var getCloudRunDeployConfig = function (context) {
|
|
5706
|
-
var
|
|
5724
|
+
var _a;
|
|
5725
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5707
5726
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5708
5727
|
// should not happen
|
|
5709
5728
|
throw new Error("deploy config is wrong");
|
|
@@ -5885,10 +5904,8 @@ var constants_1 = __nccwpck_require__(8865);
|
|
|
5885
5904
|
var getCloudRunDeployScripts_1 = __nccwpck_require__(3695);
|
|
5886
5905
|
var getCloudRunStopScripts_1 = __nccwpck_require__(3747);
|
|
5887
5906
|
var createGoogleCloudRunDeployJobs = function (context) {
|
|
5888
|
-
var
|
|
5889
|
-
|
|
5890
|
-
return [];
|
|
5891
|
-
}
|
|
5907
|
+
var _a;
|
|
5908
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5892
5909
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5893
5910
|
// should not happen
|
|
5894
5911
|
throw new Error("deploy config is wrong");
|
|
@@ -6368,31 +6385,28 @@ var base_1 = __nccwpck_require__(2024);
|
|
|
6368
6385
|
var sbom_1 = __nccwpck_require__(4986);
|
|
6369
6386
|
var types_1 = __nccwpck_require__(5781);
|
|
6370
6387
|
var createCustomDeployJobs = function (context) {
|
|
6371
|
-
var _a, _b, _c;
|
|
6372
|
-
var deployConfig = context.
|
|
6373
|
-
if (deployConfig === false) {
|
|
6374
|
-
return [];
|
|
6375
|
-
}
|
|
6388
|
+
var _a, _b, _c, _d;
|
|
6389
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6376
6390
|
if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
|
|
6377
6391
|
// should not happen
|
|
6378
6392
|
throw new Error("deploy config is not custom");
|
|
6379
6393
|
}
|
|
6380
6394
|
// FIXME: custom deploy currently assumes yarn-based project
|
|
6381
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
6395
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build, {
|
|
6382
6396
|
noCustomPostInstall: true,
|
|
6383
6397
|
});
|
|
6384
6398
|
return (0, base_1.createDeployementJobs)(context, {
|
|
6385
6399
|
deploy: {
|
|
6386
|
-
image: (
|
|
6387
|
-
cache: (
|
|
6400
|
+
image: (_b = deployConfig.jobImage) !== null && _b !== void 0 ? _b : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
6401
|
+
cache: (_c = deployConfig.jobCache) !== null && _c !== void 0 ? _c : [],
|
|
6388
6402
|
script: __spreadArray(__spreadArray(__spreadArray([
|
|
6389
|
-
"cd ".concat(context.
|
|
6403
|
+
"cd ".concat(context.build.dir)
|
|
6390
6404
|
], __read((deployConfig.requiresYarnInstall ? yarnInstall : [])), false), __read(deployConfig.script), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false),
|
|
6391
6405
|
variables: {},
|
|
6392
6406
|
},
|
|
6393
6407
|
stop: deployConfig.stopScript
|
|
6394
6408
|
? {
|
|
6395
|
-
image: (
|
|
6409
|
+
image: (_d = deployConfig.jobImage) !== null && _d !== void 0 ? _d : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
6396
6410
|
script: __spreadArray(__spreadArray([], __read(deployConfig.stopScript), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false),
|
|
6397
6411
|
variables: {},
|
|
6398
6412
|
}
|
|
@@ -6469,17 +6483,15 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
6469
6483
|
var base_1 = __nccwpck_require__(2024);
|
|
6470
6484
|
var types_1 = __nccwpck_require__(5781);
|
|
6471
6485
|
var createDockerTagDeployJobs = function (context) {
|
|
6472
|
-
var
|
|
6473
|
-
|
|
6474
|
-
return [];
|
|
6475
|
-
}
|
|
6486
|
+
var _a;
|
|
6487
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6476
6488
|
if (!(0, types_1.isOfDeployType)(deployConfig, "dockerTag")) {
|
|
6477
6489
|
// should not happen
|
|
6478
6490
|
throw new Error("deploy config is not dockerTag");
|
|
6479
6491
|
}
|
|
6480
6492
|
var tag = deployConfig.tag;
|
|
6481
6493
|
return (0, base_1.createDeployementJobs)(context, {
|
|
6482
|
-
deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)(
|
|
6494
|
+
deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)()), { script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
|
|
6483
6495
|
"docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG",
|
|
6484
6496
|
"docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag),
|
|
6485
6497
|
"docker push $DOCKER_IMAGE:".concat(tag),
|
|
@@ -6591,32 +6603,34 @@ var context_1 = __nccwpck_require__(5875);
|
|
|
6591
6603
|
var utils_1 = __nccwpck_require__(2089);
|
|
6592
6604
|
var types_1 = __nccwpck_require__(5781);
|
|
6593
6605
|
var hasKubernetesCloudSQL = function (context) {
|
|
6594
|
-
var _a, _b;
|
|
6595
|
-
|
|
6596
|
-
|
|
6606
|
+
var _a, _b, _c;
|
|
6607
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6608
|
+
if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
6609
|
+
return (_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql) === null || _c === void 0 ? void 0 : _c.enabled;
|
|
6597
6610
|
}
|
|
6598
6611
|
return false;
|
|
6599
6612
|
};
|
|
6600
6613
|
exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
|
|
6601
6614
|
var createKubernetesCloudsqlBaseValues = function (context) {
|
|
6602
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6603
|
-
|
|
6615
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6616
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6617
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
6604
6618
|
throw new Error("cannot get cloud sql config");
|
|
6605
6619
|
}
|
|
6606
|
-
var config = (
|
|
6620
|
+
var config = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql;
|
|
6607
6621
|
if (!config) {
|
|
6608
6622
|
throw new Error("cannot get cloud sql config");
|
|
6609
6623
|
}
|
|
6610
6624
|
var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
|
|
6611
6625
|
if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
|
|
6612
|
-
var instanceConnectionName = "".concat((
|
|
6626
|
+
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);
|
|
6613
6627
|
return {
|
|
6614
6628
|
cloudsql: {
|
|
6615
6629
|
enabled: config.enabled,
|
|
6616
6630
|
dbUser: "postgres",
|
|
6617
6631
|
instanceConnectionName: instanceConnectionName,
|
|
6618
6632
|
proxyCredentials: proxyCredentials,
|
|
6619
|
-
fullDbName: (
|
|
6633
|
+
fullDbName: (_f = context.environment.envVars.KUBE_APP_NAME) !== null && _f !== void 0 ? _f : "",
|
|
6620
6634
|
},
|
|
6621
6635
|
};
|
|
6622
6636
|
}
|
|
@@ -6624,7 +6638,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
|
|
|
6624
6638
|
return {
|
|
6625
6639
|
cloudsql: {
|
|
6626
6640
|
enabled: config.enabled,
|
|
6627
|
-
dbUser: (
|
|
6641
|
+
dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
|
|
6628
6642
|
instanceConnectionName: config.instanceConnectionName,
|
|
6629
6643
|
proxyCredentials: proxyCredentials,
|
|
6630
6644
|
fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName),
|
|
@@ -6693,11 +6707,8 @@ var bashYaml_1 = __nccwpck_require__(4660);
|
|
|
6693
6707
|
var gitlab_1 = __nccwpck_require__(8490);
|
|
6694
6708
|
var ALL_VALUES_FILE = "__all_values.yml";
|
|
6695
6709
|
var createKubernetesDeployJobs = function (context) {
|
|
6696
|
-
var _a, _b;
|
|
6697
|
-
var deployConfig = context.
|
|
6698
|
-
if (deployConfig === false) {
|
|
6699
|
-
return [];
|
|
6700
|
-
}
|
|
6710
|
+
var _a, _b, _c;
|
|
6711
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6701
6712
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
6702
6713
|
// should not happen
|
|
6703
6714
|
throw new Error("deploy config is not kubernetes");
|
|
@@ -6711,7 +6722,7 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
6711
6722
|
when: "always",
|
|
6712
6723
|
},
|
|
6713
6724
|
}
|
|
6714
|
-
: {})), { 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: (
|
|
6725
|
+
: {})), { 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,
|
|
6715
6726
|
/** @deprecated */
|
|
6716
6727
|
BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID }) });
|
|
6717
6728
|
var clusterName = "kube-".concat(context.environment.fullName);
|
|
@@ -6877,7 +6888,8 @@ var shouldGoIntoSecrets = function (key, value) {
|
|
|
6877
6888
|
* we evalulate the actual values later, but want to store the secrets in kubernetes secrets
|
|
6878
6889
|
*/
|
|
6879
6890
|
var createKubeEnv = function (context) {
|
|
6880
|
-
|
|
6891
|
+
var _a;
|
|
6892
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
6881
6893
|
// should not happen
|
|
6882
6894
|
throw new Error("deploy config is not kubernetes");
|
|
6883
6895
|
}
|
|
@@ -6963,7 +6975,7 @@ var createAppConfig = function (context, application) {
|
|
|
6963
6975
|
var _a = application !== null && application !== void 0 ? application : {}, healthRoute = _a.healthRoute, command = _a.command, rest = __rest(_a, ["healthRoute", "command"]);
|
|
6964
6976
|
return (0, utils_1.mergeWithMergingArrays)({
|
|
6965
6977
|
host: context.environment.host,
|
|
6966
|
-
command: command !== null && command !== void 0 ? command : context.
|
|
6978
|
+
command: command !== null && command !== void 0 ? command : context.build.config.startCommand,
|
|
6967
6979
|
livenessProbe: {
|
|
6968
6980
|
httpGet: {
|
|
6969
6981
|
path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health",
|
|
@@ -6991,9 +7003,9 @@ var removeFalsy = function (record) {
|
|
|
6991
7003
|
}));
|
|
6992
7004
|
};
|
|
6993
7005
|
var createKubeValues = function (context) {
|
|
6994
|
-
var _a, _b;
|
|
6995
|
-
var deployConfig = context.
|
|
6996
|
-
if (deployConfig
|
|
7006
|
+
var _a, _b, _c;
|
|
7007
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
7008
|
+
if (!deployConfig) {
|
|
6997
7009
|
return [];
|
|
6998
7010
|
}
|
|
6999
7011
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
@@ -7003,14 +7015,14 @@ var createKubeValues = function (context) {
|
|
|
7003
7015
|
var values = deployConfig.values;
|
|
7004
7016
|
// 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
|
|
7005
7017
|
// we only merge the rest of the values in
|
|
7006
|
-
var
|
|
7018
|
+
var _d = values !== null && values !== void 0 ? values : {}, application = _d.application, jobs = _d.jobs, cronjobs = _d.cronjobs, rest = __rest(_d, ["application", "jobs", "cronjobs"]);
|
|
7007
7019
|
var env = (0, kubeEnv_1.createKubeEnv)(context);
|
|
7008
7020
|
var defaultKubeValues = (0, lodash_1.merge)({
|
|
7009
7021
|
env: env,
|
|
7010
7022
|
application: createAppConfig(context, application),
|
|
7011
7023
|
}, (0, cloudSql_1.hasKubernetesCloudSQL)(context)
|
|
7012
7024
|
? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context)
|
|
7013
|
-
: {}, ((
|
|
7025
|
+
: {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled)
|
|
7014
7026
|
? (0, mongodb_1.createMongodbBaseConfig)(context)
|
|
7015
7027
|
: {});
|
|
7016
7028
|
var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({ jobs: removeFalsy(jobs), cronjobs: removeFalsy(cronjobs) }, rest)));
|
|
@@ -7058,15 +7070,15 @@ var getMongodbReplicasetHost = function (context, index) {
|
|
|
7058
7070
|
return getMongodbHost(context, "".concat(fullAppname, "-mongodb-").concat(index, ".").concat(fullAppname, "-mongodb-headless"));
|
|
7059
7071
|
};
|
|
7060
7072
|
var createMongodbUrl = function (context, dbName) {
|
|
7061
|
-
var _a, _b;
|
|
7062
|
-
if (!(0, types_1.isOfDeployType)(context.
|
|
7073
|
+
var _a, _b, _c, _d;
|
|
7074
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
7063
7075
|
throw new Error("can only createMongodbUrl on supported deploys");
|
|
7064
7076
|
}
|
|
7065
|
-
var mongodbConfig = (
|
|
7077
|
+
var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
|
|
7066
7078
|
var queryParams = undefined;
|
|
7067
7079
|
var hosts = "";
|
|
7068
7080
|
if ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset") {
|
|
7069
|
-
hosts = (0, lodash_1.range)(0, (
|
|
7081
|
+
hosts = (0, lodash_1.range)(0, (_d = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.replicaCount) !== null && _d !== void 0 ? _d : 2)
|
|
7070
7082
|
.map(function (i) { return getMongodbReplicasetHost(context, i); })
|
|
7071
7083
|
.join(",");
|
|
7072
7084
|
queryParams = "replicaSet=rs0&authSource=admin";
|
|
@@ -7078,11 +7090,11 @@ var createMongodbUrl = function (context, dbName) {
|
|
|
7078
7090
|
return "mongodb://".concat(getCredentialString(context)).concat(hosts, "/").concat(dbName).concat(queryParams ? "?".concat(queryParams) : "");
|
|
7079
7091
|
};
|
|
7080
7092
|
var createMongoBackupDefaultConfig = function (context) {
|
|
7081
|
-
var _a;
|
|
7082
|
-
if (!(0, types_1.isOfDeployType)(context.
|
|
7093
|
+
var _a, _b, _c;
|
|
7094
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
7083
7095
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
7084
7096
|
}
|
|
7085
|
-
var mongodbConfig = (
|
|
7097
|
+
var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
|
|
7086
7098
|
var fullAppName = context.environment.envVars.KUBE_APP_NAME;
|
|
7087
7099
|
var backupEnabled = ["prod", "stage"].includes(context.environment.envType);
|
|
7088
7100
|
var hostToBackup;
|
|
@@ -7112,11 +7124,11 @@ var createMongoBackupDefaultConfig = function (context) {
|
|
|
7112
7124
|
};
|
|
7113
7125
|
};
|
|
7114
7126
|
var createMongodbBaseConfig = function (context) {
|
|
7115
|
-
var _a, _b;
|
|
7116
|
-
if (!(0, types_1.isOfDeployType)(context.
|
|
7127
|
+
var _a, _b, _c, _d;
|
|
7128
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
7117
7129
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
7118
7130
|
}
|
|
7119
|
-
var mongodbConfig = (
|
|
7131
|
+
var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
|
|
7120
7132
|
return {
|
|
7121
7133
|
mongodb: {
|
|
7122
7134
|
enabled: true,
|
|
@@ -7131,7 +7143,7 @@ var createMongodbBaseConfig = function (context) {
|
|
|
7131
7143
|
backup: createMongoBackupDefaultConfig(context),
|
|
7132
7144
|
},
|
|
7133
7145
|
env: {
|
|
7134
|
-
secret: __assign({ MONGO_URL: createMongodbUrl(context, (
|
|
7146
|
+
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"
|
|
7135
7147
|
? { MONGO_OPLOG_URL: createMongodbUrl(context, "local") } // oplog only works with replicasets
|
|
7136
7148
|
: {})),
|
|
7137
7149
|
},
|
|
@@ -7187,8 +7199,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
7187
7199
|
exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
|
|
7188
7200
|
var sbom_1 = __nccwpck_require__(7038);
|
|
7189
7201
|
var sbomDeactivated = function (context) {
|
|
7190
|
-
return context.
|
|
7191
|
-
context.componentConfig.build.sbom === false;
|
|
7202
|
+
return context.build.config.type === "custom" && context.build.config.sbom === false;
|
|
7192
7203
|
};
|
|
7193
7204
|
exports.sbomDeactivated = sbomDeactivated;
|
|
7194
7205
|
var getDependencyTrackUploadScript = function (context) {
|
|
@@ -7273,7 +7284,7 @@ var isOfDeployType = function (t) {
|
|
|
7273
7284
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7274
7285
|
types[_i - 1] = arguments[_i];
|
|
7275
7286
|
}
|
|
7276
|
-
return t && types.includes(t.type);
|
|
7287
|
+
return t && types.includes(t.type) ? true : false;
|
|
7277
7288
|
};
|
|
7278
7289
|
exports.isOfDeployType = isOfDeployType;
|
|
7279
7290
|
//# sourceMappingURL=index.js.map
|
|
@@ -7309,7 +7320,8 @@ var getKubernetesNamespace = function (config, env) {
|
|
|
7309
7320
|
};
|
|
7310
7321
|
exports.getKubernetesNamespace = getKubernetesNamespace;
|
|
7311
7322
|
var contextIsStoppable = function (context) {
|
|
7312
|
-
var
|
|
7323
|
+
var _a;
|
|
7324
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
7313
7325
|
if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
7314
7326
|
return true;
|
|
7315
7327
|
}
|
|
@@ -7645,7 +7657,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7645
7657
|
};
|
|
7646
7658
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7647
7659
|
exports.createJobsForComponent = void 0;
|
|
7648
|
-
var lodash_1 = __nccwpck_require__(3255);
|
|
7649
7660
|
var build_1 = __nccwpck_require__(7862);
|
|
7650
7661
|
var context_1 = __nccwpck_require__(5875);
|
|
7651
7662
|
var deploy_1 = __nccwpck_require__(8483);
|
|
@@ -7658,18 +7669,17 @@ var injectDefaultVarsInCustomJobs = function (context, jobs) {
|
|
|
7658
7669
|
});
|
|
7659
7670
|
};
|
|
7660
7671
|
var getCustomJobs = function (context) {
|
|
7661
|
-
if (!context.
|
|
7672
|
+
if (!context.customJobs) {
|
|
7662
7673
|
return [];
|
|
7663
7674
|
}
|
|
7664
|
-
var rawJobs =
|
|
7665
|
-
? context.componentConfig.customJobs(context)
|
|
7666
|
-
: context.componentConfig.customJobs;
|
|
7675
|
+
var rawJobs = context.customJobs;
|
|
7667
7676
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
7668
7677
|
};
|
|
7669
7678
|
var createRawJobs = function (context) {
|
|
7670
|
-
var
|
|
7671
|
-
var
|
|
7672
|
-
|
|
7679
|
+
var _a, _b;
|
|
7680
|
+
var buildJobs = build_1.BUILD_TYPES[context.build.config.type].jobs(context);
|
|
7681
|
+
var deployJobs = ((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config)
|
|
7682
|
+
? deploy_1.DEPLOY_TYPES[(_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.type].jobs(context)
|
|
7673
7683
|
: [];
|
|
7674
7684
|
var customJobs = getCustomJobs(context);
|
|
7675
7685
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|