@catladder/cli 0.0.0-main-085e963c → 0.0.0-main-45f6e733
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/catenv/index.js +233 -193
- package/dist/bundles/cli/index.js +351 -298
- 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 +6 -6
- 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 +26 -5
- package/dist/pipeline/src/build/docker.js +50 -17
- package/dist/pipeline/src/build/docker.js.map +1 -1
- package/dist/pipeline/src/build/node/buildJob.js +11 -11
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.js +1 -1
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/node/meteor.js +10 -10
- package/dist/pipeline/src/build/node/meteor.js.map +1 -1
- package/dist/pipeline/src/build/node/testJob.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/build/types.d.ts +33 -25
- package/dist/pipeline/src/build/types.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;
|
|
@@ -9952,8 +9967,8 @@ var RUNNER_BUILD_VARIABLES = {
|
|
|
9952
9967
|
KUBERNETES_MEMORY_LIMIT: "4Gi",
|
|
9953
9968
|
};
|
|
9954
9969
|
var createCustomBuildJobs = function (context) {
|
|
9955
|
-
var _a, _b, _c
|
|
9956
|
-
var buildConfig = context.
|
|
9970
|
+
var _a, _b, _c;
|
|
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,17 +9982,17 @@ 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
|
},
|
|
9977
9992
|
}
|
|
9978
9993
|
: undefined,
|
|
9979
9994
|
dockerBuild: {
|
|
9980
|
-
script: (0, docker_1.
|
|
9995
|
+
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context),
|
|
9981
9996
|
variables: {},
|
|
9982
9997
|
},
|
|
9983
9998
|
});
|
|
@@ -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;
|
|
@@ -10169,22 +10184,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10169
10184
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10170
10185
|
};
|
|
10171
10186
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10172
|
-
exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
|
|
10173
|
-
var lodash_1 = __nccwpck_require__(23255);
|
|
10174
|
-
var deploy_1 = __nccwpck_require__(68483);
|
|
10175
|
-
var runner_1 = __nccwpck_require__(4058);
|
|
10187
|
+
exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.getDockerBuildScriptWithBuiltInDockerFile = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
|
|
10176
10188
|
var fs_1 = __nccwpck_require__(57147);
|
|
10189
|
+
var lodash_1 = __nccwpck_require__(23255);
|
|
10177
10190
|
var path_1 = __importDefault(__nccwpck_require__(71017));
|
|
10178
|
-
var
|
|
10191
|
+
var deploy_1 = __nccwpck_require__(68483);
|
|
10179
10192
|
var artifactsRegistry_1 = __nccwpck_require__(44963);
|
|
10180
10193
|
var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(46320);
|
|
10194
|
+
var runner_1 = __nccwpck_require__(4058);
|
|
10195
|
+
var gitlab_1 = __nccwpck_require__(38490);
|
|
10181
10196
|
var DOCKER_BUILD_RUNNER_REQUESTS = {
|
|
10182
10197
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
10183
10198
|
KUBERNETES_MEMORY_REQUEST: "1Gi",
|
|
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
|
|
@@ -10216,13 +10234,27 @@ var getDockerBuildRunnerVariables = function () { return ({
|
|
|
10216
10234
|
DOCKER_DRIVER: "overlay2",
|
|
10217
10235
|
DOCKER_BUILDKIT: "1", // see https://docs.docker.com/develop/develop-images/build_enhancements/
|
|
10218
10236
|
}); };
|
|
10237
|
+
var getDockerAdditions = function (build) {
|
|
10238
|
+
var _a, _b;
|
|
10239
|
+
if (!("docker" in build))
|
|
10240
|
+
return {};
|
|
10241
|
+
if (!build.docker)
|
|
10242
|
+
return {};
|
|
10243
|
+
return {
|
|
10244
|
+
DOCKERFILE_ADDITIONS: "additionsBegin" in build.docker
|
|
10245
|
+
? (_a = build.docker.additionsBegin) === null || _a === void 0 ? void 0 : _a.join("\n")
|
|
10246
|
+
: undefined,
|
|
10247
|
+
DOCKERFILE_ADDITIONS_END: "additionsEnd" in build.docker
|
|
10248
|
+
? (_b = build.docker.additionsEnd) === null || _b === void 0 ? void 0 : _b.join("\n")
|
|
10249
|
+
: undefined,
|
|
10250
|
+
};
|
|
10251
|
+
};
|
|
10219
10252
|
var getDockerBuildVariables = function (context) {
|
|
10220
|
-
|
|
10221
|
-
return __assign({ DOCKERFILE_ADDITIONS: (_b = (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"), DOCKERFILE_ADDITIONS_END: (_d = (_c = context.componentConfig.build.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"), APP_DIR: context.componentConfig.dir, DOCKER_DIR: "." }, (0, exports.getDockerImageVariables)(context));
|
|
10253
|
+
return __assign(__assign(__assign({}, getDockerAdditions(context.build.config)), { APP_DIR: context.build.dir, DOCKER_DIR: "." }), (0, exports.getDockerImageVariables)(context));
|
|
10222
10254
|
};
|
|
10223
10255
|
exports.getDockerBuildVariables = getDockerBuildVariables;
|
|
10224
10256
|
exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
|
|
10225
|
-
var getDockerJobBaseProps = function (
|
|
10257
|
+
var getDockerJobBaseProps = function () {
|
|
10226
10258
|
return {
|
|
10227
10259
|
image: (0, runner_1.getRunnerImage)("docker-build"),
|
|
10228
10260
|
services: [
|
|
@@ -10238,14 +10270,14 @@ var getDockerJobBaseProps = function (context) {
|
|
|
10238
10270
|
exports.getDockerJobBaseProps = getDockerJobBaseProps;
|
|
10239
10271
|
var createDockerBuildJobBase = function (context, _a) {
|
|
10240
10272
|
var script = _a.script, def = __rest(_a, ["script"]);
|
|
10241
|
-
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 || [] }), {
|
|
10242
10274
|
variables: (0, exports.getDockerBuildVariables)(context),
|
|
10243
10275
|
runnerVariables: __assign(__assign({}, DOCKER_BUILD_RUNNER_REQUESTS), getDockerBuildRunnerVariables()),
|
|
10244
10276
|
}, def);
|
|
10245
10277
|
};
|
|
10246
10278
|
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
10247
10279
|
var gitlabDockerLogin = function (context) {
|
|
10248
|
-
return (0, deploy_1.isOfDeployType)(context.
|
|
10280
|
+
return context.deploy && (0, deploy_1.isOfDeployType)(context.deploy.config, "google-cloudrun")
|
|
10249
10281
|
? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [
|
|
10250
10282
|
"gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context)),
|
|
10251
10283
|
], false) : [
|
|
@@ -10253,9 +10285,25 @@ var gitlabDockerLogin = function (context) {
|
|
|
10253
10285
|
];
|
|
10254
10286
|
};
|
|
10255
10287
|
exports.gitlabDockerLogin = gitlabDockerLogin;
|
|
10288
|
+
var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
|
|
10289
|
+
meteor: "ensureMeteorDockerfile",
|
|
10290
|
+
node: "ensureNodeDockerfile",
|
|
10291
|
+
nginx: "ensureNginxDockerfile",
|
|
10292
|
+
custom: null,
|
|
10293
|
+
};
|
|
10294
|
+
var getDockerBuildScriptWithBuiltInDockerFile = function (context, defaultType) {
|
|
10295
|
+
var _a;
|
|
10296
|
+
var type = "docker" in context.componentConfig.build &&
|
|
10297
|
+
context.componentConfig.build.docker &&
|
|
10298
|
+
"type" in context.componentConfig.build.docker
|
|
10299
|
+
? (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.type
|
|
10300
|
+
: defaultType;
|
|
10301
|
+
return (0, exports.getDockerBuildDefaultScript)(context, type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null);
|
|
10302
|
+
};
|
|
10303
|
+
exports.getDockerBuildScriptWithBuiltInDockerFile = getDockerBuildScriptWithBuiltInDockerFile;
|
|
10256
10304
|
var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
10257
10305
|
return __spreadArray(__spreadArray(__spreadArray([
|
|
10258
|
-
ensureDockerFileScript
|
|
10306
|
+
ensureDockerFileScript !== null && ensureDockerFileScript !== void 0 ? ensureDockerFileScript : undefined
|
|
10259
10307
|
], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")([
|
|
10260
10308
|
"docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1", //BUILDKIT_INLINE_CACHE, see https://testdriven.io/blog/faster-ci-builds-with-docker-cache/
|
|
10261
10309
|
])), false), __read((0, gitlab_1.collapseableSection)("docker-push", "Docker push and tag")([
|
|
@@ -10266,7 +10314,7 @@ var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
|
10266
10314
|
};
|
|
10267
10315
|
exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
|
|
10268
10316
|
var hasDockerfile = function (context) {
|
|
10269
|
-
return (0, fs_1.existsSync)(path_1.default.join(context.
|
|
10317
|
+
return (0, fs_1.existsSync)(path_1.default.join(context.build.dir, "Dockerfile"));
|
|
10270
10318
|
};
|
|
10271
10319
|
exports.hasDockerfile = hasDockerfile;
|
|
10272
10320
|
//# sourceMappingURL=docker.js.map
|
|
@@ -10387,23 +10435,23 @@ var constants_1 = __nccwpck_require__(31765);
|
|
|
10387
10435
|
var yarn_1 = __nccwpck_require__(45043);
|
|
10388
10436
|
var createNodeBuildJobs = function (context) {
|
|
10389
10437
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
10390
|
-
var buildConfig = context.
|
|
10438
|
+
var buildConfig = context.build.config;
|
|
10391
10439
|
if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
|
|
10392
10440
|
throw new Error("deploy config is not node, node-static or storybook");
|
|
10393
10441
|
}
|
|
10394
10442
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
10395
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
10443
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
10396
10444
|
return (0, base_1.createBuildJobs)(context, {
|
|
10397
10445
|
appBuild: buildConfig.buildCommand !== null
|
|
10398
10446
|
? {
|
|
10399
10447
|
image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
|
|
10400
10448
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
10401
|
-
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),
|
|
10402
10450
|
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
|
|
10403
10451
|
artifacts: {
|
|
10404
10452
|
paths: __spreadArray([
|
|
10405
|
-
context.
|
|
10406
|
-
], __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) {
|
|
10407
10455
|
var _a, _b;
|
|
10408
10456
|
return __spreadArray([
|
|
10409
10457
|
(0, path_1.join)(dir, "__build_info.json"),
|
|
@@ -10420,14 +10468,14 @@ var createNodeBuildJobs = function (context) {
|
|
|
10420
10468
|
}
|
|
10421
10469
|
: undefined,
|
|
10422
10470
|
dockerBuild: {
|
|
10423
|
-
script: (0, docker_1.
|
|
10424
|
-
? "
|
|
10425
|
-
: "
|
|
10426
|
-
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.
|
|
10471
|
+
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
|
|
10472
|
+
? "nginx"
|
|
10473
|
+
: "node"),
|
|
10474
|
+
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.build, "pull")), false),
|
|
10427
10475
|
variables: {
|
|
10428
10476
|
// only required for non static
|
|
10429
|
-
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.
|
|
10430
|
-
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"),
|
|
10431
10479
|
},
|
|
10432
10480
|
},
|
|
10433
10481
|
});
|
|
@@ -10527,7 +10575,7 @@ var getNextCache = function (context) { return [
|
|
|
10527
10575
|
{
|
|
10528
10576
|
key: context.componentName + "-next-cache",
|
|
10529
10577
|
policy: "pull-push",
|
|
10530
|
-
paths: [context.
|
|
10578
|
+
paths: [context.build.dir + "/.next/cache/"],
|
|
10531
10579
|
},
|
|
10532
10580
|
]; };
|
|
10533
10581
|
exports.getNextCache = getNextCache;
|
|
@@ -10646,23 +10694,23 @@ var getMeteorCache = function (context) { return [
|
|
|
10646
10694
|
key: context.componentName + "meteor-build-cache",
|
|
10647
10695
|
policy: "pull-push",
|
|
10648
10696
|
paths: [
|
|
10649
|
-
(0, path_1.join)(context.
|
|
10650
|
-
(0, path_1.join)(context.
|
|
10651
|
-
(0, path_1.join)(context.
|
|
10652
|
-
(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"),
|
|
10653
10701
|
],
|
|
10654
10702
|
},
|
|
10655
10703
|
]; };
|
|
10656
10704
|
var createMeteorBuildJobs = function (context) {
|
|
10657
|
-
var buildConfig = context.
|
|
10705
|
+
var buildConfig = context.build.config;
|
|
10658
10706
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
10659
10707
|
throw new Error("deploy config is not meteor");
|
|
10660
10708
|
}
|
|
10661
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
10709
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
10662
10710
|
return (0, base_1.createBuildJobs)(context, {
|
|
10663
10711
|
appBuild: buildConfig.buildCommand !== null
|
|
10664
10712
|
? {
|
|
10665
|
-
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),
|
|
10666
10714
|
image: (0, runner_1.getRunnerImage)("jobs-meteor"),
|
|
10667
10715
|
variables: {
|
|
10668
10716
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1", // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
@@ -10676,14 +10724,14 @@ var createMeteorBuildJobs = function (context) {
|
|
|
10676
10724
|
], false),
|
|
10677
10725
|
artifacts: {
|
|
10678
10726
|
paths: [
|
|
10679
|
-
context.
|
|
10680
|
-
context.
|
|
10727
|
+
context.build.dir + "/__build_info.json",
|
|
10728
|
+
context.build.dir + "/dist",
|
|
10681
10729
|
],
|
|
10682
10730
|
},
|
|
10683
10731
|
}
|
|
10684
10732
|
: undefined,
|
|
10685
10733
|
dockerBuild: {
|
|
10686
|
-
script: (0, docker_1.
|
|
10734
|
+
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, "meteor"),
|
|
10687
10735
|
variables: {
|
|
10688
10736
|
METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : "",
|
|
10689
10737
|
},
|
|
@@ -10751,32 +10799,32 @@ var createNodeTestJobs = function (context) {
|
|
|
10751
10799
|
if (context.trigger === "taggedRelease") {
|
|
10752
10800
|
return [];
|
|
10753
10801
|
}
|
|
10754
|
-
var buildConfig = context.
|
|
10802
|
+
var buildConfig = context.build.config;
|
|
10755
10803
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
10756
10804
|
var base = {
|
|
10757
|
-
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 : {})),
|
|
10758
10806
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
10759
10807
|
stage: "test",
|
|
10760
10808
|
needs: [],
|
|
10761
10809
|
envMode: "none",
|
|
10762
10810
|
};
|
|
10763
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
10811
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
10764
10812
|
var auditJob = buildConfig.audit !== false
|
|
10765
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([
|
|
10766
|
-
"cd ".concat(context.
|
|
10814
|
+
"cd ".concat(context.build.dir)
|
|
10767
10815
|
], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
|
|
10768
|
-
((_f = context.
|
|
10816
|
+
((_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic)
|
|
10769
10817
|
? "yarn audit"
|
|
10770
10818
|
: "yarn npm audit --environment production", // yarn 2
|
|
10771
|
-
])), 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;
|
|
10772
10820
|
var lintJob = buildConfig.lint !== false
|
|
10773
|
-
? __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.
|
|
10774
|
-
"cd ".concat(context.
|
|
10775
|
-
], 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;
|
|
10776
10824
|
var testJob = buildConfig.test !== false
|
|
10777
|
-
? __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.
|
|
10778
|
-
"cd ".concat(context.
|
|
10779
|
-
], 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;
|
|
10780
10828
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
10781
10829
|
};
|
|
10782
10830
|
exports.createNodeTestJobs = createNodeTestJobs;
|
|
@@ -10913,7 +10961,7 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
10913
10961
|
var types_1 = __nccwpck_require__(84466);
|
|
10914
10962
|
var createRailsBuildJobs = function (context) {
|
|
10915
10963
|
var _a, _b, _c;
|
|
10916
|
-
var buildConfig = context.
|
|
10964
|
+
var buildConfig = context.build.config;
|
|
10917
10965
|
if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
|
|
10918
10966
|
// should not happen
|
|
10919
10967
|
throw new Error("build type is not rails");
|
|
@@ -10937,10 +10985,10 @@ var createRailsBuildJobs = function (context) {
|
|
|
10937
10985
|
return (0, base_1.createBuildJobs)(context, {
|
|
10938
10986
|
appBuild: undefined,
|
|
10939
10987
|
dockerBuild: {
|
|
10940
|
-
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.
|
|
10988
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
|
|
10941
10989
|
// custom script
|
|
10942
10990
|
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
|
|
10943
|
-
"cd ".concat(context.
|
|
10991
|
+
"cd ".concat(context.build.dir),
|
|
10944
10992
|
"docker pull $DOCKER_CACHE_IMAGE || true",
|
|
10945
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"),
|
|
10946
10994
|
"chmod +x /usr/local/bin/pack",
|
|
@@ -11049,7 +11097,7 @@ var createRailsTestJobs = function (context) {
|
|
|
11049
11097
|
if (context.trigger === "taggedRelease") {
|
|
11050
11098
|
return [];
|
|
11051
11099
|
}
|
|
11052
|
-
var buildConfig = context.
|
|
11100
|
+
var buildConfig = context.build.config;
|
|
11053
11101
|
var base = {
|
|
11054
11102
|
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
|
|
11055
11103
|
stage: "test",
|
|
@@ -11071,20 +11119,20 @@ var createRailsTestJobs = function (context) {
|
|
|
11071
11119
|
};
|
|
11072
11120
|
var auditJob = buildConfig.audit !== false
|
|
11073
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([
|
|
11074
|
-
"cd ".concat(context.
|
|
11122
|
+
"cd ".concat(context.build.dir)
|
|
11075
11123
|
], __read(((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
11076
11124
|
"gem install bundler-audit",
|
|
11077
11125
|
"bundle audit check",
|
|
11078
11126
|
])), false), allow_failure: true }) : null;
|
|
11079
11127
|
var lintJob = buildConfig.lint !== false
|
|
11080
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([
|
|
11081
|
-
"cd ".concat(context.
|
|
11129
|
+
"cd ".concat(context.build.dir)
|
|
11082
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 : [
|
|
11083
11131
|
"bundle exec rubocop",
|
|
11084
11132
|
])), false) }) : null;
|
|
11085
11133
|
var testJob = buildConfig.test !== false
|
|
11086
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([
|
|
11087
|
-
"cd ".concat(context.
|
|
11135
|
+
"cd ".concat(context.build.dir)
|
|
11088
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 : [
|
|
11089
11137
|
"bundle exec rspec",
|
|
11090
11138
|
])), false) }) : null;
|
|
@@ -11107,12 +11155,12 @@ exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
|
|
|
11107
11155
|
exports.SBOM_FILE = "__sbom.json";
|
|
11108
11156
|
var createSbomBuildJob = function (context) {
|
|
11109
11157
|
var _a, _b, _c, _d, _e;
|
|
11110
|
-
var buildConfig = context.
|
|
11158
|
+
var buildConfig = context.build.config;
|
|
11111
11159
|
var defaultImage = "aquasec/trivy:0.38.3";
|
|
11112
11160
|
var defaultScript = [
|
|
11113
|
-
"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)
|
|
11114
11162
|
? "."
|
|
11115
|
-
: context.
|
|
11163
|
+
: context.build.dir),
|
|
11116
11164
|
];
|
|
11117
11165
|
var image = buildConfig.type === "custom" && buildConfig.sbom !== false
|
|
11118
11166
|
? (_c = (_b = buildConfig.sbom) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage
|
|
@@ -11738,7 +11786,7 @@ var sanitize = function (value) {
|
|
|
11738
11786
|
};
|
|
11739
11787
|
var getLabels = function (context) {
|
|
11740
11788
|
var _a, _b, _c;
|
|
11741
|
-
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 : {}));
|
|
11742
11790
|
return labels;
|
|
11743
11791
|
};
|
|
11744
11792
|
exports.getLabels = getLabels;
|
|
@@ -11777,6 +11825,17 @@ exports.getReviewSlug = getReviewSlug;
|
|
|
11777
11825
|
|
|
11778
11826
|
"use strict";
|
|
11779
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
|
+
};
|
|
11780
11839
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11781
11840
|
if (k2 === undefined) k2 = k;
|
|
11782
11841
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -11829,6 +11888,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
11829
11888
|
};
|
|
11830
11889
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11831
11890
|
exports.createContext = exports.createComponentContext = void 0;
|
|
11891
|
+
var lodash_1 = __nccwpck_require__(23255);
|
|
11832
11892
|
var build_1 = __nccwpck_require__(67862);
|
|
11833
11893
|
var deploy_1 = __nccwpck_require__(68483);
|
|
11834
11894
|
var utils_1 = __nccwpck_require__(32497);
|
|
@@ -11837,10 +11897,9 @@ var getEnvironmentContext_1 = __nccwpck_require__(13663);
|
|
|
11837
11897
|
__exportStar(__nccwpck_require__(45699), exports);
|
|
11838
11898
|
__exportStar(__nccwpck_require__(45133), exports);
|
|
11839
11899
|
var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
11840
|
-
var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
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) {
|
|
11844
11903
|
case 0:
|
|
11845
11904
|
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
11846
11905
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
@@ -11857,22 +11916,33 @@ var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, v
|
|
|
11857
11916
|
deploy: {},
|
|
11858
11917
|
};
|
|
11859
11918
|
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
11860
|
-
|
|
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 = {
|
|
11861
11924
|
fullConfig: ctx.config,
|
|
11862
11925
|
componentConfig: componentConfig,
|
|
11863
|
-
|
|
11864
|
-
dir:
|
|
11926
|
+
build: {
|
|
11927
|
+
dir: dir,
|
|
11865
11928
|
packageManagerInfo: ctx.packageManagerInfo,
|
|
11866
|
-
config:
|
|
11929
|
+
config: build,
|
|
11867
11930
|
},
|
|
11868
|
-
|
|
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,
|
|
11869
11941
|
};
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
_a.trigger = ctx.trigger,
|
|
11875
|
-
_a)];
|
|
11942
|
+
resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs)
|
|
11943
|
+
? customJobs(context)
|
|
11944
|
+
: customJobs;
|
|
11945
|
+
return [2 /*return*/, __assign(__assign({}, context), { customJobs: resolvedCustomJobs })];
|
|
11876
11946
|
}
|
|
11877
11947
|
});
|
|
11878
11948
|
}); };
|
|
@@ -12287,7 +12357,7 @@ var stop_1 = __nccwpck_require__(82846);
|
|
|
12287
12357
|
var variables_1 = __nccwpck_require__(82422);
|
|
12288
12358
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
12289
12359
|
var createDeployJob = function (context, jobDefinition) {
|
|
12290
|
-
var _a, _b, _c, _d, _e, _f;
|
|
12360
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
12291
12361
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
12292
12362
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
12293
12363
|
var autoStop = context.environment.envType === "review"
|
|
@@ -12295,14 +12365,13 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
12295
12365
|
: context.environment.envType === "dev"
|
|
12296
12366
|
? "4 weeks"
|
|
12297
12367
|
: undefined;
|
|
12368
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12298
12369
|
// if auto or manual is configured explicitly, use that
|
|
12299
|
-
var whenDeployDefined =
|
|
12300
|
-
? context.componentConfig.deploy.when
|
|
12301
|
-
: undefined;
|
|
12370
|
+
var whenDeployDefined = deployConfig && deployConfig.when ? deployConfig.when : undefined;
|
|
12302
12371
|
// otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
|
|
12303
12372
|
var whenDeployDefault = context.environment.envType !== "prod"
|
|
12304
12373
|
? "auto" // is not stage, auto deploy
|
|
12305
|
-
: ((
|
|
12374
|
+
: ((_b = context.componentConfig.env) === null || _b === void 0 ? void 0 : _b.stage) === false
|
|
12306
12375
|
? "auto" // is prod, but no staging, auto deploy
|
|
12307
12376
|
: "manual"; // manually deploy
|
|
12308
12377
|
var whenDeploy = whenDeployDefined ? whenDeployDefined : whenDeployDefault;
|
|
@@ -12316,12 +12385,12 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
12316
12385
|
envMode: "stagePerEnv", // makes it easier to run manual tasks er env
|
|
12317
12386
|
needs: __spreadArray(__spreadArray([], __read(((0, sbom_2.sbomDeactivated)(context)
|
|
12318
12387
|
? []
|
|
12319
|
-
: [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((
|
|
12320
|
-
? (
|
|
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 ({
|
|
12321
12390
|
componentName: c,
|
|
12322
12391
|
job: exports.DEPLOY_JOB_NAME,
|
|
12323
12392
|
artifacts: false,
|
|
12324
|
-
}); })) !== null &&
|
|
12393
|
+
}); })) !== null && _d !== void 0 ? _d : []
|
|
12325
12394
|
: [])), false),
|
|
12326
12395
|
// we don't want to deploy when there is a broken test
|
|
12327
12396
|
needsStages: [
|
|
@@ -12337,21 +12406,15 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
12337
12406
|
when: whenDeploy === "auto" ? "on_success" : "manual",
|
|
12338
12407
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
12339
12408
|
stage: "deploy",
|
|
12340
|
-
variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), (hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {})), context.environment.jobOnlyVars.deploy.envVars), (
|
|
12341
|
-
|
|
12342
|
-
: {})), jobDefinition.variables),
|
|
12343
|
-
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), ((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {})), (context.componentConfig.deploy
|
|
12344
|
-
? (_f = context.componentConfig.deploy.runnerVariables) !== null && _f !== void 0 ? _f : {}
|
|
12345
|
-
: {})),
|
|
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 : {} : {})),
|
|
12346
12411
|
environment: isStoppable
|
|
12347
12412
|
? {
|
|
12348
12413
|
on_stop: stop_1.STOP_JOB_NAME,
|
|
12349
12414
|
auto_stop_in: autoStop,
|
|
12350
12415
|
}
|
|
12351
12416
|
: undefined,
|
|
12352
|
-
jobTags:
|
|
12353
|
-
? context.componentConfig.deploy.jobTags
|
|
12354
|
-
: undefined,
|
|
12417
|
+
jobTags: deployConfig ? deployConfig.jobTags : undefined,
|
|
12355
12418
|
};
|
|
12356
12419
|
};
|
|
12357
12420
|
exports.createDeployJob = createDeployJob;
|
|
@@ -12549,17 +12612,18 @@ var BashExpression_1 = __nccwpck_require__(42376);
|
|
|
12549
12612
|
var gitlab_1 = __nccwpck_require__(38490);
|
|
12550
12613
|
var types_1 = __nccwpck_require__(75781);
|
|
12551
12614
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(74398);
|
|
12552
|
-
var getArtifactsRegistryHost = function (
|
|
12553
|
-
var
|
|
12554
|
-
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")) {
|
|
12555
12618
|
// should not happen
|
|
12556
12619
|
throw new Error("deploy config is wrong");
|
|
12557
12620
|
}
|
|
12558
|
-
return "".concat(deploy.region, "-docker.pkg.dev");
|
|
12621
|
+
return "".concat(context.deploy.config.region, "-docker.pkg.dev");
|
|
12559
12622
|
};
|
|
12560
12623
|
exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
|
|
12561
12624
|
var getArtifactsRegistryDockerUrl = function (context) {
|
|
12562
|
-
var
|
|
12625
|
+
var _a;
|
|
12626
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12563
12627
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12564
12628
|
// should not happen
|
|
12565
12629
|
throw new Error("deploy config is wrong");
|
|
@@ -12622,11 +12686,9 @@ var getDeleteImageCommands = function (fullImageName, keepNewest) {
|
|
|
12622
12686
|
* @returns
|
|
12623
12687
|
*/
|
|
12624
12688
|
var getDeleteUnusedImagesCommands = function (context, keep) {
|
|
12689
|
+
var _a;
|
|
12625
12690
|
if (keep === void 0) { keep = 0; }
|
|
12626
|
-
var deployConfig = context.
|
|
12627
|
-
if (deployConfig === false) {
|
|
12628
|
-
return [];
|
|
12629
|
-
}
|
|
12691
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12630
12692
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12631
12693
|
// should not happen
|
|
12632
12694
|
throw new Error("deploy config is wrong");
|
|
@@ -12717,8 +12779,9 @@ var createArgsString_1 = __nccwpck_require__(49598);
|
|
|
12717
12779
|
var getServiceName_1 = __nccwpck_require__(38128);
|
|
12718
12780
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(74398);
|
|
12719
12781
|
var getListRevisionsCommand = function (context, args) {
|
|
12782
|
+
var _a;
|
|
12720
12783
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
12721
|
-
var deployConfig = context.
|
|
12784
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12722
12785
|
if (!deployConfig || !(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12723
12786
|
// should not happen
|
|
12724
12787
|
throw new Error("deploy config is wrong");
|
|
@@ -12730,10 +12793,8 @@ var getListRevisionsCommand = function (context, args) {
|
|
|
12730
12793
|
return "gcloud run revisions list ".concat((0, createArgsString_1.createArgsString)(filterRevisionArgs));
|
|
12731
12794
|
};
|
|
12732
12795
|
var getDeleteUnusedRevisionsCommands = function (context, keep) {
|
|
12733
|
-
var
|
|
12734
|
-
|
|
12735
|
-
return [];
|
|
12736
|
-
}
|
|
12796
|
+
var _a;
|
|
12797
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12737
12798
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12738
12799
|
// should not happen
|
|
12739
12800
|
throw new Error("deploy config is wrong");
|
|
@@ -13002,7 +13063,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
|
13002
13063
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
13003
13064
|
var customConfig = service !== true ? service : undefined;
|
|
13004
13065
|
var command = service !== true
|
|
13005
|
-
? (_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
|
|
13006
13067
|
: undefined;
|
|
13007
13068
|
var commandArray = command
|
|
13008
13069
|
? Array.isArray(command)
|
|
@@ -13097,7 +13158,8 @@ var makeLabelString = function (obj) {
|
|
|
13097
13158
|
};
|
|
13098
13159
|
exports.makeLabelString = makeLabelString;
|
|
13099
13160
|
var getCloudRunDeployConfig = function (context) {
|
|
13100
|
-
var
|
|
13161
|
+
var _a;
|
|
13162
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13101
13163
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
13102
13164
|
// should not happen
|
|
13103
13165
|
throw new Error("deploy config is wrong");
|
|
@@ -13279,10 +13341,8 @@ var constants_1 = __nccwpck_require__(38865);
|
|
|
13279
13341
|
var getCloudRunDeployScripts_1 = __nccwpck_require__(53695);
|
|
13280
13342
|
var getCloudRunStopScripts_1 = __nccwpck_require__(33747);
|
|
13281
13343
|
var createGoogleCloudRunDeployJobs = function (context) {
|
|
13282
|
-
var
|
|
13283
|
-
|
|
13284
|
-
return [];
|
|
13285
|
-
}
|
|
13344
|
+
var _a;
|
|
13345
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13286
13346
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
13287
13347
|
// should not happen
|
|
13288
13348
|
throw new Error("deploy config is wrong");
|
|
@@ -13762,31 +13822,28 @@ var base_1 = __nccwpck_require__(84052);
|
|
|
13762
13822
|
var sbom_1 = __nccwpck_require__(44986);
|
|
13763
13823
|
var types_1 = __nccwpck_require__(75781);
|
|
13764
13824
|
var createCustomDeployJobs = function (context) {
|
|
13765
|
-
var _a, _b, _c;
|
|
13766
|
-
var deployConfig = context.
|
|
13767
|
-
if (deployConfig === false) {
|
|
13768
|
-
return [];
|
|
13769
|
-
}
|
|
13825
|
+
var _a, _b, _c, _d;
|
|
13826
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13770
13827
|
if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
|
|
13771
13828
|
// should not happen
|
|
13772
13829
|
throw new Error("deploy config is not custom");
|
|
13773
13830
|
}
|
|
13774
13831
|
// FIXME: custom deploy currently assumes yarn-based project
|
|
13775
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context.
|
|
13832
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build, {
|
|
13776
13833
|
noCustomPostInstall: true,
|
|
13777
13834
|
});
|
|
13778
13835
|
return (0, base_1.createDeployementJobs)(context, {
|
|
13779
13836
|
deploy: {
|
|
13780
|
-
image: (
|
|
13781
|
-
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 : [],
|
|
13782
13839
|
script: __spreadArray(__spreadArray(__spreadArray([
|
|
13783
|
-
"cd ".concat(context.
|
|
13840
|
+
"cd ".concat(context.build.dir)
|
|
13784
13841
|
], __read((deployConfig.requiresYarnInstall ? yarnInstall : [])), false), __read(deployConfig.script), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false),
|
|
13785
13842
|
variables: {},
|
|
13786
13843
|
},
|
|
13787
13844
|
stop: deployConfig.stopScript
|
|
13788
13845
|
? {
|
|
13789
|
-
image: (
|
|
13846
|
+
image: (_d = deployConfig.jobImage) !== null && _d !== void 0 ? _d : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
13790
13847
|
script: __spreadArray(__spreadArray([], __read(deployConfig.stopScript), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false),
|
|
13791
13848
|
variables: {},
|
|
13792
13849
|
}
|
|
@@ -13863,17 +13920,15 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
13863
13920
|
var base_1 = __nccwpck_require__(84052);
|
|
13864
13921
|
var types_1 = __nccwpck_require__(75781);
|
|
13865
13922
|
var createDockerTagDeployJobs = function (context) {
|
|
13866
|
-
var
|
|
13867
|
-
|
|
13868
|
-
return [];
|
|
13869
|
-
}
|
|
13923
|
+
var _a;
|
|
13924
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13870
13925
|
if (!(0, types_1.isOfDeployType)(deployConfig, "dockerTag")) {
|
|
13871
13926
|
// should not happen
|
|
13872
13927
|
throw new Error("deploy config is not dockerTag");
|
|
13873
13928
|
}
|
|
13874
13929
|
var tag = deployConfig.tag;
|
|
13875
13930
|
return (0, base_1.createDeployementJobs)(context, {
|
|
13876
|
-
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), [
|
|
13877
13932
|
"docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG",
|
|
13878
13933
|
"docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag),
|
|
13879
13934
|
"docker push $DOCKER_IMAGE:".concat(tag),
|
|
@@ -13985,32 +14040,34 @@ var context_1 = __nccwpck_require__(5875);
|
|
|
13985
14040
|
var utils_1 = __nccwpck_require__(62089);
|
|
13986
14041
|
var types_1 = __nccwpck_require__(75781);
|
|
13987
14042
|
var hasKubernetesCloudSQL = function (context) {
|
|
13988
|
-
var _a, _b;
|
|
13989
|
-
|
|
13990
|
-
|
|
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;
|
|
13991
14047
|
}
|
|
13992
14048
|
return false;
|
|
13993
14049
|
};
|
|
13994
14050
|
exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
|
|
13995
14051
|
var createKubernetesCloudsqlBaseValues = function (context) {
|
|
13996
|
-
var _a, _b, _c, _d, _e, _f;
|
|
13997
|
-
|
|
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")) {
|
|
13998
14055
|
throw new Error("cannot get cloud sql config");
|
|
13999
14056
|
}
|
|
14000
|
-
var config = (
|
|
14057
|
+
var config = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql;
|
|
14001
14058
|
if (!config) {
|
|
14002
14059
|
throw new Error("cannot get cloud sql config");
|
|
14003
14060
|
}
|
|
14004
14061
|
var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
|
|
14005
14062
|
if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
|
|
14006
|
-
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);
|
|
14007
14064
|
return {
|
|
14008
14065
|
cloudsql: {
|
|
14009
14066
|
enabled: config.enabled,
|
|
14010
14067
|
dbUser: "postgres",
|
|
14011
14068
|
instanceConnectionName: instanceConnectionName,
|
|
14012
14069
|
proxyCredentials: proxyCredentials,
|
|
14013
|
-
fullDbName: (
|
|
14070
|
+
fullDbName: (_f = context.environment.envVars.KUBE_APP_NAME) !== null && _f !== void 0 ? _f : "",
|
|
14014
14071
|
},
|
|
14015
14072
|
};
|
|
14016
14073
|
}
|
|
@@ -14018,7 +14075,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
|
|
|
14018
14075
|
return {
|
|
14019
14076
|
cloudsql: {
|
|
14020
14077
|
enabled: config.enabled,
|
|
14021
|
-
dbUser: (
|
|
14078
|
+
dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
|
|
14022
14079
|
instanceConnectionName: config.instanceConnectionName,
|
|
14023
14080
|
proxyCredentials: proxyCredentials,
|
|
14024
14081
|
fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName),
|
|
@@ -14087,11 +14144,8 @@ var bashYaml_1 = __nccwpck_require__(54660);
|
|
|
14087
14144
|
var gitlab_1 = __nccwpck_require__(38490);
|
|
14088
14145
|
var ALL_VALUES_FILE = "__all_values.yml";
|
|
14089
14146
|
var createKubernetesDeployJobs = function (context) {
|
|
14090
|
-
var _a, _b;
|
|
14091
|
-
var deployConfig = context.
|
|
14092
|
-
if (deployConfig === false) {
|
|
14093
|
-
return [];
|
|
14094
|
-
}
|
|
14147
|
+
var _a, _b, _c;
|
|
14148
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14095
14149
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
14096
14150
|
// should not happen
|
|
14097
14151
|
throw new Error("deploy config is not kubernetes");
|
|
@@ -14105,7 +14159,7 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
14105
14159
|
when: "always",
|
|
14106
14160
|
},
|
|
14107
14161
|
}
|
|
14108
|
-
: {})), { 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,
|
|
14109
14163
|
/** @deprecated */
|
|
14110
14164
|
BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID }) });
|
|
14111
14165
|
var clusterName = "kube-".concat(context.environment.fullName);
|
|
@@ -14271,7 +14325,8 @@ var shouldGoIntoSecrets = function (key, value) {
|
|
|
14271
14325
|
* we evalulate the actual values later, but want to store the secrets in kubernetes secrets
|
|
14272
14326
|
*/
|
|
14273
14327
|
var createKubeEnv = function (context) {
|
|
14274
|
-
|
|
14328
|
+
var _a;
|
|
14329
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
14275
14330
|
// should not happen
|
|
14276
14331
|
throw new Error("deploy config is not kubernetes");
|
|
14277
14332
|
}
|
|
@@ -14357,7 +14412,7 @@ var createAppConfig = function (context, application) {
|
|
|
14357
14412
|
var _a = application !== null && application !== void 0 ? application : {}, healthRoute = _a.healthRoute, command = _a.command, rest = __rest(_a, ["healthRoute", "command"]);
|
|
14358
14413
|
return (0, utils_1.mergeWithMergingArrays)({
|
|
14359
14414
|
host: context.environment.host,
|
|
14360
|
-
command: command !== null && command !== void 0 ? command : context.
|
|
14415
|
+
command: command !== null && command !== void 0 ? command : context.build.config.startCommand,
|
|
14361
14416
|
livenessProbe: {
|
|
14362
14417
|
httpGet: {
|
|
14363
14418
|
path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health",
|
|
@@ -14385,9 +14440,9 @@ var removeFalsy = function (record) {
|
|
|
14385
14440
|
}));
|
|
14386
14441
|
};
|
|
14387
14442
|
var createKubeValues = function (context) {
|
|
14388
|
-
var _a, _b;
|
|
14389
|
-
var deployConfig = context.
|
|
14390
|
-
if (deployConfig
|
|
14443
|
+
var _a, _b, _c;
|
|
14444
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14445
|
+
if (!deployConfig) {
|
|
14391
14446
|
return [];
|
|
14392
14447
|
}
|
|
14393
14448
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
@@ -14397,14 +14452,14 @@ var createKubeValues = function (context) {
|
|
|
14397
14452
|
var values = deployConfig.values;
|
|
14398
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
|
|
14399
14454
|
// we only merge the rest of the values in
|
|
14400
|
-
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"]);
|
|
14401
14456
|
var env = (0, kubeEnv_1.createKubeEnv)(context);
|
|
14402
14457
|
var defaultKubeValues = (0, lodash_1.merge)({
|
|
14403
14458
|
env: env,
|
|
14404
14459
|
application: createAppConfig(context, application),
|
|
14405
14460
|
}, (0, cloudSql_1.hasKubernetesCloudSQL)(context)
|
|
14406
14461
|
? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context)
|
|
14407
|
-
: {}, ((
|
|
14462
|
+
: {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled)
|
|
14408
14463
|
? (0, mongodb_1.createMongodbBaseConfig)(context)
|
|
14409
14464
|
: {});
|
|
14410
14465
|
var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({ jobs: removeFalsy(jobs), cronjobs: removeFalsy(cronjobs) }, rest)));
|
|
@@ -14452,15 +14507,15 @@ var getMongodbReplicasetHost = function (context, index) {
|
|
|
14452
14507
|
return getMongodbHost(context, "".concat(fullAppname, "-mongodb-").concat(index, ".").concat(fullAppname, "-mongodb-headless"));
|
|
14453
14508
|
};
|
|
14454
14509
|
var createMongodbUrl = function (context, dbName) {
|
|
14455
|
-
var _a, _b;
|
|
14456
|
-
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")) {
|
|
14457
14512
|
throw new Error("can only createMongodbUrl on supported deploys");
|
|
14458
14513
|
}
|
|
14459
|
-
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;
|
|
14460
14515
|
var queryParams = undefined;
|
|
14461
14516
|
var hosts = "";
|
|
14462
14517
|
if ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset") {
|
|
14463
|
-
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)
|
|
14464
14519
|
.map(function (i) { return getMongodbReplicasetHost(context, i); })
|
|
14465
14520
|
.join(",");
|
|
14466
14521
|
queryParams = "replicaSet=rs0&authSource=admin";
|
|
@@ -14472,11 +14527,11 @@ var createMongodbUrl = function (context, dbName) {
|
|
|
14472
14527
|
return "mongodb://".concat(getCredentialString(context)).concat(hosts, "/").concat(dbName).concat(queryParams ? "?".concat(queryParams) : "");
|
|
14473
14528
|
};
|
|
14474
14529
|
var createMongoBackupDefaultConfig = function (context) {
|
|
14475
|
-
var _a;
|
|
14476
|
-
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")) {
|
|
14477
14532
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
14478
14533
|
}
|
|
14479
|
-
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;
|
|
14480
14535
|
var fullAppName = context.environment.envVars.KUBE_APP_NAME;
|
|
14481
14536
|
var backupEnabled = ["prod", "stage"].includes(context.environment.envType);
|
|
14482
14537
|
var hostToBackup;
|
|
@@ -14506,11 +14561,11 @@ var createMongoBackupDefaultConfig = function (context) {
|
|
|
14506
14561
|
};
|
|
14507
14562
|
};
|
|
14508
14563
|
var createMongodbBaseConfig = function (context) {
|
|
14509
|
-
var _a, _b;
|
|
14510
|
-
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")) {
|
|
14511
14566
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
14512
14567
|
}
|
|
14513
|
-
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;
|
|
14514
14569
|
return {
|
|
14515
14570
|
mongodb: {
|
|
14516
14571
|
enabled: true,
|
|
@@ -14525,7 +14580,7 @@ var createMongodbBaseConfig = function (context) {
|
|
|
14525
14580
|
backup: createMongoBackupDefaultConfig(context),
|
|
14526
14581
|
},
|
|
14527
14582
|
env: {
|
|
14528
|
-
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"
|
|
14529
14584
|
? { MONGO_OPLOG_URL: createMongodbUrl(context, "local") } // oplog only works with replicasets
|
|
14530
14585
|
: {})),
|
|
14531
14586
|
},
|
|
@@ -14581,8 +14636,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
14581
14636
|
exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
|
|
14582
14637
|
var sbom_1 = __nccwpck_require__(37038);
|
|
14583
14638
|
var sbomDeactivated = function (context) {
|
|
14584
|
-
return context.
|
|
14585
|
-
context.componentConfig.build.sbom === false;
|
|
14639
|
+
return context.build.config.type === "custom" && context.build.config.sbom === false;
|
|
14586
14640
|
};
|
|
14587
14641
|
exports.sbomDeactivated = sbomDeactivated;
|
|
14588
14642
|
var getDependencyTrackUploadScript = function (context) {
|
|
@@ -14667,7 +14721,7 @@ var isOfDeployType = function (t) {
|
|
|
14667
14721
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
14668
14722
|
types[_i - 1] = arguments[_i];
|
|
14669
14723
|
}
|
|
14670
|
-
return t && types.includes(t.type);
|
|
14724
|
+
return t && types.includes(t.type) ? true : false;
|
|
14671
14725
|
};
|
|
14672
14726
|
exports.isOfDeployType = isOfDeployType;
|
|
14673
14727
|
//# sourceMappingURL=index.js.map
|
|
@@ -14703,7 +14757,8 @@ var getKubernetesNamespace = function (config, env) {
|
|
|
14703
14757
|
};
|
|
14704
14758
|
exports.getKubernetesNamespace = getKubernetesNamespace;
|
|
14705
14759
|
var contextIsStoppable = function (context) {
|
|
14706
|
-
var
|
|
14760
|
+
var _a;
|
|
14761
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14707
14762
|
if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
14708
14763
|
return true;
|
|
14709
14764
|
}
|
|
@@ -15039,7 +15094,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
15039
15094
|
};
|
|
15040
15095
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
15041
15096
|
exports.createJobsForComponent = void 0;
|
|
15042
|
-
var lodash_1 = __nccwpck_require__(23255);
|
|
15043
15097
|
var build_1 = __nccwpck_require__(67862);
|
|
15044
15098
|
var context_1 = __nccwpck_require__(5875);
|
|
15045
15099
|
var deploy_1 = __nccwpck_require__(68483);
|
|
@@ -15052,18 +15106,17 @@ var injectDefaultVarsInCustomJobs = function (context, jobs) {
|
|
|
15052
15106
|
});
|
|
15053
15107
|
};
|
|
15054
15108
|
var getCustomJobs = function (context) {
|
|
15055
|
-
if (!context.
|
|
15109
|
+
if (!context.customJobs) {
|
|
15056
15110
|
return [];
|
|
15057
15111
|
}
|
|
15058
|
-
var rawJobs =
|
|
15059
|
-
? context.componentConfig.customJobs(context)
|
|
15060
|
-
: context.componentConfig.customJobs;
|
|
15112
|
+
var rawJobs = context.customJobs;
|
|
15061
15113
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
15062
15114
|
};
|
|
15063
15115
|
var createRawJobs = function (context) {
|
|
15064
|
-
var
|
|
15065
|
-
var
|
|
15066
|
-
|
|
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)
|
|
15067
15120
|
: [];
|
|
15068
15121
|
var customJobs = getCustomJobs(context);
|
|
15069
15122
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|