@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
|
@@ -2011,9 +2011,10 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
2011
2011
|
.action(function (_a) {
|
|
2012
2012
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
2013
2013
|
var _c, env, componentName, context, proxyInfo, DB_PASSWORD, DB_NAME, DB_USER, instanceName, localPort;
|
|
2014
|
+
var _d, _e;
|
|
2014
2015
|
var envComponent = _b.envComponent;
|
|
2015
|
-
return __generator(this, function (
|
|
2016
|
-
switch (
|
|
2016
|
+
return __generator(this, function (_f) {
|
|
2017
|
+
switch (_f.label) {
|
|
2017
2018
|
case 0:
|
|
2018
2019
|
_c = (0, getProjectConfig_1.parseChoice)(envComponent), env = _c.env, componentName = _c.componentName;
|
|
2019
2020
|
if (!componentName) {
|
|
@@ -2022,20 +2023,20 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
2022
2023
|
}
|
|
2023
2024
|
return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
|
|
2024
2025
|
case 1:
|
|
2025
|
-
context =
|
|
2026
|
+
context = _f.sent();
|
|
2026
2027
|
if (env === "review") {
|
|
2027
2028
|
vorpal.log("⚠️ connection string does not include mr information on review environments");
|
|
2028
2029
|
}
|
|
2029
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
2030
|
+
if (!(0, pipeline_1.isOfDeployType)((_d = context.deploy) === null || _d === void 0 ? void 0 : _d.config, "kubernetes")) return [3 /*break*/, 3];
|
|
2030
2031
|
return [4 /*yield*/, getProxyInfoForKubernetes(this, context)];
|
|
2031
2032
|
case 2:
|
|
2032
|
-
proxyInfo =
|
|
2033
|
+
proxyInfo = _f.sent();
|
|
2033
2034
|
return [3 /*break*/, 6];
|
|
2034
2035
|
case 3:
|
|
2035
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
2036
|
+
if (!(0, pipeline_1.isOfDeployType)((_e = context.deploy) === null || _e === void 0 ? void 0 : _e.config, "google-cloudrun")) return [3 /*break*/, 5];
|
|
2036
2037
|
return [4 /*yield*/, getProxyInfoForCloudRun(this, context)];
|
|
2037
2038
|
case 4:
|
|
2038
|
-
proxyInfo =
|
|
2039
|
+
proxyInfo = _f.sent();
|
|
2039
2040
|
return [3 /*break*/, 6];
|
|
2040
2041
|
case 5: throw new Error("unsupported environment");
|
|
2041
2042
|
case 6:
|
|
@@ -2047,7 +2048,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
2047
2048
|
message: "Local port: ",
|
|
2048
2049
|
})];
|
|
2049
2050
|
case 7:
|
|
2050
|
-
localPort = (
|
|
2051
|
+
localPort = (_f.sent()).localPort;
|
|
2051
2052
|
this.log("");
|
|
2052
2053
|
this.log("postgres-PW: ".concat(DB_PASSWORD));
|
|
2053
2054
|
this.log("");
|
|
@@ -2062,7 +2063,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
2062
2063
|
localPort: localPort,
|
|
2063
2064
|
})];
|
|
2064
2065
|
case 8:
|
|
2065
|
-
|
|
2066
|
+
_f.sent();
|
|
2066
2067
|
return [2 /*return*/];
|
|
2067
2068
|
}
|
|
2068
2069
|
});
|
|
@@ -2073,15 +2074,16 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
2073
2074
|
}); });
|
|
2074
2075
|
var getProxyInfoForKubernetes = function (vorpal, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2075
2076
|
var envVars, cloudSqlValues, DB_PASSWORD, DB_NAME, instanceName;
|
|
2076
|
-
|
|
2077
|
-
|
|
2077
|
+
var _a;
|
|
2078
|
+
return __generator(this, function (_b) {
|
|
2079
|
+
switch (_b.label) {
|
|
2078
2080
|
case 0:
|
|
2079
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
2081
|
+
if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
2080
2082
|
throw new Error("unsupported");
|
|
2081
2083
|
}
|
|
2082
2084
|
return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.environment.shortName, context.componentName)];
|
|
2083
2085
|
case 1:
|
|
2084
|
-
envVars =
|
|
2086
|
+
envVars = _b.sent();
|
|
2085
2087
|
cloudSqlValues = (0, pipeline_1.createKubernetesCloudsqlBaseValues)(context);
|
|
2086
2088
|
DB_PASSWORD = (envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD) || (envVars === null || envVars === void 0 ? void 0 : envVars.POSTGRESQL_PASSWORD);
|
|
2087
2089
|
DB_NAME = cloudSqlValues.cloudsql.fullDbName.toString();
|
|
@@ -2097,21 +2099,22 @@ var getProxyInfoForKubernetes = function (vorpal, context) { return __awaiter(vo
|
|
|
2097
2099
|
}); };
|
|
2098
2100
|
var getProxyInfoForCloudRun = function (vorpal, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2099
2101
|
var envVars, DB_PASSWORD, DB_USER, DB_NAME;
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
+
var _a, _b, _c;
|
|
2103
|
+
return __generator(this, function (_d) {
|
|
2104
|
+
switch (_d.label) {
|
|
2102
2105
|
case 0:
|
|
2103
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
2104
|
-
!context.
|
|
2106
|
+
if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun") ||
|
|
2107
|
+
!((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.cloudSql)) {
|
|
2105
2108
|
throw new Error("unsupported");
|
|
2106
2109
|
}
|
|
2107
2110
|
return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.environment.shortName, context.componentName)];
|
|
2108
2111
|
case 1:
|
|
2109
|
-
envVars =
|
|
2112
|
+
envVars = _d.sent();
|
|
2110
2113
|
DB_PASSWORD = envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD;
|
|
2111
2114
|
DB_USER = envVars === null || envVars === void 0 ? void 0 : envVars.DB_USER;
|
|
2112
2115
|
DB_NAME = context.environment.envVars.DB_NAME.toString();
|
|
2113
2116
|
return [2 /*return*/, {
|
|
2114
|
-
instanceName: context.
|
|
2117
|
+
instanceName: (_c = context.deploy) === null || _c === void 0 ? void 0 : _c.config.cloudSql.instanceConnectionName,
|
|
2115
2118
|
DB_PASSWORD: DB_PASSWORD,
|
|
2116
2119
|
DB_NAME: DB_NAME,
|
|
2117
2120
|
DB_USER: DB_USER,
|
|
@@ -3694,25 +3697,26 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
3694
3697
|
.action(function (_a) {
|
|
3695
3698
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
3696
3699
|
var _c, env, componentName, context;
|
|
3700
|
+
var _d, _e;
|
|
3697
3701
|
var envComponent = _b.envComponent;
|
|
3698
|
-
return __generator(this, function (
|
|
3699
|
-
switch (
|
|
3702
|
+
return __generator(this, function (_f) {
|
|
3703
|
+
switch (_f.label) {
|
|
3700
3704
|
case 0:
|
|
3701
3705
|
_c = (0, getProjectConfig_1.parseChoice)(envComponent), env = _c.env, componentName = _c.componentName;
|
|
3702
3706
|
return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
|
|
3703
3707
|
case 1:
|
|
3704
|
-
context =
|
|
3705
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
3708
|
+
context = _f.sent();
|
|
3709
|
+
if (!(0, pipeline_1.isOfDeployType)((_d = context.deploy) === null || _d === void 0 ? void 0 : _d.config, "kubernetes")) return [3 /*break*/, 3];
|
|
3706
3710
|
return [4 /*yield*/, (0, openKubernetesDashboards_1.openGoogleCloudKubernetesDashboard)(this, context)];
|
|
3707
3711
|
case 2:
|
|
3708
|
-
|
|
3709
|
-
|
|
3712
|
+
_f.sent();
|
|
3713
|
+
_f.label = 3;
|
|
3710
3714
|
case 3:
|
|
3711
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
3715
|
+
if (!(0, pipeline_1.isOfDeployType)((_e = context.deploy) === null || _e === void 0 ? void 0 : _e.config, "google-cloudrun")) return [3 /*break*/, 5];
|
|
3712
3716
|
return [4 /*yield*/, (0, openCloudRunDashboards_1.openGoogleCloudRunDashboard)(this, context)];
|
|
3713
3717
|
case 4:
|
|
3714
|
-
|
|
3715
|
-
|
|
3718
|
+
_f.sent();
|
|
3719
|
+
_f.label = 5;
|
|
3716
3720
|
case 5: return [2 /*return*/];
|
|
3717
3721
|
}
|
|
3718
3722
|
});
|
|
@@ -4358,10 +4362,11 @@ var kubePortForward = function (cmd, envComponent) { return __awaiter(void 0, vo
|
|
|
4358
4362
|
}); };
|
|
4359
4363
|
var cloudRunPortForward = function (cmd, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4360
4364
|
var fullName, serviceName, mr, _a, projectId, region, command;
|
|
4361
|
-
|
|
4362
|
-
|
|
4365
|
+
var _b;
|
|
4366
|
+
return __generator(this, function (_c) {
|
|
4367
|
+
switch (_c.label) {
|
|
4363
4368
|
case 0:
|
|
4364
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
4369
|
+
if (!(0, pipeline_1.isOfDeployType)((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config, "google-cloudrun")) {
|
|
4365
4370
|
throw new Error("not cloud run");
|
|
4366
4371
|
}
|
|
4367
4372
|
fullName = context.environment.fullName;
|
|
@@ -4373,18 +4378,18 @@ var cloudRunPortForward = function (cmd, context) { return __awaiter(void 0, voi
|
|
|
4373
4378
|
message: "Which mr 🤔 ",
|
|
4374
4379
|
})];
|
|
4375
4380
|
case 1:
|
|
4376
|
-
mr = (
|
|
4381
|
+
mr = (_c.sent()).mr;
|
|
4377
4382
|
// poor mans solution
|
|
4378
4383
|
serviceName = serviceName
|
|
4379
4384
|
.toString()
|
|
4380
4385
|
.replace("-review-", "-review-mr" + mr + "-");
|
|
4381
|
-
|
|
4386
|
+
_c.label = 2;
|
|
4382
4387
|
case 2:
|
|
4383
|
-
_a = context.
|
|
4388
|
+
_a = context.deploy.config, projectId = _a.projectId, region = _a.region;
|
|
4384
4389
|
command = "gcloud beta run services proxy ".concat(serviceName, " --project ").concat(projectId, " --region ").concat(region);
|
|
4385
4390
|
return [4 /*yield*/, (0, portForwards_1.startPortForwardCommand)("cloudRun/".concat(serviceName), command)];
|
|
4386
4391
|
case 3:
|
|
4387
|
-
|
|
4392
|
+
_c.sent();
|
|
4388
4393
|
(0, open_1.default)("http://localhost:8080");
|
|
4389
4394
|
return [2 /*return*/];
|
|
4390
4395
|
}
|
|
@@ -4403,25 +4408,26 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
4403
4408
|
.action(function (_a) {
|
|
4404
4409
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
4405
4410
|
var _c, env, componentName, context;
|
|
4411
|
+
var _d, _e;
|
|
4406
4412
|
var envComponent = _b.envComponent;
|
|
4407
|
-
return __generator(this, function (
|
|
4408
|
-
switch (
|
|
4413
|
+
return __generator(this, function (_f) {
|
|
4414
|
+
switch (_f.label) {
|
|
4409
4415
|
case 0:
|
|
4410
4416
|
_c = (0, parseChoice_1.parseChoice)(envComponent), env = _c.env, componentName = _c.componentName;
|
|
4411
4417
|
return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
|
|
4412
4418
|
case 1:
|
|
4413
|
-
context =
|
|
4414
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
4419
|
+
context = _f.sent();
|
|
4420
|
+
if (!(0, pipeline_1.isOfDeployType)((_d = context.deploy) === null || _d === void 0 ? void 0 : _d.config, "kubernetes")) return [3 /*break*/, 3];
|
|
4415
4421
|
return [4 /*yield*/, kubePortForward(this, envComponent)];
|
|
4416
4422
|
case 2:
|
|
4417
|
-
|
|
4418
|
-
|
|
4423
|
+
_f.sent();
|
|
4424
|
+
_f.label = 3;
|
|
4419
4425
|
case 3:
|
|
4420
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
4426
|
+
if (!(0, pipeline_1.isOfDeployType)((_e = context.deploy) === null || _e === void 0 ? void 0 : _e.config, "google-cloudrun")) return [3 /*break*/, 5];
|
|
4421
4427
|
return [4 /*yield*/, cloudRunPortForward(this, context)];
|
|
4422
4428
|
case 4:
|
|
4423
|
-
|
|
4424
|
-
|
|
4429
|
+
_f.sent();
|
|
4430
|
+
_f.label = 5;
|
|
4425
4431
|
case 5: return [2 /*return*/];
|
|
4426
4432
|
}
|
|
4427
4433
|
});
|
|
@@ -5284,13 +5290,14 @@ var gitlab_1 = __nccwpck_require__(12927);
|
|
|
5284
5290
|
var setupCloudRun = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
5285
5291
|
var config, suffix;
|
|
5286
5292
|
var _a;
|
|
5287
|
-
|
|
5288
|
-
|
|
5293
|
+
var _b, _c;
|
|
5294
|
+
return __generator(this, function (_d) {
|
|
5295
|
+
switch (_d.label) {
|
|
5289
5296
|
case 0:
|
|
5290
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
5297
|
+
if (!(0, pipeline_1.isOfDeployType)((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config, "google-cloudrun")) {
|
|
5291
5298
|
throw new Error("deploy config is not of type 'google-cloudrun'");
|
|
5292
5299
|
}
|
|
5293
|
-
config = context.
|
|
5300
|
+
config = (_c = context.deploy) === null || _c === void 0 ? void 0 : _c.config;
|
|
5294
5301
|
// enable services
|
|
5295
5302
|
instance.log("enable required services...");
|
|
5296
5303
|
return [4 /*yield*/, (0, enableServices_1.enableGCloudServices)(__spreadArray([
|
|
@@ -5302,11 +5309,11 @@ var setupCloudRun = function (instance, context) { return __awaiter(void 0, void
|
|
|
5302
5309
|
? ["sqladmin.googleapis.com", "sql-component.googleapis.com"]
|
|
5303
5310
|
: [])), false), config)];
|
|
5304
5311
|
case 1:
|
|
5305
|
-
|
|
5312
|
+
_d.sent();
|
|
5306
5313
|
instance.log("upsert artifacts registry...");
|
|
5307
5314
|
return [4 /*yield*/, (0, artifactsRegistry_1.upsertGcloudArtifactsRegistry)(config)];
|
|
5308
5315
|
case 2:
|
|
5309
|
-
|
|
5316
|
+
_d.sent();
|
|
5310
5317
|
instance.log("upsert deploy service account...");
|
|
5311
5318
|
return [4 /*yield*/, (0, serviceAccounts_1.upsertGcloudServiceAccountAndSaveSecret)(instance, context, {
|
|
5312
5319
|
projectId: config.projectId,
|
|
@@ -5322,7 +5329,7 @@ var setupCloudRun = function (instance, context) { return __awaiter(void 0, void
|
|
|
5322
5329
|
], __read((config.cloudSql ? ["roles/cloudsql.admin"] : [])), false),
|
|
5323
5330
|
}, pipeline_1.GCLOUD_DEPLOY_CREDENTIALS_KEY)];
|
|
5324
5331
|
case 3:
|
|
5325
|
-
|
|
5332
|
+
_d.sent();
|
|
5326
5333
|
// gcloud run automatically gives us a hostname
|
|
5327
5334
|
// but the pipeline need to know it before deployment
|
|
5328
5335
|
// so we get this through some magic and add this as a ci/cd variable
|
|
@@ -5330,14 +5337,14 @@ var setupCloudRun = function (instance, context) { return __awaiter(void 0, void
|
|
|
5330
5337
|
instance.log("get service domain suffix... that might take a while initially");
|
|
5331
5338
|
return [4 /*yield*/, (0, getCloudRunDomainSuffix_1.getCloudRunDomainSuffix)(config)];
|
|
5332
5339
|
case 4:
|
|
5333
|
-
suffix =
|
|
5340
|
+
suffix = _d.sent();
|
|
5334
5341
|
instance.log("domain suffix: " + suffix);
|
|
5335
5342
|
return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, (_a = {},
|
|
5336
5343
|
_a[pipeline_1.GCLOUD_RUN_CANONICAL_HOST_SUFFIX] = suffix,
|
|
5337
5344
|
_a), context.environment.shortName, context.componentName, false, // backup
|
|
5338
5345
|
false)];
|
|
5339
5346
|
case 5:
|
|
5340
|
-
|
|
5347
|
+
_d.sent();
|
|
5341
5348
|
return [2 /*return*/];
|
|
5342
5349
|
}
|
|
5343
5350
|
});
|
|
@@ -5395,8 +5402,9 @@ var setupCloudRun_1 = __nccwpck_require__(1082);
|
|
|
5395
5402
|
var setupKubernetes_1 = __nccwpck_require__(88412);
|
|
5396
5403
|
var setupContext = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
5397
5404
|
var deployConfig;
|
|
5398
|
-
|
|
5399
|
-
|
|
5405
|
+
var _a, _b;
|
|
5406
|
+
return __generator(this, function (_c) {
|
|
5407
|
+
switch (_c.label) {
|
|
5400
5408
|
case 0:
|
|
5401
5409
|
instance.log("");
|
|
5402
5410
|
instance.log("==================================================================================");
|
|
@@ -5406,18 +5414,18 @@ var setupContext = function (instance, context) { return __awaiter(void 0, void
|
|
|
5406
5414
|
context.componentName +
|
|
5407
5415
|
"...");
|
|
5408
5416
|
instance.log("");
|
|
5409
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
5417
|
+
if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun")) return [3 /*break*/, 2];
|
|
5410
5418
|
return [4 /*yield*/, (0, setupCloudRun_1.setupCloudRun)(instance, context)];
|
|
5411
5419
|
case 1:
|
|
5412
|
-
|
|
5413
|
-
|
|
5420
|
+
_c.sent();
|
|
5421
|
+
_c.label = 2;
|
|
5414
5422
|
case 2:
|
|
5415
|
-
deployConfig = context.
|
|
5423
|
+
deployConfig = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config;
|
|
5416
5424
|
if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) return [3 /*break*/, 4];
|
|
5417
5425
|
return [4 /*yield*/, (0, setupKubernetes_1.setupKubernetes)(instance, context)];
|
|
5418
5426
|
case 3:
|
|
5419
|
-
|
|
5420
|
-
|
|
5427
|
+
_c.sent();
|
|
5428
|
+
_c.label = 4;
|
|
5421
5429
|
case 4:
|
|
5422
5430
|
instance.log("");
|
|
5423
5431
|
instance.log("✅ " +
|
|
@@ -5488,19 +5496,20 @@ var gitlab_1 = __nccwpck_require__(12927);
|
|
|
5488
5496
|
var ensureNamespace_1 = __importDefault(__nccwpck_require__(81349));
|
|
5489
5497
|
var setupKubernetes = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
5490
5498
|
var deployConfig, projectId, deploy_tokens, fullName, namespace, serviceAccountName, KUBE_URL, e_1, secretName, KUBE_CA_PEM, KUBE_TOKEN, vars, missing;
|
|
5491
|
-
|
|
5492
|
-
|
|
5499
|
+
var _a;
|
|
5500
|
+
return __generator(this, function (_b) {
|
|
5501
|
+
switch (_b.label) {
|
|
5493
5502
|
case 0:
|
|
5494
|
-
deployConfig = context.
|
|
5503
|
+
deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
5495
5504
|
if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
5496
5505
|
throw new Error("cannot run setupKubernetes on non-kubernetes deployments");
|
|
5497
5506
|
}
|
|
5498
5507
|
return [4 /*yield*/, (0, gitlab_1.getProjectInfo)(instance)];
|
|
5499
5508
|
case 1:
|
|
5500
|
-
projectId = (
|
|
5509
|
+
projectId = (_b.sent()).id;
|
|
5501
5510
|
return [4 /*yield*/, (0, gitlab_1.doGitlabRequest)(instance, "projects/".concat(projectId, "/deploy_tokens"))];
|
|
5502
5511
|
case 2:
|
|
5503
|
-
deploy_tokens =
|
|
5512
|
+
deploy_tokens = _b.sent();
|
|
5504
5513
|
if (!!deploy_tokens.find(function (v) { return v.name === "gitlab-deploy-token"; })) return [3 /*break*/, 4];
|
|
5505
5514
|
instance.log("I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project.");
|
|
5506
5515
|
return [4 /*yield*/, (0, gitlab_1.doGitlabRequest)(instance, "projects/".concat(projectId, "/deploy_tokens"), {
|
|
@@ -5509,19 +5518,19 @@ var setupKubernetes = function (instance, context) { return __awaiter(void 0, vo
|
|
|
5509
5518
|
scopes: ["read_registry"],
|
|
5510
5519
|
}, "POST")];
|
|
5511
5520
|
case 3:
|
|
5512
|
-
|
|
5513
|
-
|
|
5521
|
+
_b.sent();
|
|
5522
|
+
_b.label = 4;
|
|
5514
5523
|
case 4:
|
|
5515
5524
|
fullName = (0, pipeline_1.getFullKubernetesClusterName)(deployConfig.cluster);
|
|
5516
5525
|
instance.log("cluster: ".concat(fullName));
|
|
5517
5526
|
return [4 /*yield*/, (0, cluster_1.connectToCluster)(fullName)];
|
|
5518
5527
|
case 5:
|
|
5519
|
-
|
|
5528
|
+
_b.sent();
|
|
5520
5529
|
instance.log("");
|
|
5521
5530
|
instance.log("ensuring namespace ...");
|
|
5522
5531
|
return [4 /*yield*/, (0, ensureNamespace_1.default)(context)];
|
|
5523
5532
|
case 6:
|
|
5524
|
-
namespace =
|
|
5533
|
+
namespace = _b.sent();
|
|
5525
5534
|
instance.log("Namespace " + namespace + " created / updated!");
|
|
5526
5535
|
instance.log("");
|
|
5527
5536
|
//$.verbose = true;
|
|
@@ -5531,43 +5540,43 @@ var setupKubernetes = function (instance, context) { return __awaiter(void 0, vo
|
|
|
5531
5540
|
serviceAccountName = "cl-".concat(context.componentName, "-deploy");
|
|
5532
5541
|
return [4 /*yield*/, (0, child_process_promise_1.exec)("TERM=dumb kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'").then(function (s) { return s.stdout.trim(); })];
|
|
5533
5542
|
case 7:
|
|
5534
|
-
KUBE_URL =
|
|
5535
|
-
|
|
5543
|
+
KUBE_URL = _b.sent();
|
|
5544
|
+
_b.label = 8;
|
|
5536
5545
|
case 8:
|
|
5537
|
-
|
|
5546
|
+
_b.trys.push([8, 12, , 13]);
|
|
5538
5547
|
return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl delete serviceaccount --namespace ".concat(namespace, " ").concat(serviceAccountName))];
|
|
5539
5548
|
case 9:
|
|
5540
|
-
|
|
5549
|
+
_b.sent();
|
|
5541
5550
|
return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl delete rolebinding --namespace ".concat(namespace, " ").concat(serviceAccountName))];
|
|
5542
5551
|
case 10:
|
|
5543
|
-
|
|
5552
|
+
_b.sent();
|
|
5544
5553
|
return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl delete role --namespace ".concat(namespace, " ").concat(serviceAccountName))];
|
|
5545
5554
|
case 11:
|
|
5546
|
-
|
|
5555
|
+
_b.sent();
|
|
5547
5556
|
return [3 /*break*/, 13];
|
|
5548
5557
|
case 12:
|
|
5549
|
-
e_1 =
|
|
5558
|
+
e_1 = _b.sent();
|
|
5550
5559
|
return [3 /*break*/, 13];
|
|
5551
5560
|
case 13: return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl create serviceaccount --namespace ".concat(namespace, " ").concat(serviceAccountName))];
|
|
5552
5561
|
case 14:
|
|
5553
|
-
|
|
5562
|
+
_b.sent();
|
|
5554
5563
|
// upsert role in the ns
|
|
5555
5564
|
return [4 /*yield*/, (0, child_process_promise_1.exec)("cat <<EOF | kubectl apply -f -\nkind: Role\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n namespace: ".concat(namespace, "\n name: ").concat(serviceAccountName, "\nrules:\n- apiGroups: [\"\", \"extensions\", \"apps\", \"networking.k8s.io\", \"batch\", \"autoscaling\", \"rbac.authorization.k8s.io\",\"snapshot.storage.k8s.io\"]\n resources: [\"deployments\", \"replicasets\", \"statefulsets\", \"pods\", \"secrets\", \"configmaps\", \"services\", \"ingresses\", \"serviceaccounts\", \"roles\", \"rolebindings\", \"jobs\", \"cronjobs\", \"horizontalpodautoscalers\", \"persistentvolumeclaims\", \"volumesnapshots\"]\n verbs: [\"*\"]\n---\nkind: RoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n name: ").concat(serviceAccountName, "\n namespace: ").concat(namespace, "\nsubjects:\n - kind: ServiceAccount\n name: ").concat(serviceAccountName, "\n namespace: ").concat(namespace, "\nroleRef:\n kind: Role\n name: ").concat(serviceAccountName, "\n apiGroup: rbac.authorization.k8s.io\nEOF\n"))];
|
|
5556
5565
|
case 15:
|
|
5557
5566
|
// upsert role in the ns
|
|
5558
|
-
|
|
5567
|
+
_b.sent();
|
|
5559
5568
|
secretName = "".concat(serviceAccountName, "-secret");
|
|
5560
5569
|
// create token for the service account
|
|
5561
5570
|
return [4 /*yield*/, (0, child_process_promise_1.exec)("\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n name: ".concat(secretName, "\n namespace: ").concat(namespace, "\n annotations:\n kubernetes.io/service-account.name: ").concat(serviceAccountName, "\ntype: kubernetes.io/service-account-token\nEOF\n "))];
|
|
5562
5571
|
case 16:
|
|
5563
5572
|
// create token for the service account
|
|
5564
|
-
|
|
5573
|
+
_b.sent();
|
|
5565
5574
|
return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl get secret ".concat(secretName, " --namespace ").concat(namespace, " -o jsonpath=\"{['data']['ca\\.crt']}\"")).then(function (c) { return c.stdout.trim(); })];
|
|
5566
5575
|
case 17:
|
|
5567
|
-
KUBE_CA_PEM =
|
|
5576
|
+
KUBE_CA_PEM = _b.sent();
|
|
5568
5577
|
return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl get secret ".concat(secretName, " --namespace ").concat(namespace, " -o jsonpath=\"{['data']['token']}\" | base64 --decode")).then(function (c) { return c.stdout.trim(); })];
|
|
5569
5578
|
case 18:
|
|
5570
|
-
KUBE_TOKEN =
|
|
5579
|
+
KUBE_TOKEN = _b.sent();
|
|
5571
5580
|
vars = {
|
|
5572
5581
|
KUBE_TOKEN: KUBE_TOKEN,
|
|
5573
5582
|
KUBE_CA_PEM: KUBE_CA_PEM,
|
|
@@ -5586,7 +5595,7 @@ var setupKubernetes = function (instance, context) { return __awaiter(void 0, vo
|
|
|
5586
5595
|
instance.log("pusing secrets to gitlab...");
|
|
5587
5596
|
return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, vars, context.environment.shortName, context.componentName, false)];
|
|
5588
5597
|
case 19:
|
|
5589
|
-
|
|
5598
|
+
_b.sent();
|
|
5590
5599
|
instance.log("done!");
|
|
5591
5600
|
return [2 /*return*/];
|
|
5592
5601
|
}
|
|
@@ -5856,20 +5865,21 @@ var cluster_1 = __nccwpck_require__(62774);
|
|
|
5856
5865
|
function default_1(envComponent) {
|
|
5857
5866
|
return __awaiter(this, void 0, void 0, function () {
|
|
5858
5867
|
var _a, env, componentName, context, cluster, connectedClusterName, shouldContinue;
|
|
5859
|
-
|
|
5860
|
-
|
|
5868
|
+
var _b, _c;
|
|
5869
|
+
return __generator(this, function (_d) {
|
|
5870
|
+
switch (_d.label) {
|
|
5861
5871
|
case 0:
|
|
5862
5872
|
_a = (0, getProjectConfig_1.parseChoice)(envComponent), env = _a.env, componentName = _a.componentName;
|
|
5863
5873
|
return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
|
|
5864
5874
|
case 1:
|
|
5865
|
-
context =
|
|
5866
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
5875
|
+
context = _d.sent();
|
|
5876
|
+
if (!(0, pipeline_1.isOfDeployType)((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config, "kubernetes")) {
|
|
5867
5877
|
throw new Error("can't ensure cluster for non-kubernetes deployments");
|
|
5868
5878
|
}
|
|
5869
|
-
cluster = (0, pipeline_1.getFullKubernetesClusterName)(context.
|
|
5879
|
+
cluster = (0, pipeline_1.getFullKubernetesClusterName)((_c = context.deploy) === null || _c === void 0 ? void 0 : _c.config.cluster);
|
|
5870
5880
|
return [4 /*yield*/, (0, cluster_1.getCurrentConnectedClusterName)()];
|
|
5871
5881
|
case 2:
|
|
5872
|
-
connectedClusterName =
|
|
5882
|
+
connectedClusterName = _d.sent();
|
|
5873
5883
|
if (!(cluster !== connectedClusterName)) return [3 /*break*/, 6];
|
|
5874
5884
|
this.log("you are currently connected to cluster '".concat(connectedClusterName, "'"));
|
|
5875
5885
|
this.log("but the project requires cluster '".concat(cluster, "'"));
|
|
@@ -5880,15 +5890,15 @@ function default_1(envComponent) {
|
|
|
5880
5890
|
message: "Do you want to connect to '".concat(cluster, "'?"),
|
|
5881
5891
|
})];
|
|
5882
5892
|
case 3:
|
|
5883
|
-
shouldContinue = (
|
|
5893
|
+
shouldContinue = (_d.sent()).shouldContinue;
|
|
5884
5894
|
if (!!shouldContinue) return [3 /*break*/, 4];
|
|
5885
5895
|
this.log("abort");
|
|
5886
5896
|
return [3 /*break*/, 6];
|
|
5887
5897
|
case 4: return [4 /*yield*/, (0, cluster_1.connectToCluster)(cluster)];
|
|
5888
5898
|
case 5:
|
|
5889
|
-
|
|
5899
|
+
_d.sent();
|
|
5890
5900
|
this.log("connected to cluster '".concat(cluster, "'"));
|
|
5891
|
-
|
|
5901
|
+
_d.label = 6;
|
|
5892
5902
|
case 6: return [2 /*return*/];
|
|
5893
5903
|
}
|
|
5894
5904
|
});
|
|
@@ -6917,19 +6927,20 @@ var pipeline_1 = __nccwpck_require__(10603);
|
|
|
6917
6927
|
var openDashboard_1 = __nccwpck_require__(77056);
|
|
6918
6928
|
var openGoogleCloudRunDashboard = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6919
6929
|
var fullName, _a, region, projectId;
|
|
6920
|
-
|
|
6921
|
-
|
|
6930
|
+
var _b;
|
|
6931
|
+
return __generator(this, function (_c) {
|
|
6932
|
+
switch (_c.label) {
|
|
6922
6933
|
case 0:
|
|
6923
|
-
if (!(0, pipeline_1.isOfDeployType)(context.
|
|
6934
|
+
if (!(0, pipeline_1.isOfDeployType)((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config, "google-cloudrun")) {
|
|
6924
6935
|
throw new Error("deploy type is not google-cloudrun ");
|
|
6925
6936
|
}
|
|
6926
6937
|
fullName = context.environment.fullName;
|
|
6927
|
-
_a = context.
|
|
6938
|
+
_a = context.deploy.config, region = _a.region, projectId = _a.projectId;
|
|
6928
6939
|
return [4 /*yield*/, (0, openDashboard_1.openGoogleCloudDashboard)(instance, "run/detail/".concat(region, "/").concat(fullName, "/metrics"), {
|
|
6929
6940
|
project: projectId,
|
|
6930
6941
|
})];
|
|
6931
6942
|
case 1:
|
|
6932
|
-
|
|
6943
|
+
_c.sent();
|
|
6933
6944
|
return [2 /*return*/];
|
|
6934
6945
|
}
|
|
6935
6946
|
});
|
|
@@ -7726,10 +7737,11 @@ var pipeline_1 = __nccwpck_require__(10603);
|
|
|
7726
7737
|
var openDashboard_1 = __nccwpck_require__(77056);
|
|
7727
7738
|
var openGoogleCloudLogs = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7728
7739
|
var deployConfig, namespace, cluster, resource;
|
|
7729
|
-
|
|
7730
|
-
|
|
7740
|
+
var _a;
|
|
7741
|
+
return __generator(this, function (_b) {
|
|
7742
|
+
switch (_b.label) {
|
|
7731
7743
|
case 0:
|
|
7732
|
-
deployConfig = context.
|
|
7744
|
+
deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
7733
7745
|
if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
7734
7746
|
throw new Error("context is not of type kubernetes");
|
|
7735
7747
|
}
|
|
@@ -7744,7 +7756,7 @@ var openGoogleCloudLogs = function (instance, context) { return __awaiter(void 0
|
|
|
7744
7756
|
resource: resource,
|
|
7745
7757
|
})];
|
|
7746
7758
|
case 1:
|
|
7747
|
-
|
|
7759
|
+
_b.sent();
|
|
7748
7760
|
return [2 /*return*/];
|
|
7749
7761
|
}
|
|
7750
7762
|
});
|
|
@@ -7752,10 +7764,11 @@ var openGoogleCloudLogs = function (instance, context) { return __awaiter(void 0
|
|
|
7752
7764
|
exports.openGoogleCloudLogs = openGoogleCloudLogs;
|
|
7753
7765
|
var openGoogleCloudKubernetesDashboard = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7754
7766
|
var deployConfig, namespace, cluster, pageState;
|
|
7755
|
-
|
|
7756
|
-
|
|
7767
|
+
var _a;
|
|
7768
|
+
return __generator(this, function (_b) {
|
|
7769
|
+
switch (_b.label) {
|
|
7757
7770
|
case 0:
|
|
7758
|
-
deployConfig = context.
|
|
7771
|
+
deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
7759
7772
|
if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
7760
7773
|
throw new Error("context is not of type kubernetes");
|
|
7761
7774
|
}
|
|
@@ -7770,7 +7783,7 @@ var openGoogleCloudKubernetesDashboard = function (instance, context) { return _
|
|
|
7770
7783
|
pageState: pageState,
|
|
7771
7784
|
})];
|
|
7772
7785
|
case 1:
|
|
7773
|
-
|
|
7786
|
+
_b.sent();
|
|
7774
7787
|
return [2 /*return*/];
|
|
7775
7788
|
}
|
|
7776
7789
|
});
|
|
@@ -9691,17 +9704,19 @@ var createAppBuildJob = function (context, _a) {
|
|
|
9691
9704
|
image: (0, __1.getRunnerImage)("jobs-default"),
|
|
9692
9705
|
needs: [],
|
|
9693
9706
|
cache: [],
|
|
9694
|
-
variables: __assign(__assign(__assign(__assign({}, (variables !== null && variables !== void 0 ? variables : {})), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), ((_b = context.
|
|
9695
|
-
runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), (runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {})), ((_c = context.
|
|
9707
|
+
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 : {})),
|
|
9708
|
+
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 : {})),
|
|
9696
9709
|
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((context.componentConfig.dotEnv === true // don't build when set to `local`
|
|
9697
9710
|
? (0, writeDotEnv_1.writeDotEnv)(context)
|
|
9698
|
-
: [])), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context.
|
|
9699
|
-
"cd ".concat(context.
|
|
9711
|
+
: [])), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
|
|
9712
|
+
"cd ".concat(context.build.dir)
|
|
9700
9713
|
], false), __read(((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : [])), false),
|
|
9701
9714
|
artifacts: {
|
|
9702
|
-
paths: [(0, path_1.join)(context.
|
|
9715
|
+
paths: [(0, path_1.join)(context.build.dir, "__build_info.json")],
|
|
9703
9716
|
reports: {
|
|
9704
|
-
junit: (_f = (_e = context.
|
|
9717
|
+
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) {
|
|
9718
|
+
return (0, path_1.join)(context.build.dir, p);
|
|
9719
|
+
}),
|
|
9705
9720
|
},
|
|
9706
9721
|
},
|
|
9707
9722
|
}, def);
|
|
@@ -9849,7 +9864,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
9849
9864
|
exports.writeBuildInfo = void 0;
|
|
9850
9865
|
var writeBuildInfo = function (context) {
|
|
9851
9866
|
return [
|
|
9852
|
-
"echo '{\"id\":\"".concat(context.environment.envVars.BUILD_INFO_BUILD_ID, "\",\"time\":\"").concat(context.environment.envVars.BUILD_INFO_BUILD_TIME, "\"}' > ").concat(context.
|
|
9867
|
+
"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"),
|
|
9853
9868
|
];
|
|
9854
9869
|
};
|
|
9855
9870
|
exports.writeBuildInfo = writeBuildInfo;
|
|
@@ -9901,7 +9916,7 @@ var writeDotEnv = function (context) {
|
|
|
9901
9916
|
})
|
|
9902
9917
|
.join("\n");
|
|
9903
9918
|
return [
|
|
9904
|
-
"cat <<EOF > ".concat(context.
|
|
9919
|
+
"cat <<EOF > ".concat(context.build.dir, "/.env\n").concat(keyValueString, "\nEOF"),
|
|
9905
9920
|
];
|
|
9906
9921
|
};
|
|
9907
9922
|
exports.writeDotEnv = writeDotEnv;
|
|
@@ -9953,7 +9968,7 @@ var RUNNER_BUILD_VARIABLES = {
|
|
|
9953
9968
|
};
|
|
9954
9969
|
var createCustomBuildJobs = function (context) {
|
|
9955
9970
|
var _a, _b, _c;
|
|
9956
|
-
var buildConfig = context.
|
|
9971
|
+
var buildConfig = context.build.config;
|
|
9957
9972
|
if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
|
|
9958
9973
|
throw new Error("deploy config is not custom");
|
|
9959
9974
|
}
|
|
@@ -9967,10 +9982,10 @@ var createCustomBuildJobs = function (context) {
|
|
|
9967
9982
|
script: __spreadArray([], __read(((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : [])), false),
|
|
9968
9983
|
artifacts: {
|
|
9969
9984
|
paths: __spreadArray([
|
|
9970
|
-
(0, path_1.join)(context.
|
|
9971
|
-
(0, path_1.join)(context.
|
|
9985
|
+
(0, path_1.join)(context.build.dir, "__build_info.json"),
|
|
9986
|
+
(0, path_1.join)(context.build.dir, "dist")
|
|
9972
9987
|
], __read(((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
|
|
9973
|
-
return (0, path_1.join)(context.
|
|
9988
|
+
return (0, path_1.join)(context.build.dir, path);
|
|
9974
9989
|
})) !== null && _c !== void 0 ? _c : [])), false),
|
|
9975
9990
|
expire_in: "1 day",
|
|
9976
9991
|
},
|
|
@@ -10087,12 +10102,12 @@ var createCustomTestJobs = function (context) {
|
|
|
10087
10102
|
if (context.trigger === "taggedRelease") {
|
|
10088
10103
|
return [];
|
|
10089
10104
|
}
|
|
10090
|
-
var buildConfig = context.
|
|
10105
|
+
var buildConfig = context.build.config;
|
|
10091
10106
|
if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
|
|
10092
10107
|
throw new Error("deploy config is not custom");
|
|
10093
10108
|
}
|
|
10094
10109
|
var base = {
|
|
10095
|
-
variables: __assign(__assign({ APP_PATH: context.
|
|
10110
|
+
variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
|
|
10096
10111
|
runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
|
|
10097
10112
|
services: buildConfig.jobServices,
|
|
10098
10113
|
cache: buildConfig.jobCache,
|
|
@@ -10101,11 +10116,11 @@ var createCustomTestJobs = function (context) {
|
|
|
10101
10116
|
envMode: "none",
|
|
10102
10117
|
};
|
|
10103
10118
|
var auditJob = buildConfig.audit
|
|
10104
|
-
? __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.
|
|
10119
|
+
? __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;
|
|
10105
10120
|
var lintJob = buildConfig.lint
|
|
10106
|
-
? __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.
|
|
10121
|
+
? __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;
|
|
10107
10122
|
var testJob = buildConfig.test
|
|
10108
|
-
? __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.
|
|
10123
|
+
? __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;
|
|
10109
10124
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
10110
10125
|
};
|
|
10111
10126
|
exports.createCustomTestJobs = createCustomTestJobs;
|
|
@@ -10184,7 +10199,9 @@ var DOCKER_BUILD_RUNNER_REQUESTS = {
|
|
|
10184
10199
|
KUBERNETES_MEMORY_LIMIT: "2Gi",
|
|
10185
10200
|
};
|
|
10186
10201
|
var getDockerImageVariables = function (context) {
|
|
10187
|
-
|
|
10202
|
+
var _a;
|
|
10203
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
10204
|
+
return __assign(__assign({}, ((0, deploy_1.isOfDeployType)(deployConfig, "google-cloudrun")
|
|
10188
10205
|
? {
|
|
10189
10206
|
DOCKER_REGISTRY: (0, artifactsRegistry_1.getArtifactsRegistryHost)(context),
|
|
10190
10207
|
DOCKER_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryImageName)(context),
|
|
@@ -10203,10 +10220,11 @@ exports.getDockerImageVariables = getDockerImageVariables;
|
|
|
10203
10220
|
/**
|
|
10204
10221
|
* Weather the context requires a docker build
|
|
10205
10222
|
*/
|
|
10206
|
-
var requiresDockerBuild = function (
|
|
10207
|
-
var
|
|
10208
|
-
|
|
10209
|
-
|
|
10223
|
+
var requiresDockerBuild = function (context) {
|
|
10224
|
+
var _a;
|
|
10225
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
10226
|
+
return ((0, deploy_1.isOfDeployType)(deployConfig, "kubernetes", "google-cloudrun", "dockerTag") ||
|
|
10227
|
+
((0, deploy_1.isOfDeployType)(deployConfig, "custom") && deployConfig.requiresDocker));
|
|
10210
10228
|
};
|
|
10211
10229
|
exports.requiresDockerBuild = requiresDockerBuild;
|
|
10212
10230
|
// those need to be runner variables
|
|
@@ -10232,11 +10250,11 @@ var getDockerAdditions = function (build) {
|
|
|
10232
10250
|
};
|
|
10233
10251
|
};
|
|
10234
10252
|
var getDockerBuildVariables = function (context) {
|
|
10235
|
-
return __assign(__assign(__assign({}, getDockerAdditions(context.
|
|
10253
|
+
return __assign(__assign(__assign({}, getDockerAdditions(context.build.config)), { APP_DIR: context.build.dir, DOCKER_DIR: "." }), (0, exports.getDockerImageVariables)(context));
|
|
10236
10254
|
};
|
|
10237
10255
|
exports.getDockerBuildVariables = getDockerBuildVariables;
|
|
10238
10256
|
exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
|
|
10239
|
-
var getDockerJobBaseProps = function (
|
|
10257
|
+
var getDockerJobBaseProps = function () {
|
|
10240
10258
|
return {
|
|
10241
10259
|
image: (0, runner_1.getRunnerImage)("docker-build"),
|
|
10242
10260
|
services: [
|
|
@@ -10252,14 +10270,14 @@ var getDockerJobBaseProps = function (context) {
|
|
|
10252
10270
|
exports.getDockerJobBaseProps = getDockerJobBaseProps;
|
|
10253
10271
|
var createDockerBuildJobBase = function (context, _a) {
|
|
10254
10272
|
var script = _a.script, def = __rest(_a, ["script"]);
|
|
10255
|
-
return (0, lodash_1.merge)(__assign(__assign({ name: exports.DOCKER_BUILD_JOB_NAME, envMode: "jobPerEnv", stage: "build" }, (0, exports.getDockerJobBaseProps)(
|
|
10273
|
+
return (0, lodash_1.merge)(__assign(__assign({ name: exports.DOCKER_BUILD_JOB_NAME, envMode: "jobPerEnv", stage: "build" }, (0, exports.getDockerJobBaseProps)()), { script: script || [] }), {
|
|
10256
10274
|
variables: (0, exports.getDockerBuildVariables)(context),
|
|
10257
10275
|
runnerVariables: __assign(__assign({}, DOCKER_BUILD_RUNNER_REQUESTS), getDockerBuildRunnerVariables()),
|
|
10258
10276
|
}, def);
|
|
10259
10277
|
};
|
|
10260
10278
|
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
10261
10279
|
var gitlabDockerLogin = function (context) {
|
|
10262
|
-
return (0, deploy_1.isOfDeployType)(context.
|
|
10280
|
+
return context.deploy && (0, deploy_1.isOfDeployType)(context.deploy.config, "google-cloudrun")
|
|
10263
10281
|
? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [
|
|
10264
10282
|
"gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context)),
|
|
10265
10283
|
], false) : [
|
|
@@ -10296,7 +10314,7 @@ var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
|
10296
10314
|
};
|
|
10297
10315
|
exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
|
|
10298
10316
|
var hasDockerfile = function (context) {
|
|
10299
|
-
return (0, fs_1.existsSync)(path_1.default.join(context.
|
|
10317
|
+
return (0, fs_1.existsSync)(path_1.default.join(context.build.dir, "Dockerfile"));
|
|
10300
10318
|
};
|
|
10301
10319
|
exports.hasDockerfile = hasDockerfile;
|
|
10302
10320
|
//# sourceMappingURL=docker.js.map
|
|
@@ -10417,23 +10435,23 @@ var constants_1 = __nccwpck_require__(31765);
|
|
|
10417
10435
|
var yarn_1 = __nccwpck_require__(45043);
|
|
10418
10436
|
var createNodeBuildJobs = function (context) {
|
|
10419
10437
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
10420
|
-
var buildConfig = context.
|
|
10438
|
+
var buildConfig = context.build.config;
|
|
10421
10439
|
if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
|
|
10422
10440
|
throw new Error("deploy config is not node, node-static or storybook");
|
|
10423
10441
|
}
|
|
10424
10442
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
10425
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
10443
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
10426
10444
|
return (0, base_1.createBuildJobs)(context, {
|
|
10427
10445
|
appBuild: buildConfig.buildCommand !== null
|
|
10428
10446
|
? {
|
|
10429
10447
|
image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
|
|
10430
10448
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
10431
|
-
cache: __spreadArray(__spreadArray(__spreadArray([], __read(((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : [])), false), __read((0, cache_1.getNodeCache)(context.
|
|
10449
|
+
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),
|
|
10432
10450
|
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
|
|
10433
10451
|
artifacts: {
|
|
10434
10452
|
paths: __spreadArray([
|
|
10435
|
-
context.
|
|
10436
|
-
], __read(((_e = (_d = context.
|
|
10453
|
+
context.build.dir
|
|
10454
|
+
], __read(((_e = (_d = context.build.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : [])), false).flatMap(function (dir) {
|
|
10437
10455
|
var _a, _b;
|
|
10438
10456
|
return __spreadArray([
|
|
10439
10457
|
(0, path_1.join)(dir, "__build_info.json"),
|
|
@@ -10453,11 +10471,11 @@ var createNodeBuildJobs = function (context) {
|
|
|
10453
10471
|
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
|
|
10454
10472
|
? "nginx"
|
|
10455
10473
|
: "node"),
|
|
10456
|
-
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.
|
|
10474
|
+
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.build, "pull")), false),
|
|
10457
10475
|
variables: {
|
|
10458
10476
|
// only required for non static
|
|
10459
|
-
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.
|
|
10460
|
-
DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.
|
|
10477
|
+
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.build),
|
|
10478
|
+
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"),
|
|
10461
10479
|
},
|
|
10462
10480
|
},
|
|
10463
10481
|
});
|
|
@@ -10557,7 +10575,7 @@ var getNextCache = function (context) { return [
|
|
|
10557
10575
|
{
|
|
10558
10576
|
key: context.componentName + "-next-cache",
|
|
10559
10577
|
policy: "pull-push",
|
|
10560
|
-
paths: [context.
|
|
10578
|
+
paths: [context.build.dir + "/.next/cache/"],
|
|
10561
10579
|
},
|
|
10562
10580
|
]; };
|
|
10563
10581
|
exports.getNextCache = getNextCache;
|
|
@@ -10676,23 +10694,23 @@ var getMeteorCache = function (context) { return [
|
|
|
10676
10694
|
key: context.componentName + "meteor-build-cache",
|
|
10677
10695
|
policy: "pull-push",
|
|
10678
10696
|
paths: [
|
|
10679
|
-
(0, path_1.join)(context.
|
|
10680
|
-
(0, path_1.join)(context.
|
|
10681
|
-
(0, path_1.join)(context.
|
|
10682
|
-
(0, path_1.join)(context.
|
|
10697
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"),
|
|
10698
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/plugin-cache"),
|
|
10699
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/isopacks"),
|
|
10700
|
+
(0, path_1.join)(context.build.dir, ".meteor/local/bundler-cache/scanner"),
|
|
10683
10701
|
],
|
|
10684
10702
|
},
|
|
10685
10703
|
]; };
|
|
10686
10704
|
var createMeteorBuildJobs = function (context) {
|
|
10687
|
-
var buildConfig = context.
|
|
10705
|
+
var buildConfig = context.build.config;
|
|
10688
10706
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
10689
10707
|
throw new Error("deploy config is not meteor");
|
|
10690
10708
|
}
|
|
10691
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
10709
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
10692
10710
|
return (0, base_1.createBuildJobs)(context, {
|
|
10693
10711
|
appBuild: buildConfig.buildCommand !== null
|
|
10694
10712
|
? {
|
|
10695
|
-
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.
|
|
10713
|
+
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.build)), false), __read(getMeteorCache(context)), false),
|
|
10696
10714
|
image: (0, runner_1.getRunnerImage)("jobs-meteor"),
|
|
10697
10715
|
variables: {
|
|
10698
10716
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1", // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
@@ -10706,8 +10724,8 @@ var createMeteorBuildJobs = function (context) {
|
|
|
10706
10724
|
], false),
|
|
10707
10725
|
artifacts: {
|
|
10708
10726
|
paths: [
|
|
10709
|
-
context.
|
|
10710
|
-
context.
|
|
10727
|
+
context.build.dir + "/__build_info.json",
|
|
10728
|
+
context.build.dir + "/dist",
|
|
10711
10729
|
],
|
|
10712
10730
|
},
|
|
10713
10731
|
}
|
|
@@ -10781,32 +10799,32 @@ var createNodeTestJobs = function (context) {
|
|
|
10781
10799
|
if (context.trigger === "taggedRelease") {
|
|
10782
10800
|
return [];
|
|
10783
10801
|
}
|
|
10784
|
-
var buildConfig = context.
|
|
10802
|
+
var buildConfig = context.build.config;
|
|
10785
10803
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
10786
10804
|
var base = {
|
|
10787
|
-
variables: __assign(__assign({ APP_PATH: context.
|
|
10805
|
+
variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
|
|
10788
10806
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
10789
10807
|
stage: "test",
|
|
10790
10808
|
needs: [],
|
|
10791
10809
|
envMode: "none",
|
|
10792
10810
|
};
|
|
10793
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
10811
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
10794
10812
|
var auditJob = buildConfig.audit !== false
|
|
10795
10813
|
? __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([
|
|
10796
|
-
"cd ".concat(context.
|
|
10814
|
+
"cd ".concat(context.build.dir)
|
|
10797
10815
|
], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
|
|
10798
|
-
((_f = context.
|
|
10816
|
+
((_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic)
|
|
10799
10817
|
? "yarn audit"
|
|
10800
10818
|
: "yarn npm audit --environment production", // yarn 2
|
|
10801
|
-
])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
10819
|
+
])), 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;
|
|
10802
10820
|
var lintJob = buildConfig.lint !== false
|
|
10803
|
-
? __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.
|
|
10804
|
-
"cd ".concat(context.
|
|
10805
|
-
], 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.
|
|
10821
|
+
? __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), [
|
|
10822
|
+
"cd ".concat(context.build.dir)
|
|
10823
|
+
], 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;
|
|
10806
10824
|
var testJob = buildConfig.test !== false
|
|
10807
|
-
? __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.
|
|
10808
|
-
"cd ".concat(context.
|
|
10809
|
-
], 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.
|
|
10825
|
+
? __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), [
|
|
10826
|
+
"cd ".concat(context.build.dir)
|
|
10827
|
+
], 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;
|
|
10810
10828
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
10811
10829
|
};
|
|
10812
10830
|
exports.createNodeTestJobs = createNodeTestJobs;
|
|
@@ -10943,7 +10961,7 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
10943
10961
|
var types_1 = __nccwpck_require__(84466);
|
|
10944
10962
|
var createRailsBuildJobs = function (context) {
|
|
10945
10963
|
var _a, _b, _c;
|
|
10946
|
-
var buildConfig = context.
|
|
10964
|
+
var buildConfig = context.build.config;
|
|
10947
10965
|
if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
|
|
10948
10966
|
// should not happen
|
|
10949
10967
|
throw new Error("build type is not rails");
|
|
@@ -10967,10 +10985,10 @@ var createRailsBuildJobs = function (context) {
|
|
|
10967
10985
|
return (0, base_1.createBuildJobs)(context, {
|
|
10968
10986
|
appBuild: undefined,
|
|
10969
10987
|
dockerBuild: {
|
|
10970
|
-
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.
|
|
10988
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
|
|
10971
10989
|
// custom script
|
|
10972
10990
|
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
|
|
10973
|
-
"cd ".concat(context.
|
|
10991
|
+
"cd ".concat(context.build.dir),
|
|
10974
10992
|
"docker pull $DOCKER_CACHE_IMAGE || true",
|
|
10975
10993
|
"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"),
|
|
10976
10994
|
"chmod +x /usr/local/bin/pack",
|
|
@@ -11079,7 +11097,7 @@ var createRailsTestJobs = function (context) {
|
|
|
11079
11097
|
if (context.trigger === "taggedRelease") {
|
|
11080
11098
|
return [];
|
|
11081
11099
|
}
|
|
11082
|
-
var buildConfig = context.
|
|
11100
|
+
var buildConfig = context.build.config;
|
|
11083
11101
|
var base = {
|
|
11084
11102
|
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
|
|
11085
11103
|
stage: "test",
|
|
@@ -11101,20 +11119,20 @@ var createRailsTestJobs = function (context) {
|
|
|
11101
11119
|
};
|
|
11102
11120
|
var auditJob = buildConfig.audit !== false
|
|
11103
11121
|
? __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([
|
|
11104
|
-
"cd ".concat(context.
|
|
11122
|
+
"cd ".concat(context.build.dir)
|
|
11105
11123
|
], __read(((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
11106
11124
|
"gem install bundler-audit",
|
|
11107
11125
|
"bundle audit check",
|
|
11108
11126
|
])), false), allow_failure: true }) : null;
|
|
11109
11127
|
var lintJob = buildConfig.lint !== false
|
|
11110
11128
|
? __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([
|
|
11111
|
-
"cd ".concat(context.
|
|
11129
|
+
"cd ".concat(context.build.dir)
|
|
11112
11130
|
], __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 : [
|
|
11113
11131
|
"bundle exec rubocop",
|
|
11114
11132
|
])), false) }) : null;
|
|
11115
11133
|
var testJob = buildConfig.test !== false
|
|
11116
11134
|
? __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([
|
|
11117
|
-
"cd ".concat(context.
|
|
11135
|
+
"cd ".concat(context.build.dir)
|
|
11118
11136
|
], __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 : [
|
|
11119
11137
|
"bundle exec rspec",
|
|
11120
11138
|
])), false) }) : null;
|
|
@@ -11137,12 +11155,12 @@ exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
|
|
|
11137
11155
|
exports.SBOM_FILE = "__sbom.json";
|
|
11138
11156
|
var createSbomBuildJob = function (context) {
|
|
11139
11157
|
var _a, _b, _c, _d, _e;
|
|
11140
|
-
var buildConfig = context.
|
|
11158
|
+
var buildConfig = context.build.config;
|
|
11141
11159
|
var defaultImage = "aquasec/trivy:0.38.3";
|
|
11142
11160
|
var defaultScript = [
|
|
11143
|
-
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.
|
|
11161
|
+
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.build.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace)
|
|
11144
11162
|
? "."
|
|
11145
|
-
: context.
|
|
11163
|
+
: context.build.dir),
|
|
11146
11164
|
];
|
|
11147
11165
|
var image = buildConfig.type === "custom" && buildConfig.sbom !== false
|
|
11148
11166
|
? (_c = (_b = buildConfig.sbom) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage
|
|
@@ -11768,7 +11786,7 @@ var sanitize = function (value) {
|
|
|
11768
11786
|
};
|
|
11769
11787
|
var getLabels = function (context) {
|
|
11770
11788
|
var _a, _b, _c;
|
|
11771
|
-
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.
|
|
11789
|
+
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 : {}));
|
|
11772
11790
|
return labels;
|
|
11773
11791
|
};
|
|
11774
11792
|
exports.getLabels = getLabels;
|
|
@@ -11807,6 +11825,17 @@ exports.getReviewSlug = getReviewSlug;
|
|
|
11807
11825
|
|
|
11808
11826
|
"use strict";
|
|
11809
11827
|
|
|
11828
|
+
var __assign = (this && this.__assign) || function () {
|
|
11829
|
+
__assign = Object.assign || function(t) {
|
|
11830
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
11831
|
+
s = arguments[i];
|
|
11832
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11833
|
+
t[p] = s[p];
|
|
11834
|
+
}
|
|
11835
|
+
return t;
|
|
11836
|
+
};
|
|
11837
|
+
return __assign.apply(this, arguments);
|
|
11838
|
+
};
|
|
11810
11839
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11811
11840
|
if (k2 === undefined) k2 = k;
|
|
11812
11841
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -11859,6 +11888,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
11859
11888
|
};
|
|
11860
11889
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11861
11890
|
exports.createContext = exports.createComponentContext = void 0;
|
|
11891
|
+
var lodash_1 = __nccwpck_require__(23255);
|
|
11862
11892
|
var build_1 = __nccwpck_require__(67862);
|
|
11863
11893
|
var deploy_1 = __nccwpck_require__(68483);
|
|
11864
11894
|
var utils_1 = __nccwpck_require__(32497);
|
|
@@ -11867,10 +11897,9 @@ var getEnvironmentContext_1 = __nccwpck_require__(13663);
|
|
|
11867
11897
|
__exportStar(__nccwpck_require__(45699), exports);
|
|
11868
11898
|
__exportStar(__nccwpck_require__(45133), exports);
|
|
11869
11899
|
var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
11870
|
-
var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
switch (_b.label) {
|
|
11900
|
+
var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
11901
|
+
return __generator(this, function (_a) {
|
|
11902
|
+
switch (_a.label) {
|
|
11874
11903
|
case 0:
|
|
11875
11904
|
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
11876
11905
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
@@ -11887,22 +11916,33 @@ var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, v
|
|
|
11887
11916
|
deploy: {},
|
|
11888
11917
|
};
|
|
11889
11918
|
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
11890
|
-
|
|
11919
|
+
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
|
|
11920
|
+
case 1:
|
|
11921
|
+
environment = _a.sent();
|
|
11922
|
+
deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
|
|
11923
|
+
context = {
|
|
11891
11924
|
fullConfig: ctx.config,
|
|
11892
11925
|
componentConfig: componentConfig,
|
|
11893
|
-
|
|
11894
|
-
dir:
|
|
11926
|
+
build: {
|
|
11927
|
+
dir: dir,
|
|
11895
11928
|
packageManagerInfo: ctx.packageManagerInfo,
|
|
11896
|
-
config:
|
|
11929
|
+
config: build,
|
|
11897
11930
|
},
|
|
11898
|
-
|
|
11931
|
+
deploy: deploy
|
|
11932
|
+
? {
|
|
11933
|
+
config: deploy,
|
|
11934
|
+
}
|
|
11935
|
+
: null,
|
|
11936
|
+
componentName: ctx.componentName,
|
|
11937
|
+
environment: environment,
|
|
11938
|
+
packageManagerInfo: ctx.packageManagerInfo,
|
|
11939
|
+
pipelineType: ctx.pipelineType,
|
|
11940
|
+
trigger: ctx.trigger,
|
|
11899
11941
|
};
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
_a.trigger = ctx.trigger,
|
|
11905
|
-
_a)];
|
|
11942
|
+
resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs)
|
|
11943
|
+
? customJobs(context)
|
|
11944
|
+
: customJobs;
|
|
11945
|
+
return [2 /*return*/, __assign(__assign({}, context), { customJobs: resolvedCustomJobs })];
|
|
11906
11946
|
}
|
|
11907
11947
|
});
|
|
11908
11948
|
}); };
|
|
@@ -12317,7 +12357,7 @@ var stop_1 = __nccwpck_require__(82846);
|
|
|
12317
12357
|
var variables_1 = __nccwpck_require__(82422);
|
|
12318
12358
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
12319
12359
|
var createDeployJob = function (context, jobDefinition) {
|
|
12320
|
-
var _a, _b, _c, _d, _e, _f;
|
|
12360
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
12321
12361
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
12322
12362
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
12323
12363
|
var autoStop = context.environment.envType === "review"
|
|
@@ -12325,14 +12365,13 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
12325
12365
|
: context.environment.envType === "dev"
|
|
12326
12366
|
? "4 weeks"
|
|
12327
12367
|
: undefined;
|
|
12368
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12328
12369
|
// if auto or manual is configured explicitly, use that
|
|
12329
|
-
var whenDeployDefined =
|
|
12330
|
-
? context.componentConfig.deploy.when
|
|
12331
|
-
: undefined;
|
|
12370
|
+
var whenDeployDefined = deployConfig && deployConfig.when ? deployConfig.when : undefined;
|
|
12332
12371
|
// otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
|
|
12333
12372
|
var whenDeployDefault = context.environment.envType !== "prod"
|
|
12334
12373
|
? "auto" // is not stage, auto deploy
|
|
12335
|
-
: ((
|
|
12374
|
+
: ((_b = context.componentConfig.env) === null || _b === void 0 ? void 0 : _b.stage) === false
|
|
12336
12375
|
? "auto" // is prod, but no staging, auto deploy
|
|
12337
12376
|
: "manual"; // manually deploy
|
|
12338
12377
|
var whenDeploy = whenDeployDefined ? whenDeployDefined : whenDeployDefault;
|
|
@@ -12346,12 +12385,12 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
12346
12385
|
envMode: "stagePerEnv", // makes it easier to run manual tasks er env
|
|
12347
12386
|
needs: __spreadArray(__spreadArray([], __read(((0, sbom_2.sbomDeactivated)(context)
|
|
12348
12387
|
? []
|
|
12349
|
-
: [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((
|
|
12350
|
-
? (
|
|
12388
|
+
: [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((deployConfig
|
|
12389
|
+
? (_d = (_c = deployConfig.waitFor) === null || _c === void 0 ? void 0 : _c.map(function (c) { return ({
|
|
12351
12390
|
componentName: c,
|
|
12352
12391
|
job: exports.DEPLOY_JOB_NAME,
|
|
12353
12392
|
artifacts: false,
|
|
12354
|
-
}); })) !== null &&
|
|
12393
|
+
}); })) !== null && _d !== void 0 ? _d : []
|
|
12355
12394
|
: [])), false),
|
|
12356
12395
|
// we don't want to deploy when there is a broken test
|
|
12357
12396
|
needsStages: [
|
|
@@ -12367,21 +12406,15 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
12367
12406
|
when: whenDeploy === "auto" ? "on_success" : "manual",
|
|
12368
12407
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
12369
12408
|
stage: "deploy",
|
|
12370
|
-
variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), (hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {})), context.environment.jobOnlyVars.deploy.envVars), (
|
|
12371
|
-
|
|
12372
|
-
: {})), jobDefinition.variables),
|
|
12373
|
-
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), ((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {})), (context.componentConfig.deploy
|
|
12374
|
-
? (_f = context.componentConfig.deploy.runnerVariables) !== null && _f !== void 0 ? _f : {}
|
|
12375
|
-
: {})),
|
|
12409
|
+
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),
|
|
12410
|
+
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 : {} : {})),
|
|
12376
12411
|
environment: isStoppable
|
|
12377
12412
|
? {
|
|
12378
12413
|
on_stop: stop_1.STOP_JOB_NAME,
|
|
12379
12414
|
auto_stop_in: autoStop,
|
|
12380
12415
|
}
|
|
12381
12416
|
: undefined,
|
|
12382
|
-
jobTags:
|
|
12383
|
-
? context.componentConfig.deploy.jobTags
|
|
12384
|
-
: undefined,
|
|
12417
|
+
jobTags: deployConfig ? deployConfig.jobTags : undefined,
|
|
12385
12418
|
};
|
|
12386
12419
|
};
|
|
12387
12420
|
exports.createDeployJob = createDeployJob;
|
|
@@ -12579,17 +12612,18 @@ var BashExpression_1 = __nccwpck_require__(42376);
|
|
|
12579
12612
|
var gitlab_1 = __nccwpck_require__(38490);
|
|
12580
12613
|
var types_1 = __nccwpck_require__(75781);
|
|
12581
12614
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(74398);
|
|
12582
|
-
var getArtifactsRegistryHost = function (
|
|
12583
|
-
var
|
|
12584
|
-
if (!(0, types_1.isOfDeployType)(deploy, "google-cloudrun")) {
|
|
12615
|
+
var getArtifactsRegistryHost = function (context) {
|
|
12616
|
+
var _a;
|
|
12617
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun")) {
|
|
12585
12618
|
// should not happen
|
|
12586
12619
|
throw new Error("deploy config is wrong");
|
|
12587
12620
|
}
|
|
12588
|
-
return "".concat(deploy.region, "-docker.pkg.dev");
|
|
12621
|
+
return "".concat(context.deploy.config.region, "-docker.pkg.dev");
|
|
12589
12622
|
};
|
|
12590
12623
|
exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
|
|
12591
12624
|
var getArtifactsRegistryDockerUrl = function (context) {
|
|
12592
|
-
var
|
|
12625
|
+
var _a;
|
|
12626
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12593
12627
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12594
12628
|
// should not happen
|
|
12595
12629
|
throw new Error("deploy config is wrong");
|
|
@@ -12652,11 +12686,9 @@ var getDeleteImageCommands = function (fullImageName, keepNewest) {
|
|
|
12652
12686
|
* @returns
|
|
12653
12687
|
*/
|
|
12654
12688
|
var getDeleteUnusedImagesCommands = function (context, keep) {
|
|
12689
|
+
var _a;
|
|
12655
12690
|
if (keep === void 0) { keep = 0; }
|
|
12656
|
-
var deployConfig = context.
|
|
12657
|
-
if (deployConfig === false) {
|
|
12658
|
-
return [];
|
|
12659
|
-
}
|
|
12691
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12660
12692
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12661
12693
|
// should not happen
|
|
12662
12694
|
throw new Error("deploy config is wrong");
|
|
@@ -12747,8 +12779,9 @@ var createArgsString_1 = __nccwpck_require__(49598);
|
|
|
12747
12779
|
var getServiceName_1 = __nccwpck_require__(38128);
|
|
12748
12780
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(74398);
|
|
12749
12781
|
var getListRevisionsCommand = function (context, args) {
|
|
12782
|
+
var _a;
|
|
12750
12783
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
12751
|
-
var deployConfig = context.
|
|
12784
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12752
12785
|
if (!deployConfig || !(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12753
12786
|
// should not happen
|
|
12754
12787
|
throw new Error("deploy config is wrong");
|
|
@@ -12760,10 +12793,8 @@ var getListRevisionsCommand = function (context, args) {
|
|
|
12760
12793
|
return "gcloud run revisions list ".concat((0, createArgsString_1.createArgsString)(filterRevisionArgs));
|
|
12761
12794
|
};
|
|
12762
12795
|
var getDeleteUnusedRevisionsCommands = function (context, keep) {
|
|
12763
|
-
var
|
|
12764
|
-
|
|
12765
|
-
return [];
|
|
12766
|
-
}
|
|
12796
|
+
var _a;
|
|
12797
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12767
12798
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12768
12799
|
// should not happen
|
|
12769
12800
|
throw new Error("deploy config is wrong");
|
|
@@ -13032,7 +13063,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
|
13032
13063
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
13033
13064
|
var customConfig = service !== true ? service : undefined;
|
|
13034
13065
|
var command = service !== true
|
|
13035
|
-
? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.
|
|
13066
|
+
? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.build.config.startCommand
|
|
13036
13067
|
: undefined;
|
|
13037
13068
|
var commandArray = command
|
|
13038
13069
|
? Array.isArray(command)
|
|
@@ -13127,7 +13158,8 @@ var makeLabelString = function (obj) {
|
|
|
13127
13158
|
};
|
|
13128
13159
|
exports.makeLabelString = makeLabelString;
|
|
13129
13160
|
var getCloudRunDeployConfig = function (context) {
|
|
13130
|
-
var
|
|
13161
|
+
var _a;
|
|
13162
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13131
13163
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
13132
13164
|
// should not happen
|
|
13133
13165
|
throw new Error("deploy config is wrong");
|
|
@@ -13309,10 +13341,8 @@ var constants_1 = __nccwpck_require__(38865);
|
|
|
13309
13341
|
var getCloudRunDeployScripts_1 = __nccwpck_require__(53695);
|
|
13310
13342
|
var getCloudRunStopScripts_1 = __nccwpck_require__(33747);
|
|
13311
13343
|
var createGoogleCloudRunDeployJobs = function (context) {
|
|
13312
|
-
var
|
|
13313
|
-
|
|
13314
|
-
return [];
|
|
13315
|
-
}
|
|
13344
|
+
var _a;
|
|
13345
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13316
13346
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
13317
13347
|
// should not happen
|
|
13318
13348
|
throw new Error("deploy config is wrong");
|
|
@@ -13792,31 +13822,28 @@ var base_1 = __nccwpck_require__(84052);
|
|
|
13792
13822
|
var sbom_1 = __nccwpck_require__(44986);
|
|
13793
13823
|
var types_1 = __nccwpck_require__(75781);
|
|
13794
13824
|
var createCustomDeployJobs = function (context) {
|
|
13795
|
-
var _a, _b, _c;
|
|
13796
|
-
var deployConfig = context.
|
|
13797
|
-
if (deployConfig === false) {
|
|
13798
|
-
return [];
|
|
13799
|
-
}
|
|
13825
|
+
var _a, _b, _c, _d;
|
|
13826
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13800
13827
|
if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
|
|
13801
13828
|
// should not happen
|
|
13802
13829
|
throw new Error("deploy config is not custom");
|
|
13803
13830
|
}
|
|
13804
13831
|
// FIXME: custom deploy currently assumes yarn-based project
|
|
13805
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
13832
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build, {
|
|
13806
13833
|
noCustomPostInstall: true,
|
|
13807
13834
|
});
|
|
13808
13835
|
return (0, base_1.createDeployementJobs)(context, {
|
|
13809
13836
|
deploy: {
|
|
13810
|
-
image: (
|
|
13811
|
-
cache: (
|
|
13837
|
+
image: (_b = deployConfig.jobImage) !== null && _b !== void 0 ? _b : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
13838
|
+
cache: (_c = deployConfig.jobCache) !== null && _c !== void 0 ? _c : [],
|
|
13812
13839
|
script: __spreadArray(__spreadArray(__spreadArray([
|
|
13813
|
-
"cd ".concat(context.
|
|
13840
|
+
"cd ".concat(context.build.dir)
|
|
13814
13841
|
], __read((deployConfig.requiresYarnInstall ? yarnInstall : [])), false), __read(deployConfig.script), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false),
|
|
13815
13842
|
variables: {},
|
|
13816
13843
|
},
|
|
13817
13844
|
stop: deployConfig.stopScript
|
|
13818
13845
|
? {
|
|
13819
|
-
image: (
|
|
13846
|
+
image: (_d = deployConfig.jobImage) !== null && _d !== void 0 ? _d : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
13820
13847
|
script: __spreadArray(__spreadArray([], __read(deployConfig.stopScript), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false),
|
|
13821
13848
|
variables: {},
|
|
13822
13849
|
}
|
|
@@ -13893,17 +13920,15 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
13893
13920
|
var base_1 = __nccwpck_require__(84052);
|
|
13894
13921
|
var types_1 = __nccwpck_require__(75781);
|
|
13895
13922
|
var createDockerTagDeployJobs = function (context) {
|
|
13896
|
-
var
|
|
13897
|
-
|
|
13898
|
-
return [];
|
|
13899
|
-
}
|
|
13923
|
+
var _a;
|
|
13924
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13900
13925
|
if (!(0, types_1.isOfDeployType)(deployConfig, "dockerTag")) {
|
|
13901
13926
|
// should not happen
|
|
13902
13927
|
throw new Error("deploy config is not dockerTag");
|
|
13903
13928
|
}
|
|
13904
13929
|
var tag = deployConfig.tag;
|
|
13905
13930
|
return (0, base_1.createDeployementJobs)(context, {
|
|
13906
|
-
deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)(
|
|
13931
|
+
deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)()), { script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
|
|
13907
13932
|
"docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG",
|
|
13908
13933
|
"docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag),
|
|
13909
13934
|
"docker push $DOCKER_IMAGE:".concat(tag),
|
|
@@ -14015,32 +14040,34 @@ var context_1 = __nccwpck_require__(5875);
|
|
|
14015
14040
|
var utils_1 = __nccwpck_require__(62089);
|
|
14016
14041
|
var types_1 = __nccwpck_require__(75781);
|
|
14017
14042
|
var hasKubernetesCloudSQL = function (context) {
|
|
14018
|
-
var _a, _b;
|
|
14019
|
-
|
|
14020
|
-
|
|
14043
|
+
var _a, _b, _c;
|
|
14044
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14045
|
+
if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
14046
|
+
return (_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql) === null || _c === void 0 ? void 0 : _c.enabled;
|
|
14021
14047
|
}
|
|
14022
14048
|
return false;
|
|
14023
14049
|
};
|
|
14024
14050
|
exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
|
|
14025
14051
|
var createKubernetesCloudsqlBaseValues = function (context) {
|
|
14026
|
-
var _a, _b, _c, _d, _e, _f;
|
|
14027
|
-
|
|
14052
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
14053
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14054
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
14028
14055
|
throw new Error("cannot get cloud sql config");
|
|
14029
14056
|
}
|
|
14030
|
-
var config = (
|
|
14057
|
+
var config = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql;
|
|
14031
14058
|
if (!config) {
|
|
14032
14059
|
throw new Error("cannot get cloud sql config");
|
|
14033
14060
|
}
|
|
14034
14061
|
var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
|
|
14035
14062
|
if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
|
|
14036
|
-
var instanceConnectionName = "".concat((
|
|
14063
|
+
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);
|
|
14037
14064
|
return {
|
|
14038
14065
|
cloudsql: {
|
|
14039
14066
|
enabled: config.enabled,
|
|
14040
14067
|
dbUser: "postgres",
|
|
14041
14068
|
instanceConnectionName: instanceConnectionName,
|
|
14042
14069
|
proxyCredentials: proxyCredentials,
|
|
14043
|
-
fullDbName: (
|
|
14070
|
+
fullDbName: (_f = context.environment.envVars.KUBE_APP_NAME) !== null && _f !== void 0 ? _f : "",
|
|
14044
14071
|
},
|
|
14045
14072
|
};
|
|
14046
14073
|
}
|
|
@@ -14048,7 +14075,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
|
|
|
14048
14075
|
return {
|
|
14049
14076
|
cloudsql: {
|
|
14050
14077
|
enabled: config.enabled,
|
|
14051
|
-
dbUser: (
|
|
14078
|
+
dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
|
|
14052
14079
|
instanceConnectionName: config.instanceConnectionName,
|
|
14053
14080
|
proxyCredentials: proxyCredentials,
|
|
14054
14081
|
fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName),
|
|
@@ -14117,11 +14144,8 @@ var bashYaml_1 = __nccwpck_require__(54660);
|
|
|
14117
14144
|
var gitlab_1 = __nccwpck_require__(38490);
|
|
14118
14145
|
var ALL_VALUES_FILE = "__all_values.yml";
|
|
14119
14146
|
var createKubernetesDeployJobs = function (context) {
|
|
14120
|
-
var _a, _b;
|
|
14121
|
-
var deployConfig = context.
|
|
14122
|
-
if (deployConfig === false) {
|
|
14123
|
-
return [];
|
|
14124
|
-
}
|
|
14147
|
+
var _a, _b, _c;
|
|
14148
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14125
14149
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
14126
14150
|
// should not happen
|
|
14127
14151
|
throw new Error("deploy config is not kubernetes");
|
|
@@ -14135,7 +14159,7 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
14135
14159
|
when: "always",
|
|
14136
14160
|
},
|
|
14137
14161
|
}
|
|
14138
|
-
: {})), { 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: (
|
|
14162
|
+
: {})), { 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,
|
|
14139
14163
|
/** @deprecated */
|
|
14140
14164
|
BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID }) });
|
|
14141
14165
|
var clusterName = "kube-".concat(context.environment.fullName);
|
|
@@ -14301,7 +14325,8 @@ var shouldGoIntoSecrets = function (key, value) {
|
|
|
14301
14325
|
* we evalulate the actual values later, but want to store the secrets in kubernetes secrets
|
|
14302
14326
|
*/
|
|
14303
14327
|
var createKubeEnv = function (context) {
|
|
14304
|
-
|
|
14328
|
+
var _a;
|
|
14329
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
14305
14330
|
// should not happen
|
|
14306
14331
|
throw new Error("deploy config is not kubernetes");
|
|
14307
14332
|
}
|
|
@@ -14387,7 +14412,7 @@ var createAppConfig = function (context, application) {
|
|
|
14387
14412
|
var _a = application !== null && application !== void 0 ? application : {}, healthRoute = _a.healthRoute, command = _a.command, rest = __rest(_a, ["healthRoute", "command"]);
|
|
14388
14413
|
return (0, utils_1.mergeWithMergingArrays)({
|
|
14389
14414
|
host: context.environment.host,
|
|
14390
|
-
command: command !== null && command !== void 0 ? command : context.
|
|
14415
|
+
command: command !== null && command !== void 0 ? command : context.build.config.startCommand,
|
|
14391
14416
|
livenessProbe: {
|
|
14392
14417
|
httpGet: {
|
|
14393
14418
|
path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health",
|
|
@@ -14415,9 +14440,9 @@ var removeFalsy = function (record) {
|
|
|
14415
14440
|
}));
|
|
14416
14441
|
};
|
|
14417
14442
|
var createKubeValues = function (context) {
|
|
14418
|
-
var _a, _b;
|
|
14419
|
-
var deployConfig = context.
|
|
14420
|
-
if (deployConfig
|
|
14443
|
+
var _a, _b, _c;
|
|
14444
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14445
|
+
if (!deployConfig) {
|
|
14421
14446
|
return [];
|
|
14422
14447
|
}
|
|
14423
14448
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
@@ -14427,14 +14452,14 @@ var createKubeValues = function (context) {
|
|
|
14427
14452
|
var values = deployConfig.values;
|
|
14428
14453
|
// 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
|
|
14429
14454
|
// we only merge the rest of the values in
|
|
14430
|
-
var
|
|
14455
|
+
var _d = values !== null && values !== void 0 ? values : {}, application = _d.application, jobs = _d.jobs, cronjobs = _d.cronjobs, rest = __rest(_d, ["application", "jobs", "cronjobs"]);
|
|
14431
14456
|
var env = (0, kubeEnv_1.createKubeEnv)(context);
|
|
14432
14457
|
var defaultKubeValues = (0, lodash_1.merge)({
|
|
14433
14458
|
env: env,
|
|
14434
14459
|
application: createAppConfig(context, application),
|
|
14435
14460
|
}, (0, cloudSql_1.hasKubernetesCloudSQL)(context)
|
|
14436
14461
|
? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context)
|
|
14437
|
-
: {}, ((
|
|
14462
|
+
: {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled)
|
|
14438
14463
|
? (0, mongodb_1.createMongodbBaseConfig)(context)
|
|
14439
14464
|
: {});
|
|
14440
14465
|
var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({ jobs: removeFalsy(jobs), cronjobs: removeFalsy(cronjobs) }, rest)));
|
|
@@ -14482,15 +14507,15 @@ var getMongodbReplicasetHost = function (context, index) {
|
|
|
14482
14507
|
return getMongodbHost(context, "".concat(fullAppname, "-mongodb-").concat(index, ".").concat(fullAppname, "-mongodb-headless"));
|
|
14483
14508
|
};
|
|
14484
14509
|
var createMongodbUrl = function (context, dbName) {
|
|
14485
|
-
var _a, _b;
|
|
14486
|
-
if (!(0, types_1.isOfDeployType)(context.
|
|
14510
|
+
var _a, _b, _c, _d;
|
|
14511
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
14487
14512
|
throw new Error("can only createMongodbUrl on supported deploys");
|
|
14488
14513
|
}
|
|
14489
|
-
var mongodbConfig = (
|
|
14514
|
+
var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
|
|
14490
14515
|
var queryParams = undefined;
|
|
14491
14516
|
var hosts = "";
|
|
14492
14517
|
if ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset") {
|
|
14493
|
-
hosts = (0, lodash_1.range)(0, (
|
|
14518
|
+
hosts = (0, lodash_1.range)(0, (_d = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.replicaCount) !== null && _d !== void 0 ? _d : 2)
|
|
14494
14519
|
.map(function (i) { return getMongodbReplicasetHost(context, i); })
|
|
14495
14520
|
.join(",");
|
|
14496
14521
|
queryParams = "replicaSet=rs0&authSource=admin";
|
|
@@ -14502,11 +14527,11 @@ var createMongodbUrl = function (context, dbName) {
|
|
|
14502
14527
|
return "mongodb://".concat(getCredentialString(context)).concat(hosts, "/").concat(dbName).concat(queryParams ? "?".concat(queryParams) : "");
|
|
14503
14528
|
};
|
|
14504
14529
|
var createMongoBackupDefaultConfig = function (context) {
|
|
14505
|
-
var _a;
|
|
14506
|
-
if (!(0, types_1.isOfDeployType)(context.
|
|
14530
|
+
var _a, _b, _c;
|
|
14531
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
14507
14532
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
14508
14533
|
}
|
|
14509
|
-
var mongodbConfig = (
|
|
14534
|
+
var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
|
|
14510
14535
|
var fullAppName = context.environment.envVars.KUBE_APP_NAME;
|
|
14511
14536
|
var backupEnabled = ["prod", "stage"].includes(context.environment.envType);
|
|
14512
14537
|
var hostToBackup;
|
|
@@ -14536,11 +14561,11 @@ var createMongoBackupDefaultConfig = function (context) {
|
|
|
14536
14561
|
};
|
|
14537
14562
|
};
|
|
14538
14563
|
var createMongodbBaseConfig = function (context) {
|
|
14539
|
-
var _a, _b;
|
|
14540
|
-
if (!(0, types_1.isOfDeployType)(context.
|
|
14564
|
+
var _a, _b, _c, _d;
|
|
14565
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
14541
14566
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
14542
14567
|
}
|
|
14543
|
-
var mongodbConfig = (
|
|
14568
|
+
var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
|
|
14544
14569
|
return {
|
|
14545
14570
|
mongodb: {
|
|
14546
14571
|
enabled: true,
|
|
@@ -14555,7 +14580,7 @@ var createMongodbBaseConfig = function (context) {
|
|
|
14555
14580
|
backup: createMongoBackupDefaultConfig(context),
|
|
14556
14581
|
},
|
|
14557
14582
|
env: {
|
|
14558
|
-
secret: __assign({ MONGO_URL: createMongodbUrl(context, (
|
|
14583
|
+
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"
|
|
14559
14584
|
? { MONGO_OPLOG_URL: createMongodbUrl(context, "local") } // oplog only works with replicasets
|
|
14560
14585
|
: {})),
|
|
14561
14586
|
},
|
|
@@ -14611,8 +14636,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
14611
14636
|
exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
|
|
14612
14637
|
var sbom_1 = __nccwpck_require__(37038);
|
|
14613
14638
|
var sbomDeactivated = function (context) {
|
|
14614
|
-
return context.
|
|
14615
|
-
context.componentConfig.build.sbom === false;
|
|
14639
|
+
return context.build.config.type === "custom" && context.build.config.sbom === false;
|
|
14616
14640
|
};
|
|
14617
14641
|
exports.sbomDeactivated = sbomDeactivated;
|
|
14618
14642
|
var getDependencyTrackUploadScript = function (context) {
|
|
@@ -14697,7 +14721,7 @@ var isOfDeployType = function (t) {
|
|
|
14697
14721
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
14698
14722
|
types[_i - 1] = arguments[_i];
|
|
14699
14723
|
}
|
|
14700
|
-
return t && types.includes(t.type);
|
|
14724
|
+
return t && types.includes(t.type) ? true : false;
|
|
14701
14725
|
};
|
|
14702
14726
|
exports.isOfDeployType = isOfDeployType;
|
|
14703
14727
|
//# sourceMappingURL=index.js.map
|
|
@@ -14733,7 +14757,8 @@ var getKubernetesNamespace = function (config, env) {
|
|
|
14733
14757
|
};
|
|
14734
14758
|
exports.getKubernetesNamespace = getKubernetesNamespace;
|
|
14735
14759
|
var contextIsStoppable = function (context) {
|
|
14736
|
-
var
|
|
14760
|
+
var _a;
|
|
14761
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14737
14762
|
if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
14738
14763
|
return true;
|
|
14739
14764
|
}
|
|
@@ -15069,7 +15094,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
15069
15094
|
};
|
|
15070
15095
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
15071
15096
|
exports.createJobsForComponent = void 0;
|
|
15072
|
-
var lodash_1 = __nccwpck_require__(23255);
|
|
15073
15097
|
var build_1 = __nccwpck_require__(67862);
|
|
15074
15098
|
var context_1 = __nccwpck_require__(5875);
|
|
15075
15099
|
var deploy_1 = __nccwpck_require__(68483);
|
|
@@ -15082,18 +15106,17 @@ var injectDefaultVarsInCustomJobs = function (context, jobs) {
|
|
|
15082
15106
|
});
|
|
15083
15107
|
};
|
|
15084
15108
|
var getCustomJobs = function (context) {
|
|
15085
|
-
if (!context.
|
|
15109
|
+
if (!context.customJobs) {
|
|
15086
15110
|
return [];
|
|
15087
15111
|
}
|
|
15088
|
-
var rawJobs =
|
|
15089
|
-
? context.componentConfig.customJobs(context)
|
|
15090
|
-
: context.componentConfig.customJobs;
|
|
15112
|
+
var rawJobs = context.customJobs;
|
|
15091
15113
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
15092
15114
|
};
|
|
15093
15115
|
var createRawJobs = function (context) {
|
|
15094
|
-
var
|
|
15095
|
-
var
|
|
15096
|
-
|
|
15116
|
+
var _a, _b;
|
|
15117
|
+
var buildJobs = build_1.BUILD_TYPES[context.build.config.type].jobs(context);
|
|
15118
|
+
var deployJobs = ((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config)
|
|
15119
|
+
? deploy_1.DEPLOY_TYPES[(_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.type].jobs(context)
|
|
15097
15120
|
: [];
|
|
15098
15121
|
var customJobs = getCustomJobs(context);
|
|
15099
15122
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|