@catladder/cli 0.0.0-main-93f3e75d → 0.0.0-main-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 +251 -202
- package/dist/bundles/cli/index.js +369 -307
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
- package/dist/cli/src/config/getProjectConfig.d.ts +2 -2
- package/dist/cli/src/config/getProjectConfig.js +1 -1
- package/dist/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.d.ts +2 -2
- 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/gcloud/serviceAccounts.d.ts +2 -2
- package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
- package/dist/cli/src/kubernetes/openKubernetesDashboards.d.ts +3 -3
- 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.d.ts +2 -2
- 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/index.d.ts +2 -2
- package/dist/pipeline/src/build/base/index.js.map +1 -1
- package/dist/pipeline/src/build/base/writeBuildInfo.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- package/dist/pipeline/src/build/custom/buildJob.js +6 -6
- package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/custom/index.d.ts +2 -2
- package/dist/pipeline/src/build/custom/index.js.map +1 -1
- package/dist/pipeline/src/build/custom/testJob.d.ts +2 -2
- 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 +32 -11
- package/dist/pipeline/src/build/docker.js +50 -17
- package/dist/pipeline/src/build/docker.js.map +1 -1
- package/dist/pipeline/src/build/index.d.ts +2 -2
- package/dist/pipeline/src/build/node/buildJob.d.ts +2 -2
- package/dist/pipeline/src/build/node/buildJob.js +11 -11
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.d.ts +5 -5
- package/dist/pipeline/src/build/node/cache.js +5 -5
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/node/index.d.ts +4 -4
- package/dist/pipeline/src/build/node/index.js.map +1 -1
- package/dist/pipeline/src/build/node/meteor.d.ts +2 -2
- package/dist/pipeline/src/build/node/meteor.js +10 -10
- package/dist/pipeline/src/build/node/meteor.js.map +1 -1
- package/dist/pipeline/src/build/node/testJob.d.ts +2 -2
- 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/node/yarn.d.ts +4 -4
- package/dist/pipeline/src/build/node/yarn.js +1 -3
- package/dist/pipeline/src/build/node/yarn.js.map +1 -1
- package/dist/pipeline/src/build/rails/build.d.ts +2 -2
- 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/index.d.ts +2 -2
- package/dist/pipeline/src/build/rails/index.js.map +1 -1
- package/dist/pipeline/src/build/rails/test.d.ts +2 -2
- 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.d.ts +2 -2
- package/dist/pipeline/src/build/sbom.js +3 -3
- package/dist/pipeline/src/build/sbom.js.map +1 -1
- package/dist/pipeline/src/build/types.d.ts +33 -25
- package/dist/pipeline/src/build/types.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironment.d.ts +2 -2
- package/dist/pipeline/src/context/getEnvironment.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentContext.d.ts +2 -2
- package/dist/pipeline/src/context/getEnvironmentContext.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +4 -4
- package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
- package/dist/pipeline/src/context/getLabels.d.ts +2 -2
- 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.d.ts +7 -3
- package/dist/pipeline/src/context/index.js +46 -15
- package/dist/pipeline/src/context/index.js.map +1 -1
- package/dist/pipeline/src/deploy/base/deploy.d.ts +2 -2
- 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/base/index.d.ts +2 -2
- package/dist/pipeline/src/deploy/base/index.js.map +1 -1
- package/dist/pipeline/src/deploy/base/rollback.d.ts +2 -2
- package/dist/pipeline/src/deploy/base/rollback.js.map +1 -1
- package/dist/pipeline/src/deploy/base/stop.d.ts +2 -2
- package/dist/pipeline/src/deploy/base/stop.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.d.ts +7 -7
- 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/cleanup.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/cleanup.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.d.ts +2 -2
- 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/cloudRunJobs.d.ts +6 -6
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.d.ts +3 -3
- 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.js +2 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/index.d.ts +2 -2
- 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/cloudRun/utils/database.d.ts +3 -3
- package/dist/pipeline/src/deploy/cloudRun/utils/database.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.js.map +1 -1
- package/dist/pipeline/src/deploy/custom/deployJob.d.ts +2 -2
- package/dist/pipeline/src/deploy/custom/deployJob.js +9 -10
- package/dist/pipeline/src/deploy/custom/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/dockerTag/deployJob.d.ts +2 -2
- 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/index.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.d.ts +3 -3
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +4 -4
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- package/dist/pipeline/src/pipeline/createJobsForComponent.js +7 -9
- package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
- package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
- package/dist/pipeline/src/types/config.d.ts +2 -2
- package/dist/pipeline/src/types/context.d.ts +28 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +9 -12
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +2 -2
- package/src/apps/cli/commands/project/commandPortForward.ts +9 -6
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +4 -4
- package/src/apps/cli/commands/project/setup/setupContext.ts +4 -4
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +3 -3
- package/src/apps/cli/commands/project/utils/ensureCluster.ts +2 -4
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +2 -2
- package/src/config/getProjectConfig.ts +2 -2
- package/src/gcloud/cloudRun/openCloudRunDashboards.ts +4 -4
- package/src/gcloud/serviceAccounts.ts +3 -3
- package/src/kubernetes/openKubernetesDashboards.ts +5 -5
|
@@ -811,7 +811,7 @@ var getPipelineContextByChoice = function (env, componentName) { return __awaite
|
|
|
811
811
|
case 0: return [4 /*yield*/, (0, exports.getProjectConfig)()];
|
|
812
812
|
case 1:
|
|
813
813
|
config = _a.sent();
|
|
814
|
-
return [4 /*yield*/, (0, pipeline_1.
|
|
814
|
+
return [4 /*yield*/, (0, pipeline_1.createComponentContext)({
|
|
815
815
|
config: config,
|
|
816
816
|
componentName: componentName,
|
|
817
817
|
env: env,
|
|
@@ -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)), false), [
|
|
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;
|
|
@@ -2528,8 +2530,8 @@ var RUNNER_BUILD_VARIABLES = {
|
|
|
2528
2530
|
KUBERNETES_MEMORY_LIMIT: "4Gi",
|
|
2529
2531
|
};
|
|
2530
2532
|
var createCustomBuildJobs = function (context) {
|
|
2531
|
-
var _a, _b, _c
|
|
2532
|
-
var buildConfig = context.
|
|
2533
|
+
var _a, _b, _c;
|
|
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,17 +2545,17 @@ 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
|
},
|
|
2553
2555
|
}
|
|
2554
2556
|
: undefined,
|
|
2555
2557
|
dockerBuild: {
|
|
2556
|
-
script: (0, docker_1.
|
|
2558
|
+
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context),
|
|
2557
2559
|
variables: {},
|
|
2558
2560
|
},
|
|
2559
2561
|
});
|
|
@@ -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;
|
|
@@ -2745,22 +2747,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
2745
2747
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2746
2748
|
};
|
|
2747
2749
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2748
|
-
exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
|
|
2749
|
-
var lodash_1 = __nccwpck_require__(3255);
|
|
2750
|
-
var deploy_1 = __nccwpck_require__(8483);
|
|
2751
|
-
var runner_1 = __nccwpck_require__(4058);
|
|
2750
|
+
exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.getDockerBuildScriptWithBuiltInDockerFile = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
|
|
2752
2751
|
var fs_1 = __nccwpck_require__(7147);
|
|
2752
|
+
var lodash_1 = __nccwpck_require__(3255);
|
|
2753
2753
|
var path_1 = __importDefault(__nccwpck_require__(1017));
|
|
2754
|
-
var
|
|
2754
|
+
var deploy_1 = __nccwpck_require__(8483);
|
|
2755
2755
|
var artifactsRegistry_1 = __nccwpck_require__(4963);
|
|
2756
2756
|
var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(6320);
|
|
2757
|
+
var runner_1 = __nccwpck_require__(4058);
|
|
2758
|
+
var gitlab_1 = __nccwpck_require__(8490);
|
|
2757
2759
|
var DOCKER_BUILD_RUNNER_REQUESTS = {
|
|
2758
2760
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
2759
2761
|
KUBERNETES_MEMORY_REQUEST: "1Gi",
|
|
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
|
|
@@ -2792,13 +2797,27 @@ var getDockerBuildRunnerVariables = function () { return ({
|
|
|
2792
2797
|
DOCKER_DRIVER: "overlay2",
|
|
2793
2798
|
DOCKER_BUILDKIT: "1", // see https://docs.docker.com/develop/develop-images/build_enhancements/
|
|
2794
2799
|
}); };
|
|
2800
|
+
var getDockerAdditions = function (build) {
|
|
2801
|
+
var _a, _b;
|
|
2802
|
+
if (!("docker" in build))
|
|
2803
|
+
return {};
|
|
2804
|
+
if (!build.docker)
|
|
2805
|
+
return {};
|
|
2806
|
+
return {
|
|
2807
|
+
DOCKERFILE_ADDITIONS: "additionsBegin" in build.docker
|
|
2808
|
+
? (_a = build.docker.additionsBegin) === null || _a === void 0 ? void 0 : _a.join("\n")
|
|
2809
|
+
: undefined,
|
|
2810
|
+
DOCKERFILE_ADDITIONS_END: "additionsEnd" in build.docker
|
|
2811
|
+
? (_b = build.docker.additionsEnd) === null || _b === void 0 ? void 0 : _b.join("\n")
|
|
2812
|
+
: undefined,
|
|
2813
|
+
};
|
|
2814
|
+
};
|
|
2795
2815
|
var getDockerBuildVariables = function (context) {
|
|
2796
|
-
|
|
2797
|
-
return __assign({ DOCKERFILE_ADDITIONS: (_b = (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"), DOCKERFILE_ADDITIONS_END: (_d = (_c = context.componentConfig.build.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"), APP_DIR: context.componentConfig.dir, DOCKER_DIR: "." }, (0, exports.getDockerImageVariables)(context));
|
|
2816
|
+
return __assign(__assign(__assign({}, getDockerAdditions(context.build.config)), { APP_DIR: context.build.dir, DOCKER_DIR: "." }), (0, exports.getDockerImageVariables)(context));
|
|
2798
2817
|
};
|
|
2799
2818
|
exports.getDockerBuildVariables = getDockerBuildVariables;
|
|
2800
2819
|
exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
|
|
2801
|
-
var getDockerJobBaseProps = function (
|
|
2820
|
+
var getDockerJobBaseProps = function () {
|
|
2802
2821
|
return {
|
|
2803
2822
|
image: (0, runner_1.getRunnerImage)("docker-build"),
|
|
2804
2823
|
services: [
|
|
@@ -2814,14 +2833,14 @@ var getDockerJobBaseProps = function (context) {
|
|
|
2814
2833
|
exports.getDockerJobBaseProps = getDockerJobBaseProps;
|
|
2815
2834
|
var createDockerBuildJobBase = function (context, _a) {
|
|
2816
2835
|
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)(
|
|
2836
|
+
return (0, lodash_1.merge)(__assign(__assign({ name: exports.DOCKER_BUILD_JOB_NAME, envMode: "jobPerEnv", stage: "build" }, (0, exports.getDockerJobBaseProps)()), { script: script || [] }), {
|
|
2818
2837
|
variables: (0, exports.getDockerBuildVariables)(context),
|
|
2819
2838
|
runnerVariables: __assign(__assign({}, DOCKER_BUILD_RUNNER_REQUESTS), getDockerBuildRunnerVariables()),
|
|
2820
2839
|
}, def);
|
|
2821
2840
|
};
|
|
2822
2841
|
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
2823
2842
|
var gitlabDockerLogin = function (context) {
|
|
2824
|
-
return (0, deploy_1.isOfDeployType)(context.
|
|
2843
|
+
return context.deploy && (0, deploy_1.isOfDeployType)(context.deploy.config, "google-cloudrun")
|
|
2825
2844
|
? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [
|
|
2826
2845
|
"gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context)),
|
|
2827
2846
|
], false) : [
|
|
@@ -2829,9 +2848,25 @@ var gitlabDockerLogin = function (context) {
|
|
|
2829
2848
|
];
|
|
2830
2849
|
};
|
|
2831
2850
|
exports.gitlabDockerLogin = gitlabDockerLogin;
|
|
2851
|
+
var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
|
|
2852
|
+
meteor: "ensureMeteorDockerfile",
|
|
2853
|
+
node: "ensureNodeDockerfile",
|
|
2854
|
+
nginx: "ensureNginxDockerfile",
|
|
2855
|
+
custom: null,
|
|
2856
|
+
};
|
|
2857
|
+
var getDockerBuildScriptWithBuiltInDockerFile = function (context, defaultType) {
|
|
2858
|
+
var _a;
|
|
2859
|
+
var type = "docker" in context.componentConfig.build &&
|
|
2860
|
+
context.componentConfig.build.docker &&
|
|
2861
|
+
"type" in context.componentConfig.build.docker
|
|
2862
|
+
? (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.type
|
|
2863
|
+
: defaultType;
|
|
2864
|
+
return (0, exports.getDockerBuildDefaultScript)(context, type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null);
|
|
2865
|
+
};
|
|
2866
|
+
exports.getDockerBuildScriptWithBuiltInDockerFile = getDockerBuildScriptWithBuiltInDockerFile;
|
|
2832
2867
|
var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
2833
2868
|
return __spreadArray(__spreadArray(__spreadArray([
|
|
2834
|
-
ensureDockerFileScript
|
|
2869
|
+
ensureDockerFileScript !== null && ensureDockerFileScript !== void 0 ? ensureDockerFileScript : undefined
|
|
2835
2870
|
], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")([
|
|
2836
2871
|
"docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1", //BUILDKIT_INLINE_CACHE, see https://testdriven.io/blog/faster-ci-builds-with-docker-cache/
|
|
2837
2872
|
])), false), __read((0, gitlab_1.collapseableSection)("docker-push", "Docker push and tag")([
|
|
@@ -2842,7 +2877,7 @@ var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
|
2842
2877
|
};
|
|
2843
2878
|
exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
|
|
2844
2879
|
var hasDockerfile = function (context) {
|
|
2845
|
-
return (0, fs_1.existsSync)(path_1.default.join(context.
|
|
2880
|
+
return (0, fs_1.existsSync)(path_1.default.join(context.build.dir, "Dockerfile"));
|
|
2846
2881
|
};
|
|
2847
2882
|
exports.hasDockerfile = hasDockerfile;
|
|
2848
2883
|
//# sourceMappingURL=docker.js.map
|
|
@@ -2963,23 +2998,23 @@ var constants_1 = __nccwpck_require__(1765);
|
|
|
2963
2998
|
var yarn_1 = __nccwpck_require__(5043);
|
|
2964
2999
|
var createNodeBuildJobs = function (context) {
|
|
2965
3000
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2966
|
-
var buildConfig = context.
|
|
3001
|
+
var buildConfig = context.build.config;
|
|
2967
3002
|
if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
|
|
2968
3003
|
throw new Error("deploy config is not node, node-static or storybook");
|
|
2969
3004
|
}
|
|
2970
3005
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
2971
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
3006
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
2972
3007
|
return (0, base_1.createBuildJobs)(context, {
|
|
2973
3008
|
appBuild: buildConfig.buildCommand !== null
|
|
2974
3009
|
? {
|
|
2975
3010
|
image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
|
|
2976
3011
|
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)), false), __read((0, cache_1.getNextCache)(context)), false),
|
|
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),
|
|
2978
3013
|
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
|
|
2979
3014
|
artifacts: {
|
|
2980
3015
|
paths: __spreadArray([
|
|
2981
|
-
context.
|
|
2982
|
-
], __read(((_e = (_d = context.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : [])), false).flatMap(function (dir) {
|
|
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) {
|
|
2983
3018
|
var _a, _b;
|
|
2984
3019
|
return __spreadArray([
|
|
2985
3020
|
(0, path_1.join)(dir, "__build_info.json"),
|
|
@@ -2996,14 +3031,14 @@ var createNodeBuildJobs = function (context) {
|
|
|
2996
3031
|
}
|
|
2997
3032
|
: undefined,
|
|
2998
3033
|
dockerBuild: {
|
|
2999
|
-
script: (0, docker_1.
|
|
3000
|
-
? "
|
|
3001
|
-
: "
|
|
3002
|
-
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
|
|
3034
|
+
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
|
|
3035
|
+
? "nginx"
|
|
3036
|
+
: "node"),
|
|
3037
|
+
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.build, "pull")), false),
|
|
3003
3038
|
variables: {
|
|
3004
3039
|
// only required for non static
|
|
3005
|
-
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
|
|
3006
|
-
DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.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"),
|
|
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"),
|
|
3007
3042
|
},
|
|
3008
3043
|
},
|
|
3009
3044
|
});
|
|
@@ -3063,9 +3098,9 @@ var getYarnCache = function (context, policy) {
|
|
|
3063
3098
|
paths: [".yarn"],
|
|
3064
3099
|
}
|
|
3065
3100
|
: {
|
|
3066
|
-
key: (0, slugify_1.default)(context.
|
|
3101
|
+
key: (0, slugify_1.default)(context.dir) + "-yarn",
|
|
3067
3102
|
policy: policy,
|
|
3068
|
-
paths: [(0, path_1.join)(context.
|
|
3103
|
+
paths: [(0, path_1.join)(context.dir, ".yarn")],
|
|
3069
3104
|
},
|
|
3070
3105
|
];
|
|
3071
3106
|
};
|
|
@@ -3081,7 +3116,7 @@ var getNodeModulesCache = function (context, policy) {
|
|
|
3081
3116
|
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
3082
3117
|
key: componentIsInWorkspace
|
|
3083
3118
|
? "node-modules-workspace"
|
|
3084
|
-
: (0, slugify_1.default)(context.
|
|
3119
|
+
: (0, slugify_1.default)(context.dir) + "-node-modules", // we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
|
|
3085
3120
|
policy: policy,
|
|
3086
3121
|
paths: __spreadArray([], __read((componentIsInWorkspace
|
|
3087
3122
|
? (0, lodash_1.uniq)(__spreadArray([
|
|
@@ -3089,7 +3124,7 @@ var getNodeModulesCache = function (context, policy) {
|
|
|
3089
3124
|
], __read(((_c = (_b = context.packageManagerInfo) === null || _b === void 0 ? void 0 : _b.workspaces.map(function (w) {
|
|
3090
3125
|
return (0, path_1.join)(w.location, "node_modules");
|
|
3091
3126
|
})) !== null && _c !== void 0 ? _c : [])), false))
|
|
3092
|
-
: [(0, path_1.join)(context.
|
|
3127
|
+
: [(0, path_1.join)(context.dir, "node_modules")])), false),
|
|
3093
3128
|
},
|
|
3094
3129
|
];
|
|
3095
3130
|
};
|
|
@@ -3103,7 +3138,7 @@ var getNextCache = function (context) { return [
|
|
|
3103
3138
|
{
|
|
3104
3139
|
key: context.componentName + "-next-cache",
|
|
3105
3140
|
policy: "pull-push",
|
|
3106
|
-
paths: [context.
|
|
3141
|
+
paths: [context.build.dir + "/.next/cache/"],
|
|
3107
3142
|
},
|
|
3108
3143
|
]; };
|
|
3109
3144
|
exports.getNextCache = getNextCache;
|
|
@@ -3222,23 +3257,23 @@ var getMeteorCache = function (context) { return [
|
|
|
3222
3257
|
key: context.componentName + "meteor-build-cache",
|
|
3223
3258
|
policy: "pull-push",
|
|
3224
3259
|
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.
|
|
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"),
|
|
3229
3264
|
],
|
|
3230
3265
|
},
|
|
3231
3266
|
]; };
|
|
3232
3267
|
var createMeteorBuildJobs = function (context) {
|
|
3233
|
-
var buildConfig = context.
|
|
3268
|
+
var buildConfig = context.build.config;
|
|
3234
3269
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
3235
3270
|
throw new Error("deploy config is not meteor");
|
|
3236
3271
|
}
|
|
3237
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
3272
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
3238
3273
|
return (0, base_1.createBuildJobs)(context, {
|
|
3239
3274
|
appBuild: buildConfig.buildCommand !== null
|
|
3240
3275
|
? {
|
|
3241
|
-
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
|
|
3276
|
+
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.build)), false), __read(getMeteorCache(context)), false),
|
|
3242
3277
|
image: (0, runner_1.getRunnerImage)("jobs-meteor"),
|
|
3243
3278
|
variables: {
|
|
3244
3279
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1", // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
@@ -3252,14 +3287,14 @@ var createMeteorBuildJobs = function (context) {
|
|
|
3252
3287
|
], false),
|
|
3253
3288
|
artifacts: {
|
|
3254
3289
|
paths: [
|
|
3255
|
-
context.
|
|
3256
|
-
context.
|
|
3290
|
+
context.build.dir + "/__build_info.json",
|
|
3291
|
+
context.build.dir + "/dist",
|
|
3257
3292
|
],
|
|
3258
3293
|
},
|
|
3259
3294
|
}
|
|
3260
3295
|
: undefined,
|
|
3261
3296
|
dockerBuild: {
|
|
3262
|
-
script: (0, docker_1.
|
|
3297
|
+
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, "meteor"),
|
|
3263
3298
|
variables: {
|
|
3264
3299
|
METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : "",
|
|
3265
3300
|
},
|
|
@@ -3327,32 +3362,32 @@ var createNodeTestJobs = function (context) {
|
|
|
3327
3362
|
if (context.trigger === "taggedRelease") {
|
|
3328
3363
|
return [];
|
|
3329
3364
|
}
|
|
3330
|
-
var buildConfig = context.
|
|
3365
|
+
var buildConfig = context.build.config;
|
|
3331
3366
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
3332
3367
|
var base = {
|
|
3333
|
-
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 : {})),
|
|
3334
3369
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
3335
3370
|
stage: "test",
|
|
3336
3371
|
needs: [],
|
|
3337
3372
|
envMode: "none",
|
|
3338
3373
|
};
|
|
3339
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
3374
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
3340
3375
|
var auditJob = buildConfig.audit !== false
|
|
3341
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([
|
|
3342
|
-
"cd ".concat(context.
|
|
3377
|
+
"cd ".concat(context.build.dir)
|
|
3343
3378
|
], __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.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic)
|
|
3379
|
+
((_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic)
|
|
3345
3380
|
? "yarn audit"
|
|
3346
3381
|
: "yarn npm audit --environment production", // yarn 2
|
|
3347
|
-
])), 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;
|
|
3348
3383
|
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), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), [
|
|
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.
|
|
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;
|
|
3352
3387
|
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), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), [
|
|
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.
|
|
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;
|
|
3356
3391
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
3357
3392
|
};
|
|
3358
3393
|
exports.createNodeTestJobs = createNodeTestJobs;
|
|
@@ -3414,9 +3449,7 @@ var ensureNodeVersion = function (context) {
|
|
|
3414
3449
|
exports.ensureNodeVersion = ensureNodeVersion;
|
|
3415
3450
|
var getYarnInstall = function (context, options) {
|
|
3416
3451
|
var _a;
|
|
3417
|
-
var postInstall = "postInstall" in context.
|
|
3418
|
-
? context.componentConfig.build.postInstall
|
|
3419
|
-
: null;
|
|
3452
|
+
var postInstall = "postInstall" in context.config ? context.config.postInstall : null;
|
|
3420
3453
|
return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read((postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall)
|
|
3421
3454
|
? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : [])
|
|
3422
3455
|
: [])), false);
|
|
@@ -3491,7 +3524,7 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
3491
3524
|
var types_1 = __nccwpck_require__(4466);
|
|
3492
3525
|
var createRailsBuildJobs = function (context) {
|
|
3493
3526
|
var _a, _b, _c;
|
|
3494
|
-
var buildConfig = context.
|
|
3527
|
+
var buildConfig = context.build.config;
|
|
3495
3528
|
if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
|
|
3496
3529
|
// should not happen
|
|
3497
3530
|
throw new Error("build type is not rails");
|
|
@@ -3515,10 +3548,10 @@ var createRailsBuildJobs = function (context) {
|
|
|
3515
3548
|
return (0, base_1.createBuildJobs)(context, {
|
|
3516
3549
|
appBuild: undefined,
|
|
3517
3550
|
dockerBuild: {
|
|
3518
|
-
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.
|
|
3551
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
|
|
3519
3552
|
// custom script
|
|
3520
3553
|
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
|
|
3521
|
-
"cd ".concat(context.
|
|
3554
|
+
"cd ".concat(context.build.dir),
|
|
3522
3555
|
"docker pull $DOCKER_CACHE_IMAGE || true",
|
|
3523
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"),
|
|
3524
3557
|
"chmod +x /usr/local/bin/pack",
|
|
@@ -3627,7 +3660,7 @@ var createRailsTestJobs = function (context) {
|
|
|
3627
3660
|
if (context.trigger === "taggedRelease") {
|
|
3628
3661
|
return [];
|
|
3629
3662
|
}
|
|
3630
|
-
var buildConfig = context.
|
|
3663
|
+
var buildConfig = context.build.config;
|
|
3631
3664
|
var base = {
|
|
3632
3665
|
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
|
|
3633
3666
|
stage: "test",
|
|
@@ -3649,20 +3682,20 @@ var createRailsTestJobs = function (context) {
|
|
|
3649
3682
|
};
|
|
3650
3683
|
var auditJob = buildConfig.audit !== false
|
|
3651
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([
|
|
3652
|
-
"cd ".concat(context.
|
|
3685
|
+
"cd ".concat(context.build.dir)
|
|
3653
3686
|
], __read(((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
3654
3687
|
"gem install bundler-audit",
|
|
3655
3688
|
"bundle audit check",
|
|
3656
3689
|
])), false), allow_failure: true }) : null;
|
|
3657
3690
|
var lintJob = buildConfig.lint !== false
|
|
3658
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([
|
|
3659
|
-
"cd ".concat(context.
|
|
3692
|
+
"cd ".concat(context.build.dir)
|
|
3660
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 : [
|
|
3661
3694
|
"bundle exec rubocop",
|
|
3662
3695
|
])), false) }) : null;
|
|
3663
3696
|
var testJob = buildConfig.test !== false
|
|
3664
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([
|
|
3665
|
-
"cd ".concat(context.
|
|
3698
|
+
"cd ".concat(context.build.dir)
|
|
3666
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 : [
|
|
3667
3700
|
"bundle exec rspec",
|
|
3668
3701
|
])), false) }) : null;
|
|
@@ -3685,12 +3718,12 @@ exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
|
|
|
3685
3718
|
exports.SBOM_FILE = "__sbom.json";
|
|
3686
3719
|
var createSbomBuildJob = function (context) {
|
|
3687
3720
|
var _a, _b, _c, _d, _e;
|
|
3688
|
-
var buildConfig = context.
|
|
3721
|
+
var buildConfig = context.build.config;
|
|
3689
3722
|
var defaultImage = "aquasec/trivy:0.38.3";
|
|
3690
3723
|
var defaultScript = [
|
|
3691
|
-
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace)
|
|
3724
|
+
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.build.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace)
|
|
3692
3725
|
? "."
|
|
3693
|
-
: context.
|
|
3726
|
+
: context.build.dir),
|
|
3694
3727
|
];
|
|
3695
3728
|
var image = buildConfig.type === "custom" && buildConfig.sbom !== false
|
|
3696
3729
|
? (_c = (_b = buildConfig.sbom) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage
|
|
@@ -4316,7 +4349,7 @@ var sanitize = function (value) {
|
|
|
4316
4349
|
};
|
|
4317
4350
|
var getLabels = function (context) {
|
|
4318
4351
|
var _a, _b, _c;
|
|
4319
|
-
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 : {}));
|
|
4320
4353
|
return labels;
|
|
4321
4354
|
};
|
|
4322
4355
|
exports.getLabels = getLabels;
|
|
@@ -4355,6 +4388,17 @@ exports.getReviewSlug = getReviewSlug;
|
|
|
4355
4388
|
|
|
4356
4389
|
"use strict";
|
|
4357
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
|
+
};
|
|
4358
4402
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4359
4403
|
if (k2 === undefined) k2 = k;
|
|
4360
4404
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -4406,7 +4450,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
4406
4450
|
}
|
|
4407
4451
|
};
|
|
4408
4452
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4409
|
-
exports.createContext = void 0;
|
|
4453
|
+
exports.createContext = exports.createComponentContext = void 0;
|
|
4454
|
+
var lodash_1 = __nccwpck_require__(3255);
|
|
4410
4455
|
var build_1 = __nccwpck_require__(7862);
|
|
4411
4456
|
var deploy_1 = __nccwpck_require__(8483);
|
|
4412
4457
|
var utils_1 = __nccwpck_require__(2497);
|
|
@@ -4414,11 +4459,10 @@ var getEnvironment_1 = __nccwpck_require__(5699);
|
|
|
4414
4459
|
var getEnvironmentContext_1 = __nccwpck_require__(3663);
|
|
4415
4460
|
__exportStar(__nccwpck_require__(5699), exports);
|
|
4416
4461
|
__exportStar(__nccwpck_require__(5133), exports);
|
|
4417
|
-
var
|
|
4418
|
-
var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
switch (_b.label) {
|
|
4462
|
+
var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4463
|
+
var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
4464
|
+
return __generator(this, function (_a) {
|
|
4465
|
+
switch (_a.label) {
|
|
4422
4466
|
case 0:
|
|
4423
4467
|
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
4424
4468
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
@@ -4435,21 +4479,41 @@ var createContext = function (ctx) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
4435
4479
|
deploy: {},
|
|
4436
4480
|
};
|
|
4437
4481
|
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
4438
|
-
|
|
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 = {
|
|
4439
4487
|
fullConfig: ctx.config,
|
|
4440
4488
|
componentConfig: componentConfig,
|
|
4441
|
-
|
|
4489
|
+
build: {
|
|
4490
|
+
dir: dir,
|
|
4491
|
+
packageManagerInfo: ctx.packageManagerInfo,
|
|
4492
|
+
config: build,
|
|
4493
|
+
},
|
|
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,
|
|
4442
4504
|
};
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
_a.trigger = ctx.trigger,
|
|
4448
|
-
_a)];
|
|
4505
|
+
resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs)
|
|
4506
|
+
? customJobs(context)
|
|
4507
|
+
: customJobs;
|
|
4508
|
+
return [2 /*return*/, __assign(__assign({}, context), { customJobs: resolvedCustomJobs })];
|
|
4449
4509
|
}
|
|
4450
4510
|
});
|
|
4451
4511
|
}); };
|
|
4452
|
-
exports.
|
|
4512
|
+
exports.createComponentContext = createComponentContext;
|
|
4513
|
+
/**
|
|
4514
|
+
* @deprecated use createComponentContext instead
|
|
4515
|
+
*/
|
|
4516
|
+
exports.createContext = exports.createComponentContext;
|
|
4453
4517
|
//# sourceMappingURL=index.js.map
|
|
4454
4518
|
|
|
4455
4519
|
/***/ }),
|
|
@@ -4856,7 +4920,7 @@ var stop_1 = __nccwpck_require__(2846);
|
|
|
4856
4920
|
var variables_1 = __nccwpck_require__(2422);
|
|
4857
4921
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
4858
4922
|
var createDeployJob = function (context, jobDefinition) {
|
|
4859
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4923
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4860
4924
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
4861
4925
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
4862
4926
|
var autoStop = context.environment.envType === "review"
|
|
@@ -4864,14 +4928,13 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
4864
4928
|
: context.environment.envType === "dev"
|
|
4865
4929
|
? "4 weeks"
|
|
4866
4930
|
: undefined;
|
|
4931
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
4867
4932
|
// if auto or manual is configured explicitly, use that
|
|
4868
|
-
var whenDeployDefined =
|
|
4869
|
-
? context.componentConfig.deploy.when
|
|
4870
|
-
: undefined;
|
|
4933
|
+
var whenDeployDefined = deployConfig && deployConfig.when ? deployConfig.when : undefined;
|
|
4871
4934
|
// otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
|
|
4872
4935
|
var whenDeployDefault = context.environment.envType !== "prod"
|
|
4873
4936
|
? "auto" // is not stage, auto deploy
|
|
4874
|
-
: ((
|
|
4937
|
+
: ((_b = context.componentConfig.env) === null || _b === void 0 ? void 0 : _b.stage) === false
|
|
4875
4938
|
? "auto" // is prod, but no staging, auto deploy
|
|
4876
4939
|
: "manual"; // manually deploy
|
|
4877
4940
|
var whenDeploy = whenDeployDefined ? whenDeployDefined : whenDeployDefault;
|
|
@@ -4885,12 +4948,12 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
4885
4948
|
envMode: "stagePerEnv", // makes it easier to run manual tasks er env
|
|
4886
4949
|
needs: __spreadArray(__spreadArray([], __read(((0, sbom_2.sbomDeactivated)(context)
|
|
4887
4950
|
? []
|
|
4888
|
-
: [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((
|
|
4889
|
-
? (
|
|
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 ({
|
|
4890
4953
|
componentName: c,
|
|
4891
4954
|
job: exports.DEPLOY_JOB_NAME,
|
|
4892
4955
|
artifacts: false,
|
|
4893
|
-
}); })) !== null &&
|
|
4956
|
+
}); })) !== null && _d !== void 0 ? _d : []
|
|
4894
4957
|
: [])), false),
|
|
4895
4958
|
// we don't want to deploy when there is a broken test
|
|
4896
4959
|
needsStages: [
|
|
@@ -4906,21 +4969,15 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
4906
4969
|
when: whenDeploy === "auto" ? "on_success" : "manual",
|
|
4907
4970
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
4908
4971
|
stage: "deploy",
|
|
4909
|
-
variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), (hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {})), context.environment.jobOnlyVars.deploy.envVars), (
|
|
4910
|
-
|
|
4911
|
-
: {})), jobDefinition.variables),
|
|
4912
|
-
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), ((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {})), (context.componentConfig.deploy
|
|
4913
|
-
? (_f = context.componentConfig.deploy.runnerVariables) !== null && _f !== void 0 ? _f : {}
|
|
4914
|
-
: {})),
|
|
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 : {} : {})),
|
|
4915
4974
|
environment: isStoppable
|
|
4916
4975
|
? {
|
|
4917
4976
|
on_stop: stop_1.STOP_JOB_NAME,
|
|
4918
4977
|
auto_stop_in: autoStop,
|
|
4919
4978
|
}
|
|
4920
4979
|
: undefined,
|
|
4921
|
-
jobTags:
|
|
4922
|
-
? context.componentConfig.deploy.jobTags
|
|
4923
|
-
: undefined,
|
|
4980
|
+
jobTags: deployConfig ? deployConfig.jobTags : undefined,
|
|
4924
4981
|
};
|
|
4925
4982
|
};
|
|
4926
4983
|
exports.createDeployJob = createDeployJob;
|
|
@@ -5118,17 +5175,18 @@ var BashExpression_1 = __nccwpck_require__(2376);
|
|
|
5118
5175
|
var gitlab_1 = __nccwpck_require__(8490);
|
|
5119
5176
|
var types_1 = __nccwpck_require__(5781);
|
|
5120
5177
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(4398);
|
|
5121
|
-
var getArtifactsRegistryHost = function (
|
|
5122
|
-
var
|
|
5123
|
-
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")) {
|
|
5124
5181
|
// should not happen
|
|
5125
5182
|
throw new Error("deploy config is wrong");
|
|
5126
5183
|
}
|
|
5127
|
-
return "".concat(deploy.region, "-docker.pkg.dev");
|
|
5184
|
+
return "".concat(context.deploy.config.region, "-docker.pkg.dev");
|
|
5128
5185
|
};
|
|
5129
5186
|
exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
|
|
5130
5187
|
var getArtifactsRegistryDockerUrl = function (context) {
|
|
5131
|
-
var
|
|
5188
|
+
var _a;
|
|
5189
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5132
5190
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5133
5191
|
// should not happen
|
|
5134
5192
|
throw new Error("deploy config is wrong");
|
|
@@ -5191,11 +5249,9 @@ var getDeleteImageCommands = function (fullImageName, keepNewest) {
|
|
|
5191
5249
|
* @returns
|
|
5192
5250
|
*/
|
|
5193
5251
|
var getDeleteUnusedImagesCommands = function (context, keep) {
|
|
5252
|
+
var _a;
|
|
5194
5253
|
if (keep === void 0) { keep = 0; }
|
|
5195
|
-
var deployConfig = context.
|
|
5196
|
-
if (deployConfig === false) {
|
|
5197
|
-
return [];
|
|
5198
|
-
}
|
|
5254
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5199
5255
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5200
5256
|
// should not happen
|
|
5201
5257
|
throw new Error("deploy config is wrong");
|
|
@@ -5286,8 +5342,9 @@ var createArgsString_1 = __nccwpck_require__(9598);
|
|
|
5286
5342
|
var getServiceName_1 = __nccwpck_require__(8128);
|
|
5287
5343
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(4398);
|
|
5288
5344
|
var getListRevisionsCommand = function (context, args) {
|
|
5345
|
+
var _a;
|
|
5289
5346
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
5290
|
-
var deployConfig = context.
|
|
5347
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5291
5348
|
if (!deployConfig || !(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5292
5349
|
// should not happen
|
|
5293
5350
|
throw new Error("deploy config is wrong");
|
|
@@ -5299,10 +5356,8 @@ var getListRevisionsCommand = function (context, args) {
|
|
|
5299
5356
|
return "gcloud run revisions list ".concat((0, createArgsString_1.createArgsString)(filterRevisionArgs));
|
|
5300
5357
|
};
|
|
5301
5358
|
var getDeleteUnusedRevisionsCommands = function (context, keep) {
|
|
5302
|
-
var
|
|
5303
|
-
|
|
5304
|
-
return [];
|
|
5305
|
-
}
|
|
5359
|
+
var _a;
|
|
5360
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5306
5361
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5307
5362
|
// should not happen
|
|
5308
5363
|
throw new Error("deploy config is wrong");
|
|
@@ -5571,7 +5626,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
|
5571
5626
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
5572
5627
|
var customConfig = service !== true ? service : undefined;
|
|
5573
5628
|
var command = service !== true
|
|
5574
|
-
? (_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
|
|
5575
5630
|
: undefined;
|
|
5576
5631
|
var commandArray = command
|
|
5577
5632
|
? Array.isArray(command)
|
|
@@ -5666,7 +5721,8 @@ var makeLabelString = function (obj) {
|
|
|
5666
5721
|
};
|
|
5667
5722
|
exports.makeLabelString = makeLabelString;
|
|
5668
5723
|
var getCloudRunDeployConfig = function (context) {
|
|
5669
|
-
var
|
|
5724
|
+
var _a;
|
|
5725
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5670
5726
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5671
5727
|
// should not happen
|
|
5672
5728
|
throw new Error("deploy config is wrong");
|
|
@@ -5848,10 +5904,8 @@ var constants_1 = __nccwpck_require__(8865);
|
|
|
5848
5904
|
var getCloudRunDeployScripts_1 = __nccwpck_require__(3695);
|
|
5849
5905
|
var getCloudRunStopScripts_1 = __nccwpck_require__(3747);
|
|
5850
5906
|
var createGoogleCloudRunDeployJobs = function (context) {
|
|
5851
|
-
var
|
|
5852
|
-
|
|
5853
|
-
return [];
|
|
5854
|
-
}
|
|
5907
|
+
var _a;
|
|
5908
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5855
5909
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
5856
5910
|
// should not happen
|
|
5857
5911
|
throw new Error("deploy config is wrong");
|
|
@@ -6331,29 +6385,28 @@ var base_1 = __nccwpck_require__(2024);
|
|
|
6331
6385
|
var sbom_1 = __nccwpck_require__(4986);
|
|
6332
6386
|
var types_1 = __nccwpck_require__(5781);
|
|
6333
6387
|
var createCustomDeployJobs = function (context) {
|
|
6334
|
-
var _a, _b, _c;
|
|
6335
|
-
var deployConfig = context.
|
|
6336
|
-
if (deployConfig === false) {
|
|
6337
|
-
return [];
|
|
6338
|
-
}
|
|
6388
|
+
var _a, _b, _c, _d;
|
|
6389
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6339
6390
|
if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
|
|
6340
6391
|
// should not happen
|
|
6341
6392
|
throw new Error("deploy config is not custom");
|
|
6342
6393
|
}
|
|
6343
6394
|
// FIXME: custom deploy currently assumes yarn-based project
|
|
6344
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context, {
|
|
6395
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build, {
|
|
6396
|
+
noCustomPostInstall: true,
|
|
6397
|
+
});
|
|
6345
6398
|
return (0, base_1.createDeployementJobs)(context, {
|
|
6346
6399
|
deploy: {
|
|
6347
|
-
image: (
|
|
6348
|
-
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 : [],
|
|
6349
6402
|
script: __spreadArray(__spreadArray(__spreadArray([
|
|
6350
|
-
"cd ".concat(context.
|
|
6403
|
+
"cd ".concat(context.build.dir)
|
|
6351
6404
|
], __read((deployConfig.requiresYarnInstall ? yarnInstall : [])), false), __read(deployConfig.script), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false),
|
|
6352
6405
|
variables: {},
|
|
6353
6406
|
},
|
|
6354
6407
|
stop: deployConfig.stopScript
|
|
6355
6408
|
? {
|
|
6356
|
-
image: (
|
|
6409
|
+
image: (_d = deployConfig.jobImage) !== null && _d !== void 0 ? _d : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
6357
6410
|
script: __spreadArray(__spreadArray([], __read(deployConfig.stopScript), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false),
|
|
6358
6411
|
variables: {},
|
|
6359
6412
|
}
|
|
@@ -6430,17 +6483,15 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
6430
6483
|
var base_1 = __nccwpck_require__(2024);
|
|
6431
6484
|
var types_1 = __nccwpck_require__(5781);
|
|
6432
6485
|
var createDockerTagDeployJobs = function (context) {
|
|
6433
|
-
var
|
|
6434
|
-
|
|
6435
|
-
return [];
|
|
6436
|
-
}
|
|
6486
|
+
var _a;
|
|
6487
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6437
6488
|
if (!(0, types_1.isOfDeployType)(deployConfig, "dockerTag")) {
|
|
6438
6489
|
// should not happen
|
|
6439
6490
|
throw new Error("deploy config is not dockerTag");
|
|
6440
6491
|
}
|
|
6441
6492
|
var tag = deployConfig.tag;
|
|
6442
6493
|
return (0, base_1.createDeployementJobs)(context, {
|
|
6443
|
-
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), [
|
|
6444
6495
|
"docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG",
|
|
6445
6496
|
"docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag),
|
|
6446
6497
|
"docker push $DOCKER_IMAGE:".concat(tag),
|
|
@@ -6552,32 +6603,34 @@ var context_1 = __nccwpck_require__(5875);
|
|
|
6552
6603
|
var utils_1 = __nccwpck_require__(2089);
|
|
6553
6604
|
var types_1 = __nccwpck_require__(5781);
|
|
6554
6605
|
var hasKubernetesCloudSQL = function (context) {
|
|
6555
|
-
var _a, _b;
|
|
6556
|
-
|
|
6557
|
-
|
|
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;
|
|
6558
6610
|
}
|
|
6559
6611
|
return false;
|
|
6560
6612
|
};
|
|
6561
6613
|
exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
|
|
6562
6614
|
var createKubernetesCloudsqlBaseValues = function (context) {
|
|
6563
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6564
|
-
|
|
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")) {
|
|
6565
6618
|
throw new Error("cannot get cloud sql config");
|
|
6566
6619
|
}
|
|
6567
|
-
var config = (
|
|
6620
|
+
var config = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql;
|
|
6568
6621
|
if (!config) {
|
|
6569
6622
|
throw new Error("cannot get cloud sql config");
|
|
6570
6623
|
}
|
|
6571
6624
|
var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
|
|
6572
6625
|
if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
|
|
6573
|
-
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);
|
|
6574
6627
|
return {
|
|
6575
6628
|
cloudsql: {
|
|
6576
6629
|
enabled: config.enabled,
|
|
6577
6630
|
dbUser: "postgres",
|
|
6578
6631
|
instanceConnectionName: instanceConnectionName,
|
|
6579
6632
|
proxyCredentials: proxyCredentials,
|
|
6580
|
-
fullDbName: (
|
|
6633
|
+
fullDbName: (_f = context.environment.envVars.KUBE_APP_NAME) !== null && _f !== void 0 ? _f : "",
|
|
6581
6634
|
},
|
|
6582
6635
|
};
|
|
6583
6636
|
}
|
|
@@ -6585,7 +6638,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
|
|
|
6585
6638
|
return {
|
|
6586
6639
|
cloudsql: {
|
|
6587
6640
|
enabled: config.enabled,
|
|
6588
|
-
dbUser: (
|
|
6641
|
+
dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
|
|
6589
6642
|
instanceConnectionName: config.instanceConnectionName,
|
|
6590
6643
|
proxyCredentials: proxyCredentials,
|
|
6591
6644
|
fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName),
|
|
@@ -6654,11 +6707,8 @@ var bashYaml_1 = __nccwpck_require__(4660);
|
|
|
6654
6707
|
var gitlab_1 = __nccwpck_require__(8490);
|
|
6655
6708
|
var ALL_VALUES_FILE = "__all_values.yml";
|
|
6656
6709
|
var createKubernetesDeployJobs = function (context) {
|
|
6657
|
-
var _a, _b;
|
|
6658
|
-
var deployConfig = context.
|
|
6659
|
-
if (deployConfig === false) {
|
|
6660
|
-
return [];
|
|
6661
|
-
}
|
|
6710
|
+
var _a, _b, _c;
|
|
6711
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
6662
6712
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
6663
6713
|
// should not happen
|
|
6664
6714
|
throw new Error("deploy config is not kubernetes");
|
|
@@ -6672,7 +6722,7 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
6672
6722
|
when: "always",
|
|
6673
6723
|
},
|
|
6674
6724
|
}
|
|
6675
|
-
: {})), { 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,
|
|
6676
6726
|
/** @deprecated */
|
|
6677
6727
|
BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID }) });
|
|
6678
6728
|
var clusterName = "kube-".concat(context.environment.fullName);
|
|
@@ -6838,7 +6888,8 @@ var shouldGoIntoSecrets = function (key, value) {
|
|
|
6838
6888
|
* we evalulate the actual values later, but want to store the secrets in kubernetes secrets
|
|
6839
6889
|
*/
|
|
6840
6890
|
var createKubeEnv = function (context) {
|
|
6841
|
-
|
|
6891
|
+
var _a;
|
|
6892
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
6842
6893
|
// should not happen
|
|
6843
6894
|
throw new Error("deploy config is not kubernetes");
|
|
6844
6895
|
}
|
|
@@ -6924,7 +6975,7 @@ var createAppConfig = function (context, application) {
|
|
|
6924
6975
|
var _a = application !== null && application !== void 0 ? application : {}, healthRoute = _a.healthRoute, command = _a.command, rest = __rest(_a, ["healthRoute", "command"]);
|
|
6925
6976
|
return (0, utils_1.mergeWithMergingArrays)({
|
|
6926
6977
|
host: context.environment.host,
|
|
6927
|
-
command: command !== null && command !== void 0 ? command : context.
|
|
6978
|
+
command: command !== null && command !== void 0 ? command : context.build.config.startCommand,
|
|
6928
6979
|
livenessProbe: {
|
|
6929
6980
|
httpGet: {
|
|
6930
6981
|
path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health",
|
|
@@ -6952,9 +7003,9 @@ var removeFalsy = function (record) {
|
|
|
6952
7003
|
}));
|
|
6953
7004
|
};
|
|
6954
7005
|
var createKubeValues = function (context) {
|
|
6955
|
-
var _a, _b;
|
|
6956
|
-
var deployConfig = context.
|
|
6957
|
-
if (deployConfig
|
|
7006
|
+
var _a, _b, _c;
|
|
7007
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
7008
|
+
if (!deployConfig) {
|
|
6958
7009
|
return [];
|
|
6959
7010
|
}
|
|
6960
7011
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
@@ -6964,14 +7015,14 @@ var createKubeValues = function (context) {
|
|
|
6964
7015
|
var values = deployConfig.values;
|
|
6965
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
|
|
6966
7017
|
// we only merge the rest of the values in
|
|
6967
|
-
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"]);
|
|
6968
7019
|
var env = (0, kubeEnv_1.createKubeEnv)(context);
|
|
6969
7020
|
var defaultKubeValues = (0, lodash_1.merge)({
|
|
6970
7021
|
env: env,
|
|
6971
7022
|
application: createAppConfig(context, application),
|
|
6972
7023
|
}, (0, cloudSql_1.hasKubernetesCloudSQL)(context)
|
|
6973
7024
|
? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context)
|
|
6974
|
-
: {}, ((
|
|
7025
|
+
: {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled)
|
|
6975
7026
|
? (0, mongodb_1.createMongodbBaseConfig)(context)
|
|
6976
7027
|
: {});
|
|
6977
7028
|
var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({ jobs: removeFalsy(jobs), cronjobs: removeFalsy(cronjobs) }, rest)));
|
|
@@ -7019,15 +7070,15 @@ var getMongodbReplicasetHost = function (context, index) {
|
|
|
7019
7070
|
return getMongodbHost(context, "".concat(fullAppname, "-mongodb-").concat(index, ".").concat(fullAppname, "-mongodb-headless"));
|
|
7020
7071
|
};
|
|
7021
7072
|
var createMongodbUrl = function (context, dbName) {
|
|
7022
|
-
var _a, _b;
|
|
7023
|
-
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")) {
|
|
7024
7075
|
throw new Error("can only createMongodbUrl on supported deploys");
|
|
7025
7076
|
}
|
|
7026
|
-
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;
|
|
7027
7078
|
var queryParams = undefined;
|
|
7028
7079
|
var hosts = "";
|
|
7029
7080
|
if ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset") {
|
|
7030
|
-
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)
|
|
7031
7082
|
.map(function (i) { return getMongodbReplicasetHost(context, i); })
|
|
7032
7083
|
.join(",");
|
|
7033
7084
|
queryParams = "replicaSet=rs0&authSource=admin";
|
|
@@ -7039,11 +7090,11 @@ var createMongodbUrl = function (context, dbName) {
|
|
|
7039
7090
|
return "mongodb://".concat(getCredentialString(context)).concat(hosts, "/").concat(dbName).concat(queryParams ? "?".concat(queryParams) : "");
|
|
7040
7091
|
};
|
|
7041
7092
|
var createMongoBackupDefaultConfig = function (context) {
|
|
7042
|
-
var _a;
|
|
7043
|
-
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")) {
|
|
7044
7095
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
7045
7096
|
}
|
|
7046
|
-
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;
|
|
7047
7098
|
var fullAppName = context.environment.envVars.KUBE_APP_NAME;
|
|
7048
7099
|
var backupEnabled = ["prod", "stage"].includes(context.environment.envType);
|
|
7049
7100
|
var hostToBackup;
|
|
@@ -7073,11 +7124,11 @@ var createMongoBackupDefaultConfig = function (context) {
|
|
|
7073
7124
|
};
|
|
7074
7125
|
};
|
|
7075
7126
|
var createMongodbBaseConfig = function (context) {
|
|
7076
|
-
var _a, _b;
|
|
7077
|
-
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")) {
|
|
7078
7129
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
7079
7130
|
}
|
|
7080
|
-
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;
|
|
7081
7132
|
return {
|
|
7082
7133
|
mongodb: {
|
|
7083
7134
|
enabled: true,
|
|
@@ -7092,7 +7143,7 @@ var createMongodbBaseConfig = function (context) {
|
|
|
7092
7143
|
backup: createMongoBackupDefaultConfig(context),
|
|
7093
7144
|
},
|
|
7094
7145
|
env: {
|
|
7095
|
-
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"
|
|
7096
7147
|
? { MONGO_OPLOG_URL: createMongodbUrl(context, "local") } // oplog only works with replicasets
|
|
7097
7148
|
: {})),
|
|
7098
7149
|
},
|
|
@@ -7148,8 +7199,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
7148
7199
|
exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
|
|
7149
7200
|
var sbom_1 = __nccwpck_require__(7038);
|
|
7150
7201
|
var sbomDeactivated = function (context) {
|
|
7151
|
-
return context.
|
|
7152
|
-
context.componentConfig.build.sbom === false;
|
|
7202
|
+
return context.build.config.type === "custom" && context.build.config.sbom === false;
|
|
7153
7203
|
};
|
|
7154
7204
|
exports.sbomDeactivated = sbomDeactivated;
|
|
7155
7205
|
var getDependencyTrackUploadScript = function (context) {
|
|
@@ -7234,7 +7284,7 @@ var isOfDeployType = function (t) {
|
|
|
7234
7284
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7235
7285
|
types[_i - 1] = arguments[_i];
|
|
7236
7286
|
}
|
|
7237
|
-
return t && types.includes(t.type);
|
|
7287
|
+
return t && types.includes(t.type) ? true : false;
|
|
7238
7288
|
};
|
|
7239
7289
|
exports.isOfDeployType = isOfDeployType;
|
|
7240
7290
|
//# sourceMappingURL=index.js.map
|
|
@@ -7270,7 +7320,8 @@ var getKubernetesNamespace = function (config, env) {
|
|
|
7270
7320
|
};
|
|
7271
7321
|
exports.getKubernetesNamespace = getKubernetesNamespace;
|
|
7272
7322
|
var contextIsStoppable = function (context) {
|
|
7273
|
-
var
|
|
7323
|
+
var _a;
|
|
7324
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
7274
7325
|
if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
7275
7326
|
return true;
|
|
7276
7327
|
}
|
|
@@ -7606,7 +7657,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7606
7657
|
};
|
|
7607
7658
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7608
7659
|
exports.createJobsForComponent = void 0;
|
|
7609
|
-
var lodash_1 = __nccwpck_require__(3255);
|
|
7610
7660
|
var build_1 = __nccwpck_require__(7862);
|
|
7611
7661
|
var context_1 = __nccwpck_require__(5875);
|
|
7612
7662
|
var deploy_1 = __nccwpck_require__(8483);
|
|
@@ -7619,18 +7669,17 @@ var injectDefaultVarsInCustomJobs = function (context, jobs) {
|
|
|
7619
7669
|
});
|
|
7620
7670
|
};
|
|
7621
7671
|
var getCustomJobs = function (context) {
|
|
7622
|
-
if (!context.
|
|
7672
|
+
if (!context.customJobs) {
|
|
7623
7673
|
return [];
|
|
7624
7674
|
}
|
|
7625
|
-
var rawJobs =
|
|
7626
|
-
? context.componentConfig.customJobs(context)
|
|
7627
|
-
: context.componentConfig.customJobs;
|
|
7675
|
+
var rawJobs = context.customJobs;
|
|
7628
7676
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
7629
7677
|
};
|
|
7630
7678
|
var createRawJobs = function (context) {
|
|
7631
|
-
var
|
|
7632
|
-
var
|
|
7633
|
-
|
|
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)
|
|
7634
7683
|
: [];
|
|
7635
7684
|
var customJobs = getCustomJobs(context);
|
|
7636
7685
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|
|
@@ -7642,7 +7691,7 @@ var createJobsForComponent = function (contextContext) { return __awaiter(void 0
|
|
|
7642
7691
|
case 0: return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(contextContext.config, contextContext.componentName)];
|
|
7643
7692
|
case 1:
|
|
7644
7693
|
packageManagerInfo = _a.sent();
|
|
7645
|
-
return [4 /*yield*/, (0, context_1.
|
|
7694
|
+
return [4 /*yield*/, (0, context_1.createComponentContext)(__assign(__assign({}, contextContext), { packageManagerInfo: packageManagerInfo }))];
|
|
7646
7695
|
case 2:
|
|
7647
7696
|
context = _a.sent();
|
|
7648
7697
|
return [2 /*return*/, createRawJobs(context).map(function (job) { return (__assign(__assign({}, job), { context: context })); })];
|