@catladder/cli 0.0.0-main-93f3e75d → 0.0.0-main-45f6e733
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/catenv/index.js +251 -202
- package/dist/bundles/cli/index.js +369 -307
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +22 -19
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandOpenDashboard.js +10 -9
- package/dist/cli/src/apps/cli/commands/project/commandOpenDashboard.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandPortForward.js +18 -16
- package/dist/cli/src/apps/cli/commands/project/commandPortForward.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +10 -9
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupContext.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js +9 -8
- package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +23 -22
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js +10 -9
- package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
- package/dist/cli/src/config/getProjectConfig.d.ts +2 -2
- package/dist/cli/src/config/getProjectConfig.js +1 -1
- package/dist/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.d.ts +2 -2
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js +6 -5
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -1
- package/dist/cli/src/gcloud/serviceAccounts.d.ts +2 -2
- package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
- package/dist/cli/src/kubernetes/openKubernetesDashboards.d.ts +3 -3
- package/dist/cli/src/kubernetes/openKubernetesDashboards.js +10 -8
- package/dist/cli/src/kubernetes/openKubernetesDashboards.js.map +1 -1
- package/dist/pipeline/src/build/base/createAppBuildJob.d.ts +2 -2
- package/dist/pipeline/src/build/base/createAppBuildJob.js +8 -6
- package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
- package/dist/pipeline/src/build/base/index.d.ts +2 -2
- package/dist/pipeline/src/build/base/index.js.map +1 -1
- package/dist/pipeline/src/build/base/writeBuildInfo.d.ts +2 -2
- package/dist/pipeline/src/build/base/writeBuildInfo.js +1 -1
- package/dist/pipeline/src/build/base/writeBuildInfo.js.map +1 -1
- package/dist/pipeline/src/build/base/writeDotEnv.d.ts +2 -2
- package/dist/pipeline/src/build/base/writeDotEnv.js +1 -1
- package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
- package/dist/pipeline/src/build/custom/buildJob.d.ts +2 -2
- package/dist/pipeline/src/build/custom/buildJob.js +6 -6
- package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/custom/index.d.ts +2 -2
- package/dist/pipeline/src/build/custom/index.js.map +1 -1
- package/dist/pipeline/src/build/custom/testJob.d.ts +2 -2
- package/dist/pipeline/src/build/custom/testJob.js +5 -5
- package/dist/pipeline/src/build/custom/testJob.js.map +1 -1
- package/dist/pipeline/src/build/docker.d.ts +32 -11
- package/dist/pipeline/src/build/docker.js +50 -17
- package/dist/pipeline/src/build/docker.js.map +1 -1
- package/dist/pipeline/src/build/index.d.ts +2 -2
- package/dist/pipeline/src/build/node/buildJob.d.ts +2 -2
- package/dist/pipeline/src/build/node/buildJob.js +11 -11
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.d.ts +5 -5
- package/dist/pipeline/src/build/node/cache.js +5 -5
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/node/index.d.ts +4 -4
- package/dist/pipeline/src/build/node/index.js.map +1 -1
- package/dist/pipeline/src/build/node/meteor.d.ts +2 -2
- package/dist/pipeline/src/build/node/meteor.js +10 -10
- package/dist/pipeline/src/build/node/meteor.js.map +1 -1
- package/dist/pipeline/src/build/node/testJob.d.ts +2 -2
- package/dist/pipeline/src/build/node/testJob.js +12 -12
- package/dist/pipeline/src/build/node/testJob.js.map +1 -1
- package/dist/pipeline/src/build/node/yarn.d.ts +4 -4
- package/dist/pipeline/src/build/node/yarn.js +1 -3
- package/dist/pipeline/src/build/node/yarn.js.map +1 -1
- package/dist/pipeline/src/build/rails/build.d.ts +2 -2
- package/dist/pipeline/src/build/rails/build.js +3 -3
- package/dist/pipeline/src/build/rails/build.js.map +1 -1
- package/dist/pipeline/src/build/rails/index.d.ts +2 -2
- package/dist/pipeline/src/build/rails/index.js.map +1 -1
- package/dist/pipeline/src/build/rails/test.d.ts +2 -2
- package/dist/pipeline/src/build/rails/test.js +4 -4
- package/dist/pipeline/src/build/rails/test.js.map +1 -1
- package/dist/pipeline/src/build/sbom.d.ts +2 -2
- package/dist/pipeline/src/build/sbom.js +3 -3
- package/dist/pipeline/src/build/sbom.js.map +1 -1
- package/dist/pipeline/src/build/types.d.ts +33 -25
- package/dist/pipeline/src/build/types.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironment.d.ts +2 -2
- package/dist/pipeline/src/context/getEnvironment.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentContext.d.ts +2 -2
- package/dist/pipeline/src/context/getEnvironmentContext.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +4 -4
- package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
- package/dist/pipeline/src/context/getLabels.d.ts +2 -2
- package/dist/pipeline/src/context/getLabels.js +1 -1
- package/dist/pipeline/src/context/getLabels.js.map +1 -1
- package/dist/pipeline/src/context/index.d.ts +7 -3
- package/dist/pipeline/src/context/index.js +46 -15
- package/dist/pipeline/src/context/index.js.map +1 -1
- package/dist/pipeline/src/deploy/base/deploy.d.ts +2 -2
- package/dist/pipeline/src/deploy/base/deploy.js +10 -17
- package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
- package/dist/pipeline/src/deploy/base/index.d.ts +2 -2
- package/dist/pipeline/src/deploy/base/index.js.map +1 -1
- package/dist/pipeline/src/deploy/base/rollback.d.ts +2 -2
- package/dist/pipeline/src/deploy/base/rollback.js.map +1 -1
- package/dist/pipeline/src/deploy/base/stop.d.ts +2 -2
- package/dist/pipeline/src/deploy/base/stop.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.d.ts +7 -7
- package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js +8 -9
- package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/cleanup.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/cleanup.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.js +4 -5
- package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.d.ts +6 -6
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.d.ts +3 -3
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js +2 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/index.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/index.js +2 -4
- package/dist/pipeline/src/deploy/cloudRun/createJobs/index.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/database.d.ts +3 -3
- package/dist/pipeline/src/deploy/cloudRun/utils/database.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.d.ts +2 -2
- package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.js.map +1 -1
- package/dist/pipeline/src/deploy/custom/deployJob.d.ts +2 -2
- package/dist/pipeline/src/deploy/custom/deployJob.js +9 -10
- package/dist/pipeline/src/deploy/custom/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/dockerTag/deployJob.d.ts +2 -2
- package/dist/pipeline/src/deploy/dockerTag/deployJob.js +3 -5
- package/dist/pipeline/src/deploy/dockerTag/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/index.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.d.ts +3 -3
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js +11 -9
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/deployJob.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/deployJob.js +3 -6
- package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeEnv.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/kubeEnv.js +2 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeEnv.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.js +6 -6
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/mongodb.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/mongodb.js +11 -11
- package/dist/pipeline/src/deploy/kubernetes/mongodb.js.map +1 -1
- package/dist/pipeline/src/deploy/sbom.d.ts +4 -4
- package/dist/pipeline/src/deploy/sbom.js +1 -2
- package/dist/pipeline/src/deploy/sbom.js.map +1 -1
- package/dist/pipeline/src/deploy/types/index.d.ts +1 -1
- package/dist/pipeline/src/deploy/types/index.js +1 -1
- package/dist/pipeline/src/deploy/types/index.js.map +1 -1
- package/dist/pipeline/src/deploy/utils.d.ts +2 -2
- package/dist/pipeline/src/deploy/utils.js +2 -1
- package/dist/pipeline/src/deploy/utils.js.map +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.d.ts +2 -2
- package/dist/pipeline/src/pipeline/createJobsForComponent.js +7 -9
- package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
- package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
- package/dist/pipeline/src/types/config.d.ts +2 -2
- package/dist/pipeline/src/types/context.d.ts +28 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +9 -12
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +2 -2
- package/src/apps/cli/commands/project/commandPortForward.ts +9 -6
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +4 -4
- package/src/apps/cli/commands/project/setup/setupContext.ts +4 -4
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +3 -3
- package/src/apps/cli/commands/project/utils/ensureCluster.ts +2 -4
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +2 -2
- package/src/config/getProjectConfig.ts +2 -2
- package/src/gcloud/cloudRun/openCloudRunDashboards.ts +4 -4
- package/src/gcloud/serviceAccounts.ts +3 -3
- package/src/kubernetes/openKubernetesDashboards.ts +5 -5
|
@@ -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
|
});
|
|
@@ -6513,7 +6523,7 @@ var getPipelineContextByChoice = function (env, componentName) { return __awaite
|
|
|
6513
6523
|
case 0: return [4 /*yield*/, (0, exports.getProjectConfig)()];
|
|
6514
6524
|
case 1:
|
|
6515
6525
|
config = _a.sent();
|
|
6516
|
-
return [4 /*yield*/, (0, pipeline_1.
|
|
6526
|
+
return [4 /*yield*/, (0, pipeline_1.createComponentContext)({
|
|
6517
6527
|
config: config,
|
|
6518
6528
|
componentName: componentName,
|
|
6519
6529
|
env: env,
|
|
@@ -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)), false), [
|
|
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)), false), __read((0, cache_1.getNextCache)(context)), false),
|
|
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.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : [])), false).flatMap(function (dir) {
|
|
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, "pull")), false),
|
|
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.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"),
|
|
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
|
});
|
|
@@ -10487,9 +10535,9 @@ var getYarnCache = function (context, policy) {
|
|
|
10487
10535
|
paths: [".yarn"],
|
|
10488
10536
|
}
|
|
10489
10537
|
: {
|
|
10490
|
-
key: (0, slugify_1.default)(context.
|
|
10538
|
+
key: (0, slugify_1.default)(context.dir) + "-yarn",
|
|
10491
10539
|
policy: policy,
|
|
10492
|
-
paths: [(0, path_1.join)(context.
|
|
10540
|
+
paths: [(0, path_1.join)(context.dir, ".yarn")],
|
|
10493
10541
|
},
|
|
10494
10542
|
];
|
|
10495
10543
|
};
|
|
@@ -10505,7 +10553,7 @@ var getNodeModulesCache = function (context, policy) {
|
|
|
10505
10553
|
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
10506
10554
|
key: componentIsInWorkspace
|
|
10507
10555
|
? "node-modules-workspace"
|
|
10508
|
-
: (0, slugify_1.default)(context.
|
|
10556
|
+
: (0, slugify_1.default)(context.dir) + "-node-modules", // we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
|
|
10509
10557
|
policy: policy,
|
|
10510
10558
|
paths: __spreadArray([], __read((componentIsInWorkspace
|
|
10511
10559
|
? (0, lodash_1.uniq)(__spreadArray([
|
|
@@ -10513,7 +10561,7 @@ var getNodeModulesCache = function (context, policy) {
|
|
|
10513
10561
|
], __read(((_c = (_b = context.packageManagerInfo) === null || _b === void 0 ? void 0 : _b.workspaces.map(function (w) {
|
|
10514
10562
|
return (0, path_1.join)(w.location, "node_modules");
|
|
10515
10563
|
})) !== null && _c !== void 0 ? _c : [])), false))
|
|
10516
|
-
: [(0, path_1.join)(context.
|
|
10564
|
+
: [(0, path_1.join)(context.dir, "node_modules")])), false),
|
|
10517
10565
|
},
|
|
10518
10566
|
];
|
|
10519
10567
|
};
|
|
@@ -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)), false), __read(getMeteorCache(context)), false),
|
|
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.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic)
|
|
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), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), [
|
|
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), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), [
|
|
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;
|
|
@@ -10838,9 +10886,7 @@ var ensureNodeVersion = function (context) {
|
|
|
10838
10886
|
exports.ensureNodeVersion = ensureNodeVersion;
|
|
10839
10887
|
var getYarnInstall = function (context, options) {
|
|
10840
10888
|
var _a;
|
|
10841
|
-
var postInstall = "postInstall" in context.
|
|
10842
|
-
? context.componentConfig.build.postInstall
|
|
10843
|
-
: null;
|
|
10889
|
+
var postInstall = "postInstall" in context.config ? context.config.postInstall : null;
|
|
10844
10890
|
return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read((postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall)
|
|
10845
10891
|
? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : [])
|
|
10846
10892
|
: [])), false);
|
|
@@ -10915,7 +10961,7 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
10915
10961
|
var types_1 = __nccwpck_require__(84466);
|
|
10916
10962
|
var createRailsBuildJobs = function (context) {
|
|
10917
10963
|
var _a, _b, _c;
|
|
10918
|
-
var buildConfig = context.
|
|
10964
|
+
var buildConfig = context.build.config;
|
|
10919
10965
|
if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
|
|
10920
10966
|
// should not happen
|
|
10921
10967
|
throw new Error("build type is not rails");
|
|
@@ -10939,10 +10985,10 @@ var createRailsBuildJobs = function (context) {
|
|
|
10939
10985
|
return (0, base_1.createBuildJobs)(context, {
|
|
10940
10986
|
appBuild: undefined,
|
|
10941
10987
|
dockerBuild: {
|
|
10942
|
-
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.
|
|
10988
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
|
|
10943
10989
|
// custom script
|
|
10944
10990
|
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
|
|
10945
|
-
"cd ".concat(context.
|
|
10991
|
+
"cd ".concat(context.build.dir),
|
|
10946
10992
|
"docker pull $DOCKER_CACHE_IMAGE || true",
|
|
10947
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"),
|
|
10948
10994
|
"chmod +x /usr/local/bin/pack",
|
|
@@ -11051,7 +11097,7 @@ var createRailsTestJobs = function (context) {
|
|
|
11051
11097
|
if (context.trigger === "taggedRelease") {
|
|
11052
11098
|
return [];
|
|
11053
11099
|
}
|
|
11054
|
-
var buildConfig = context.
|
|
11100
|
+
var buildConfig = context.build.config;
|
|
11055
11101
|
var base = {
|
|
11056
11102
|
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
|
|
11057
11103
|
stage: "test",
|
|
@@ -11073,20 +11119,20 @@ var createRailsTestJobs = function (context) {
|
|
|
11073
11119
|
};
|
|
11074
11120
|
var auditJob = buildConfig.audit !== false
|
|
11075
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([
|
|
11076
|
-
"cd ".concat(context.
|
|
11122
|
+
"cd ".concat(context.build.dir)
|
|
11077
11123
|
], __read(((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
11078
11124
|
"gem install bundler-audit",
|
|
11079
11125
|
"bundle audit check",
|
|
11080
11126
|
])), false), allow_failure: true }) : null;
|
|
11081
11127
|
var lintJob = buildConfig.lint !== false
|
|
11082
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([
|
|
11083
|
-
"cd ".concat(context.
|
|
11129
|
+
"cd ".concat(context.build.dir)
|
|
11084
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 : [
|
|
11085
11131
|
"bundle exec rubocop",
|
|
11086
11132
|
])), false) }) : null;
|
|
11087
11133
|
var testJob = buildConfig.test !== false
|
|
11088
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([
|
|
11089
|
-
"cd ".concat(context.
|
|
11135
|
+
"cd ".concat(context.build.dir)
|
|
11090
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 : [
|
|
11091
11137
|
"bundle exec rspec",
|
|
11092
11138
|
])), false) }) : null;
|
|
@@ -11109,12 +11155,12 @@ exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
|
|
|
11109
11155
|
exports.SBOM_FILE = "__sbom.json";
|
|
11110
11156
|
var createSbomBuildJob = function (context) {
|
|
11111
11157
|
var _a, _b, _c, _d, _e;
|
|
11112
|
-
var buildConfig = context.
|
|
11158
|
+
var buildConfig = context.build.config;
|
|
11113
11159
|
var defaultImage = "aquasec/trivy:0.38.3";
|
|
11114
11160
|
var defaultScript = [
|
|
11115
|
-
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace)
|
|
11161
|
+
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.build.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace)
|
|
11116
11162
|
? "."
|
|
11117
|
-
: context.
|
|
11163
|
+
: context.build.dir),
|
|
11118
11164
|
];
|
|
11119
11165
|
var image = buildConfig.type === "custom" && buildConfig.sbom !== false
|
|
11120
11166
|
? (_c = (_b = buildConfig.sbom) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage
|
|
@@ -11740,7 +11786,7 @@ var sanitize = function (value) {
|
|
|
11740
11786
|
};
|
|
11741
11787
|
var getLabels = function (context) {
|
|
11742
11788
|
var _a, _b, _c;
|
|
11743
|
-
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 : {}));
|
|
11744
11790
|
return labels;
|
|
11745
11791
|
};
|
|
11746
11792
|
exports.getLabels = getLabels;
|
|
@@ -11779,6 +11825,17 @@ exports.getReviewSlug = getReviewSlug;
|
|
|
11779
11825
|
|
|
11780
11826
|
"use strict";
|
|
11781
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
|
+
};
|
|
11782
11839
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11783
11840
|
if (k2 === undefined) k2 = k;
|
|
11784
11841
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -11830,7 +11887,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
11830
11887
|
}
|
|
11831
11888
|
};
|
|
11832
11889
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11833
|
-
exports.createContext = void 0;
|
|
11890
|
+
exports.createContext = exports.createComponentContext = void 0;
|
|
11891
|
+
var lodash_1 = __nccwpck_require__(23255);
|
|
11834
11892
|
var build_1 = __nccwpck_require__(67862);
|
|
11835
11893
|
var deploy_1 = __nccwpck_require__(68483);
|
|
11836
11894
|
var utils_1 = __nccwpck_require__(32497);
|
|
@@ -11838,11 +11896,10 @@ var getEnvironment_1 = __nccwpck_require__(45699);
|
|
|
11838
11896
|
var getEnvironmentContext_1 = __nccwpck_require__(13663);
|
|
11839
11897
|
__exportStar(__nccwpck_require__(45699), exports);
|
|
11840
11898
|
__exportStar(__nccwpck_require__(45133), exports);
|
|
11841
|
-
var
|
|
11842
|
-
var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
switch (_b.label) {
|
|
11899
|
+
var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
11900
|
+
var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
11901
|
+
return __generator(this, function (_a) {
|
|
11902
|
+
switch (_a.label) {
|
|
11846
11903
|
case 0:
|
|
11847
11904
|
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
11848
11905
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
@@ -11859,21 +11916,41 @@ var createContext = function (ctx) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
11859
11916
|
deploy: {},
|
|
11860
11917
|
};
|
|
11861
11918
|
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
11862
|
-
|
|
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 = {
|
|
11863
11924
|
fullConfig: ctx.config,
|
|
11864
11925
|
componentConfig: componentConfig,
|
|
11865
|
-
|
|
11926
|
+
build: {
|
|
11927
|
+
dir: dir,
|
|
11928
|
+
packageManagerInfo: ctx.packageManagerInfo,
|
|
11929
|
+
config: build,
|
|
11930
|
+
},
|
|
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,
|
|
11866
11941
|
};
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
_a.trigger = ctx.trigger,
|
|
11872
|
-
_a)];
|
|
11942
|
+
resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs)
|
|
11943
|
+
? customJobs(context)
|
|
11944
|
+
: customJobs;
|
|
11945
|
+
return [2 /*return*/, __assign(__assign({}, context), { customJobs: resolvedCustomJobs })];
|
|
11873
11946
|
}
|
|
11874
11947
|
});
|
|
11875
11948
|
}); };
|
|
11876
|
-
exports.
|
|
11949
|
+
exports.createComponentContext = createComponentContext;
|
|
11950
|
+
/**
|
|
11951
|
+
* @deprecated use createComponentContext instead
|
|
11952
|
+
*/
|
|
11953
|
+
exports.createContext = exports.createComponentContext;
|
|
11877
11954
|
//# sourceMappingURL=index.js.map
|
|
11878
11955
|
|
|
11879
11956
|
/***/ }),
|
|
@@ -12280,7 +12357,7 @@ var stop_1 = __nccwpck_require__(82846);
|
|
|
12280
12357
|
var variables_1 = __nccwpck_require__(82422);
|
|
12281
12358
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
12282
12359
|
var createDeployJob = function (context, jobDefinition) {
|
|
12283
|
-
var _a, _b, _c, _d, _e, _f;
|
|
12360
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
12284
12361
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
12285
12362
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
12286
12363
|
var autoStop = context.environment.envType === "review"
|
|
@@ -12288,14 +12365,13 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
12288
12365
|
: context.environment.envType === "dev"
|
|
12289
12366
|
? "4 weeks"
|
|
12290
12367
|
: undefined;
|
|
12368
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12291
12369
|
// if auto or manual is configured explicitly, use that
|
|
12292
|
-
var whenDeployDefined =
|
|
12293
|
-
? context.componentConfig.deploy.when
|
|
12294
|
-
: undefined;
|
|
12370
|
+
var whenDeployDefined = deployConfig && deployConfig.when ? deployConfig.when : undefined;
|
|
12295
12371
|
// otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
|
|
12296
12372
|
var whenDeployDefault = context.environment.envType !== "prod"
|
|
12297
12373
|
? "auto" // is not stage, auto deploy
|
|
12298
|
-
: ((
|
|
12374
|
+
: ((_b = context.componentConfig.env) === null || _b === void 0 ? void 0 : _b.stage) === false
|
|
12299
12375
|
? "auto" // is prod, but no staging, auto deploy
|
|
12300
12376
|
: "manual"; // manually deploy
|
|
12301
12377
|
var whenDeploy = whenDeployDefined ? whenDeployDefined : whenDeployDefault;
|
|
@@ -12309,12 +12385,12 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
12309
12385
|
envMode: "stagePerEnv", // makes it easier to run manual tasks er env
|
|
12310
12386
|
needs: __spreadArray(__spreadArray([], __read(((0, sbom_2.sbomDeactivated)(context)
|
|
12311
12387
|
? []
|
|
12312
|
-
: [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((
|
|
12313
|
-
? (
|
|
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 ({
|
|
12314
12390
|
componentName: c,
|
|
12315
12391
|
job: exports.DEPLOY_JOB_NAME,
|
|
12316
12392
|
artifacts: false,
|
|
12317
|
-
}); })) !== null &&
|
|
12393
|
+
}); })) !== null && _d !== void 0 ? _d : []
|
|
12318
12394
|
: [])), false),
|
|
12319
12395
|
// we don't want to deploy when there is a broken test
|
|
12320
12396
|
needsStages: [
|
|
@@ -12330,21 +12406,15 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
12330
12406
|
when: whenDeploy === "auto" ? "on_success" : "manual",
|
|
12331
12407
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
12332
12408
|
stage: "deploy",
|
|
12333
|
-
variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), (hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {})), context.environment.jobOnlyVars.deploy.envVars), (
|
|
12334
|
-
|
|
12335
|
-
: {})), jobDefinition.variables),
|
|
12336
|
-
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), ((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {})), (context.componentConfig.deploy
|
|
12337
|
-
? (_f = context.componentConfig.deploy.runnerVariables) !== null && _f !== void 0 ? _f : {}
|
|
12338
|
-
: {})),
|
|
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 : {} : {})),
|
|
12339
12411
|
environment: isStoppable
|
|
12340
12412
|
? {
|
|
12341
12413
|
on_stop: stop_1.STOP_JOB_NAME,
|
|
12342
12414
|
auto_stop_in: autoStop,
|
|
12343
12415
|
}
|
|
12344
12416
|
: undefined,
|
|
12345
|
-
jobTags:
|
|
12346
|
-
? context.componentConfig.deploy.jobTags
|
|
12347
|
-
: undefined,
|
|
12417
|
+
jobTags: deployConfig ? deployConfig.jobTags : undefined,
|
|
12348
12418
|
};
|
|
12349
12419
|
};
|
|
12350
12420
|
exports.createDeployJob = createDeployJob;
|
|
@@ -12542,17 +12612,18 @@ var BashExpression_1 = __nccwpck_require__(42376);
|
|
|
12542
12612
|
var gitlab_1 = __nccwpck_require__(38490);
|
|
12543
12613
|
var types_1 = __nccwpck_require__(75781);
|
|
12544
12614
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(74398);
|
|
12545
|
-
var getArtifactsRegistryHost = function (
|
|
12546
|
-
var
|
|
12547
|
-
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")) {
|
|
12548
12618
|
// should not happen
|
|
12549
12619
|
throw new Error("deploy config is wrong");
|
|
12550
12620
|
}
|
|
12551
|
-
return "".concat(deploy.region, "-docker.pkg.dev");
|
|
12621
|
+
return "".concat(context.deploy.config.region, "-docker.pkg.dev");
|
|
12552
12622
|
};
|
|
12553
12623
|
exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
|
|
12554
12624
|
var getArtifactsRegistryDockerUrl = function (context) {
|
|
12555
|
-
var
|
|
12625
|
+
var _a;
|
|
12626
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12556
12627
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12557
12628
|
// should not happen
|
|
12558
12629
|
throw new Error("deploy config is wrong");
|
|
@@ -12615,11 +12686,9 @@ var getDeleteImageCommands = function (fullImageName, keepNewest) {
|
|
|
12615
12686
|
* @returns
|
|
12616
12687
|
*/
|
|
12617
12688
|
var getDeleteUnusedImagesCommands = function (context, keep) {
|
|
12689
|
+
var _a;
|
|
12618
12690
|
if (keep === void 0) { keep = 0; }
|
|
12619
|
-
var deployConfig = context.
|
|
12620
|
-
if (deployConfig === false) {
|
|
12621
|
-
return [];
|
|
12622
|
-
}
|
|
12691
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12623
12692
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12624
12693
|
// should not happen
|
|
12625
12694
|
throw new Error("deploy config is wrong");
|
|
@@ -12710,8 +12779,9 @@ var createArgsString_1 = __nccwpck_require__(49598);
|
|
|
12710
12779
|
var getServiceName_1 = __nccwpck_require__(38128);
|
|
12711
12780
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(74398);
|
|
12712
12781
|
var getListRevisionsCommand = function (context, args) {
|
|
12782
|
+
var _a;
|
|
12713
12783
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
12714
|
-
var deployConfig = context.
|
|
12784
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12715
12785
|
if (!deployConfig || !(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12716
12786
|
// should not happen
|
|
12717
12787
|
throw new Error("deploy config is wrong");
|
|
@@ -12723,10 +12793,8 @@ var getListRevisionsCommand = function (context, args) {
|
|
|
12723
12793
|
return "gcloud run revisions list ".concat((0, createArgsString_1.createArgsString)(filterRevisionArgs));
|
|
12724
12794
|
};
|
|
12725
12795
|
var getDeleteUnusedRevisionsCommands = function (context, keep) {
|
|
12726
|
-
var
|
|
12727
|
-
|
|
12728
|
-
return [];
|
|
12729
|
-
}
|
|
12796
|
+
var _a;
|
|
12797
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12730
12798
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
12731
12799
|
// should not happen
|
|
12732
12800
|
throw new Error("deploy config is wrong");
|
|
@@ -12995,7 +13063,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
|
12995
13063
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
12996
13064
|
var customConfig = service !== true ? service : undefined;
|
|
12997
13065
|
var command = service !== true
|
|
12998
|
-
? (_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
|
|
12999
13067
|
: undefined;
|
|
13000
13068
|
var commandArray = command
|
|
13001
13069
|
? Array.isArray(command)
|
|
@@ -13090,7 +13158,8 @@ var makeLabelString = function (obj) {
|
|
|
13090
13158
|
};
|
|
13091
13159
|
exports.makeLabelString = makeLabelString;
|
|
13092
13160
|
var getCloudRunDeployConfig = function (context) {
|
|
13093
|
-
var
|
|
13161
|
+
var _a;
|
|
13162
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13094
13163
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
13095
13164
|
// should not happen
|
|
13096
13165
|
throw new Error("deploy config is wrong");
|
|
@@ -13272,10 +13341,8 @@ var constants_1 = __nccwpck_require__(38865);
|
|
|
13272
13341
|
var getCloudRunDeployScripts_1 = __nccwpck_require__(53695);
|
|
13273
13342
|
var getCloudRunStopScripts_1 = __nccwpck_require__(33747);
|
|
13274
13343
|
var createGoogleCloudRunDeployJobs = function (context) {
|
|
13275
|
-
var
|
|
13276
|
-
|
|
13277
|
-
return [];
|
|
13278
|
-
}
|
|
13344
|
+
var _a;
|
|
13345
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13279
13346
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
13280
13347
|
// should not happen
|
|
13281
13348
|
throw new Error("deploy config is wrong");
|
|
@@ -13755,29 +13822,28 @@ var base_1 = __nccwpck_require__(84052);
|
|
|
13755
13822
|
var sbom_1 = __nccwpck_require__(44986);
|
|
13756
13823
|
var types_1 = __nccwpck_require__(75781);
|
|
13757
13824
|
var createCustomDeployJobs = function (context) {
|
|
13758
|
-
var _a, _b, _c;
|
|
13759
|
-
var deployConfig = context.
|
|
13760
|
-
if (deployConfig === false) {
|
|
13761
|
-
return [];
|
|
13762
|
-
}
|
|
13825
|
+
var _a, _b, _c, _d;
|
|
13826
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13763
13827
|
if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
|
|
13764
13828
|
// should not happen
|
|
13765
13829
|
throw new Error("deploy config is not custom");
|
|
13766
13830
|
}
|
|
13767
13831
|
// FIXME: custom deploy currently assumes yarn-based project
|
|
13768
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context, {
|
|
13832
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build, {
|
|
13833
|
+
noCustomPostInstall: true,
|
|
13834
|
+
});
|
|
13769
13835
|
return (0, base_1.createDeployementJobs)(context, {
|
|
13770
13836
|
deploy: {
|
|
13771
|
-
image: (
|
|
13772
|
-
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 : [],
|
|
13773
13839
|
script: __spreadArray(__spreadArray(__spreadArray([
|
|
13774
|
-
"cd ".concat(context.
|
|
13840
|
+
"cd ".concat(context.build.dir)
|
|
13775
13841
|
], __read((deployConfig.requiresYarnInstall ? yarnInstall : [])), false), __read(deployConfig.script), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false),
|
|
13776
13842
|
variables: {},
|
|
13777
13843
|
},
|
|
13778
13844
|
stop: deployConfig.stopScript
|
|
13779
13845
|
? {
|
|
13780
|
-
image: (
|
|
13846
|
+
image: (_d = deployConfig.jobImage) !== null && _d !== void 0 ? _d : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
13781
13847
|
script: __spreadArray(__spreadArray([], __read(deployConfig.stopScript), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false),
|
|
13782
13848
|
variables: {},
|
|
13783
13849
|
}
|
|
@@ -13854,17 +13920,15 @@ var docker_1 = __nccwpck_require__(9641);
|
|
|
13854
13920
|
var base_1 = __nccwpck_require__(84052);
|
|
13855
13921
|
var types_1 = __nccwpck_require__(75781);
|
|
13856
13922
|
var createDockerTagDeployJobs = function (context) {
|
|
13857
|
-
var
|
|
13858
|
-
|
|
13859
|
-
return [];
|
|
13860
|
-
}
|
|
13923
|
+
var _a;
|
|
13924
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
13861
13925
|
if (!(0, types_1.isOfDeployType)(deployConfig, "dockerTag")) {
|
|
13862
13926
|
// should not happen
|
|
13863
13927
|
throw new Error("deploy config is not dockerTag");
|
|
13864
13928
|
}
|
|
13865
13929
|
var tag = deployConfig.tag;
|
|
13866
13930
|
return (0, base_1.createDeployementJobs)(context, {
|
|
13867
|
-
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), [
|
|
13868
13932
|
"docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG",
|
|
13869
13933
|
"docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag),
|
|
13870
13934
|
"docker push $DOCKER_IMAGE:".concat(tag),
|
|
@@ -13976,32 +14040,34 @@ var context_1 = __nccwpck_require__(5875);
|
|
|
13976
14040
|
var utils_1 = __nccwpck_require__(62089);
|
|
13977
14041
|
var types_1 = __nccwpck_require__(75781);
|
|
13978
14042
|
var hasKubernetesCloudSQL = function (context) {
|
|
13979
|
-
var _a, _b;
|
|
13980
|
-
|
|
13981
|
-
|
|
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;
|
|
13982
14047
|
}
|
|
13983
14048
|
return false;
|
|
13984
14049
|
};
|
|
13985
14050
|
exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
|
|
13986
14051
|
var createKubernetesCloudsqlBaseValues = function (context) {
|
|
13987
|
-
var _a, _b, _c, _d, _e, _f;
|
|
13988
|
-
|
|
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")) {
|
|
13989
14055
|
throw new Error("cannot get cloud sql config");
|
|
13990
14056
|
}
|
|
13991
|
-
var config = (
|
|
14057
|
+
var config = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql;
|
|
13992
14058
|
if (!config) {
|
|
13993
14059
|
throw new Error("cannot get cloud sql config");
|
|
13994
14060
|
}
|
|
13995
14061
|
var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
|
|
13996
14062
|
if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
|
|
13997
|
-
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);
|
|
13998
14064
|
return {
|
|
13999
14065
|
cloudsql: {
|
|
14000
14066
|
enabled: config.enabled,
|
|
14001
14067
|
dbUser: "postgres",
|
|
14002
14068
|
instanceConnectionName: instanceConnectionName,
|
|
14003
14069
|
proxyCredentials: proxyCredentials,
|
|
14004
|
-
fullDbName: (
|
|
14070
|
+
fullDbName: (_f = context.environment.envVars.KUBE_APP_NAME) !== null && _f !== void 0 ? _f : "",
|
|
14005
14071
|
},
|
|
14006
14072
|
};
|
|
14007
14073
|
}
|
|
@@ -14009,7 +14075,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
|
|
|
14009
14075
|
return {
|
|
14010
14076
|
cloudsql: {
|
|
14011
14077
|
enabled: config.enabled,
|
|
14012
|
-
dbUser: (
|
|
14078
|
+
dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
|
|
14013
14079
|
instanceConnectionName: config.instanceConnectionName,
|
|
14014
14080
|
proxyCredentials: proxyCredentials,
|
|
14015
14081
|
fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName),
|
|
@@ -14078,11 +14144,8 @@ var bashYaml_1 = __nccwpck_require__(54660);
|
|
|
14078
14144
|
var gitlab_1 = __nccwpck_require__(38490);
|
|
14079
14145
|
var ALL_VALUES_FILE = "__all_values.yml";
|
|
14080
14146
|
var createKubernetesDeployJobs = function (context) {
|
|
14081
|
-
var _a, _b;
|
|
14082
|
-
var deployConfig = context.
|
|
14083
|
-
if (deployConfig === false) {
|
|
14084
|
-
return [];
|
|
14085
|
-
}
|
|
14147
|
+
var _a, _b, _c;
|
|
14148
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14086
14149
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
14087
14150
|
// should not happen
|
|
14088
14151
|
throw new Error("deploy config is not kubernetes");
|
|
@@ -14096,7 +14159,7 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
14096
14159
|
when: "always",
|
|
14097
14160
|
},
|
|
14098
14161
|
}
|
|
14099
|
-
: {})), { 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,
|
|
14100
14163
|
/** @deprecated */
|
|
14101
14164
|
BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID }) });
|
|
14102
14165
|
var clusterName = "kube-".concat(context.environment.fullName);
|
|
@@ -14262,7 +14325,8 @@ var shouldGoIntoSecrets = function (key, value) {
|
|
|
14262
14325
|
* we evalulate the actual values later, but want to store the secrets in kubernetes secrets
|
|
14263
14326
|
*/
|
|
14264
14327
|
var createKubeEnv = function (context) {
|
|
14265
|
-
|
|
14328
|
+
var _a;
|
|
14329
|
+
if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
14266
14330
|
// should not happen
|
|
14267
14331
|
throw new Error("deploy config is not kubernetes");
|
|
14268
14332
|
}
|
|
@@ -14348,7 +14412,7 @@ var createAppConfig = function (context, application) {
|
|
|
14348
14412
|
var _a = application !== null && application !== void 0 ? application : {}, healthRoute = _a.healthRoute, command = _a.command, rest = __rest(_a, ["healthRoute", "command"]);
|
|
14349
14413
|
return (0, utils_1.mergeWithMergingArrays)({
|
|
14350
14414
|
host: context.environment.host,
|
|
14351
|
-
command: command !== null && command !== void 0 ? command : context.
|
|
14415
|
+
command: command !== null && command !== void 0 ? command : context.build.config.startCommand,
|
|
14352
14416
|
livenessProbe: {
|
|
14353
14417
|
httpGet: {
|
|
14354
14418
|
path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health",
|
|
@@ -14376,9 +14440,9 @@ var removeFalsy = function (record) {
|
|
|
14376
14440
|
}));
|
|
14377
14441
|
};
|
|
14378
14442
|
var createKubeValues = function (context) {
|
|
14379
|
-
var _a, _b;
|
|
14380
|
-
var deployConfig = context.
|
|
14381
|
-
if (deployConfig
|
|
14443
|
+
var _a, _b, _c;
|
|
14444
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14445
|
+
if (!deployConfig) {
|
|
14382
14446
|
return [];
|
|
14383
14447
|
}
|
|
14384
14448
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
@@ -14388,14 +14452,14 @@ var createKubeValues = function (context) {
|
|
|
14388
14452
|
var values = deployConfig.values;
|
|
14389
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
|
|
14390
14454
|
// we only merge the rest of the values in
|
|
14391
|
-
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"]);
|
|
14392
14456
|
var env = (0, kubeEnv_1.createKubeEnv)(context);
|
|
14393
14457
|
var defaultKubeValues = (0, lodash_1.merge)({
|
|
14394
14458
|
env: env,
|
|
14395
14459
|
application: createAppConfig(context, application),
|
|
14396
14460
|
}, (0, cloudSql_1.hasKubernetesCloudSQL)(context)
|
|
14397
14461
|
? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context)
|
|
14398
|
-
: {}, ((
|
|
14462
|
+
: {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled)
|
|
14399
14463
|
? (0, mongodb_1.createMongodbBaseConfig)(context)
|
|
14400
14464
|
: {});
|
|
14401
14465
|
var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({ jobs: removeFalsy(jobs), cronjobs: removeFalsy(cronjobs) }, rest)));
|
|
@@ -14443,15 +14507,15 @@ var getMongodbReplicasetHost = function (context, index) {
|
|
|
14443
14507
|
return getMongodbHost(context, "".concat(fullAppname, "-mongodb-").concat(index, ".").concat(fullAppname, "-mongodb-headless"));
|
|
14444
14508
|
};
|
|
14445
14509
|
var createMongodbUrl = function (context, dbName) {
|
|
14446
|
-
var _a, _b;
|
|
14447
|
-
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")) {
|
|
14448
14512
|
throw new Error("can only createMongodbUrl on supported deploys");
|
|
14449
14513
|
}
|
|
14450
|
-
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;
|
|
14451
14515
|
var queryParams = undefined;
|
|
14452
14516
|
var hosts = "";
|
|
14453
14517
|
if ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset") {
|
|
14454
|
-
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)
|
|
14455
14519
|
.map(function (i) { return getMongodbReplicasetHost(context, i); })
|
|
14456
14520
|
.join(",");
|
|
14457
14521
|
queryParams = "replicaSet=rs0&authSource=admin";
|
|
@@ -14463,11 +14527,11 @@ var createMongodbUrl = function (context, dbName) {
|
|
|
14463
14527
|
return "mongodb://".concat(getCredentialString(context)).concat(hosts, "/").concat(dbName).concat(queryParams ? "?".concat(queryParams) : "");
|
|
14464
14528
|
};
|
|
14465
14529
|
var createMongoBackupDefaultConfig = function (context) {
|
|
14466
|
-
var _a;
|
|
14467
|
-
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")) {
|
|
14468
14532
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
14469
14533
|
}
|
|
14470
|
-
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;
|
|
14471
14535
|
var fullAppName = context.environment.envVars.KUBE_APP_NAME;
|
|
14472
14536
|
var backupEnabled = ["prod", "stage"].includes(context.environment.envType);
|
|
14473
14537
|
var hostToBackup;
|
|
@@ -14497,11 +14561,11 @@ var createMongoBackupDefaultConfig = function (context) {
|
|
|
14497
14561
|
};
|
|
14498
14562
|
};
|
|
14499
14563
|
var createMongodbBaseConfig = function (context) {
|
|
14500
|
-
var _a, _b;
|
|
14501
|
-
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")) {
|
|
14502
14566
|
throw new Error("can only create mongodb base config on supported deploys");
|
|
14503
14567
|
}
|
|
14504
|
-
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;
|
|
14505
14569
|
return {
|
|
14506
14570
|
mongodb: {
|
|
14507
14571
|
enabled: true,
|
|
@@ -14516,7 +14580,7 @@ var createMongodbBaseConfig = function (context) {
|
|
|
14516
14580
|
backup: createMongoBackupDefaultConfig(context),
|
|
14517
14581
|
},
|
|
14518
14582
|
env: {
|
|
14519
|
-
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"
|
|
14520
14584
|
? { MONGO_OPLOG_URL: createMongodbUrl(context, "local") } // oplog only works with replicasets
|
|
14521
14585
|
: {})),
|
|
14522
14586
|
},
|
|
@@ -14572,8 +14636,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
14572
14636
|
exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
|
|
14573
14637
|
var sbom_1 = __nccwpck_require__(37038);
|
|
14574
14638
|
var sbomDeactivated = function (context) {
|
|
14575
|
-
return context.
|
|
14576
|
-
context.componentConfig.build.sbom === false;
|
|
14639
|
+
return context.build.config.type === "custom" && context.build.config.sbom === false;
|
|
14577
14640
|
};
|
|
14578
14641
|
exports.sbomDeactivated = sbomDeactivated;
|
|
14579
14642
|
var getDependencyTrackUploadScript = function (context) {
|
|
@@ -14658,7 +14721,7 @@ var isOfDeployType = function (t) {
|
|
|
14658
14721
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
14659
14722
|
types[_i - 1] = arguments[_i];
|
|
14660
14723
|
}
|
|
14661
|
-
return t && types.includes(t.type);
|
|
14724
|
+
return t && types.includes(t.type) ? true : false;
|
|
14662
14725
|
};
|
|
14663
14726
|
exports.isOfDeployType = isOfDeployType;
|
|
14664
14727
|
//# sourceMappingURL=index.js.map
|
|
@@ -14694,7 +14757,8 @@ var getKubernetesNamespace = function (config, env) {
|
|
|
14694
14757
|
};
|
|
14695
14758
|
exports.getKubernetesNamespace = getKubernetesNamespace;
|
|
14696
14759
|
var contextIsStoppable = function (context) {
|
|
14697
|
-
var
|
|
14760
|
+
var _a;
|
|
14761
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14698
14762
|
if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
14699
14763
|
return true;
|
|
14700
14764
|
}
|
|
@@ -15030,7 +15094,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
15030
15094
|
};
|
|
15031
15095
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
15032
15096
|
exports.createJobsForComponent = void 0;
|
|
15033
|
-
var lodash_1 = __nccwpck_require__(23255);
|
|
15034
15097
|
var build_1 = __nccwpck_require__(67862);
|
|
15035
15098
|
var context_1 = __nccwpck_require__(5875);
|
|
15036
15099
|
var deploy_1 = __nccwpck_require__(68483);
|
|
@@ -15043,18 +15106,17 @@ var injectDefaultVarsInCustomJobs = function (context, jobs) {
|
|
|
15043
15106
|
});
|
|
15044
15107
|
};
|
|
15045
15108
|
var getCustomJobs = function (context) {
|
|
15046
|
-
if (!context.
|
|
15109
|
+
if (!context.customJobs) {
|
|
15047
15110
|
return [];
|
|
15048
15111
|
}
|
|
15049
|
-
var rawJobs =
|
|
15050
|
-
? context.componentConfig.customJobs(context)
|
|
15051
|
-
: context.componentConfig.customJobs;
|
|
15112
|
+
var rawJobs = context.customJobs;
|
|
15052
15113
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
15053
15114
|
};
|
|
15054
15115
|
var createRawJobs = function (context) {
|
|
15055
|
-
var
|
|
15056
|
-
var
|
|
15057
|
-
|
|
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)
|
|
15058
15120
|
: [];
|
|
15059
15121
|
var customJobs = getCustomJobs(context);
|
|
15060
15122
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|
|
@@ -15066,7 +15128,7 @@ var createJobsForComponent = function (contextContext) { return __awaiter(void 0
|
|
|
15066
15128
|
case 0: return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(contextContext.config, contextContext.componentName)];
|
|
15067
15129
|
case 1:
|
|
15068
15130
|
packageManagerInfo = _a.sent();
|
|
15069
|
-
return [4 /*yield*/, (0, context_1.
|
|
15131
|
+
return [4 /*yield*/, (0, context_1.createComponentContext)(__assign(__assign({}, contextContext), { packageManagerInfo: packageManagerInfo }))];
|
|
15070
15132
|
case 2:
|
|
15071
15133
|
context = _a.sent();
|
|
15072
15134
|
return [2 /*return*/, createRawJobs(context).map(function (job) { return (__assign(__assign({}, job), { context: context })); })];
|