@catladder/cli 0.0.0-main-c6987376 → 0.0.0-main-b35071da

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.
@@ -46,6 +46,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
46
46
  };
47
47
  exports.__esModule = true;
48
48
  var pipeline_1 = require("@catladder/pipeline");
49
+ var pipeline_2 = require("@catladder/pipeline");
49
50
  var child_process_promise_1 = require("child-process-promise");
50
51
  var fs_extra_1 = require("fs-extra");
51
52
  var tmp_promise_1 = require("tmp-promise");
@@ -76,13 +77,13 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
76
77
  if (env === "review") {
77
78
  vorpal.log("⚠️ connection string does not include mr information on review environments");
78
79
  }
79
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) return [3 /*break*/, 3];
80
+ if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) return [3 /*break*/, 3];
80
81
  return [4 /*yield*/, getProxyInfoForKubernetes(context)];
81
82
  case 2:
82
83
  proxyInfo = _c.sent();
83
84
  return [3 /*break*/, 6];
84
85
  case 3:
85
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) return [3 /*break*/, 5];
86
+ if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) return [3 /*break*/, 5];
86
87
  return [4 /*yield*/, getProxyInfoForCloudRun(context)];
87
88
  case 4:
88
89
  proxyInfo = _c.sent();
@@ -144,27 +145,20 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
144
145
  });
145
146
  }); });
146
147
  var getProxyInfoForKubernetes = function (context) { return __awaiter(void 0, void 0, void 0, function () {
147
- var envVars, DB_PASSWORD, DB_NAME, values, projectId, defaultInstanceId, instanceId, defaultRegion, region, instanceName;
148
- var _a, _b, _c, _d;
149
- return __generator(this, function (_e) {
150
- switch (_e.label) {
148
+ var envVars, cloudSqlValues, DB_PASSWORD, DB_NAME, instanceName;
149
+ return __generator(this, function (_a) {
150
+ switch (_a.label) {
151
151
  case 0:
152
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
152
+ if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
153
153
  throw new Error("unsupported");
154
154
  }
155
155
  return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(this, context.environment.shortName, context.componentName)];
156
156
  case 1:
157
- envVars = _e.sent();
157
+ envVars = _a.sent();
158
+ cloudSqlValues = (0, pipeline_1.createKubernetesCloudsqlBaseValues)(context);
158
159
  DB_PASSWORD = (envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD) || (envVars === null || envVars === void 0 ? void 0 : envVars.POSTGRESQL_PASSWORD);
159
- DB_NAME = context.environment.envVars.KUBE_APP_NAME;
160
- values = context.componentConfig.deploy.values;
161
- projectId = ((_a = values === null || values === void 0 ? void 0 : values.cloudsql) === null || _a === void 0 ? void 0 : _a.projectId) ||
162
- ((_b = context.componentConfig.deploy.cluster) === null || _b === void 0 ? void 0 : _b.projectId);
163
- defaultInstanceId = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "-").concat(context.environment.shortName);
164
- instanceId = ((_c = values === null || values === void 0 ? void 0 : values.cloudsql) === null || _c === void 0 ? void 0 : _c.instanceId) || defaultInstanceId;
165
- defaultRegion = "europe-west6";
166
- region = ((_d = values === null || values === void 0 ? void 0 : values.cloudsql) === null || _d === void 0 ? void 0 : _d.region) || defaultRegion;
167
- instanceName = "".concat(projectId, ":").concat(region, ":").concat(instanceId);
160
+ DB_NAME = cloudSqlValues.cloudsql.fullDbName;
161
+ instanceName = cloudSqlValues.cloudsql.instanceConnectionName;
168
162
  return [2 /*return*/, {
169
163
  instanceName: instanceName,
170
164
  DB_PASSWORD: DB_PASSWORD,
@@ -179,7 +173,7 @@ var getProxyInfoForCloudRun = function (context) { return __awaiter(void 0, void
179
173
  return __generator(this, function (_a) {
180
174
  switch (_a.label) {
181
175
  case 0:
182
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ||
176
+ if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ||
183
177
  !context.componentConfig.deploy.cloudSql) {
184
178
  throw new Error("unsupported");
185
179
  }
@@ -1 +1 @@
1
- {"version":3,"file":"commandCloudSqlProxy.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/project/commandCloudSqlProxy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gDAAqD;AACrD,+DAA8C;AAC9C,qCAAqC;AACrC,2CAAuC;AAEvC,wEAK6C;AAC7C,2DAA2D;AAQ3D,sBAAe,UAAO,MAAc;;;;;gBAClC,KAAA,CAAA,KAAA,MAAM;qBACH,OAAO,CAAC,wCAAwC,EAAE,uBAAuB,CAAC,CAAA;qBAC1E,YAAY,CAAA;gBAAC,qBAAM,IAAA,kCAAgB,GAAE,EAAA;oBAFxC,sBAAA,cAEgB,SAAwB,EAAC;qBACtC,MAAM,CAAC,UAAgB,EAAgB;wBAAd,YAAY,kBAAA;;;;;;;oCAC9B,KAAyB,IAAA,8BAAW,EAAC,YAAY,CAAC,EAAhD,GAAG,SAAA,EAAE,aAAa,mBAAA,CAA+B;oCAEzC,qBAAM,IAAA,6CAA0B,EAAC,GAAG,EAAE,aAAa,CAAC,EAAA;;oCAA9D,OAAO,GAAG,SAAoD;oCAGpE,IAAI,GAAG,KAAK,QAAQ,EAAE;wCACpB,MAAM,CAAC,GAAG,CACR,6EAA6E,CAC9E,CAAC;qCACH;yCACG,IAAA,yBAAc,EAAC,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,EAA5D,wBAA4D;oCAClD,qBAAM,yBAAyB,CAAC,OAAO,CAAC,EAAA;;oCAApD,SAAS,GAAG,SAAwC,CA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aAAa,CACtB,EAAA;;gBAJK,OAAO,GAAG,SAIf;gBAEK,WAAW,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,CAAC;gBACnC,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC;gBAE3B,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;gBAEpD,sBAAO;wBACL,YAAY,EACV,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB;wBAChE,WAAW,aAAA;wBACX,OAAO,SAAA;wBACP,OAAO,SAAA;qBACR,EAAC;;;KACH,CAAC"}
@@ -39,7 +39,6 @@ exports.__esModule = true;
39
39
  exports.setupContext = void 0;
40
40
  var pipeline_1 = require("@catladder/pipeline");
41
41
  var setupCloudRun_1 = require("./setupCloudRun");
42
- var setupCloudSQL_1 = require("./setupCloudSQL");
43
42
  var setupKubernetes_1 = require("./setupKubernetes");
44
43
  var setupContext = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
45
44
  var deployConfig;
@@ -60,19 +59,13 @@ var setupContext = function (instance, context) { return __awaiter(void 0, void
60
59
  _a.sent();
61
60
  _a.label = 2;
62
61
  case 2:
63
- if (!(0, pipeline_1.hasKubernetesCloudSQL)(context)) return [3 /*break*/, 4];
64
- return [4 /*yield*/, (0, setupCloudSQL_1.setupCloudSQL)(instance, context)];
62
+ deployConfig = context.componentConfig.deploy;
63
+ if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) return [3 /*break*/, 4];
64
+ return [4 /*yield*/, (0, setupKubernetes_1.setupKubernetes)(instance, context)];
65
65
  case 3:
66
66
  _a.sent();
67
67
  _a.label = 4;
68
68
  case 4:
69
- deployConfig = context.componentConfig.deploy;
70
- if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) return [3 /*break*/, 6];
71
- return [4 /*yield*/, (0, setupKubernetes_1.setupKubernetes)(instance, context)];
72
- case 5:
73
- _a.sent();
74
- _a.label = 6;
75
- case 6:
76
69
  instance.log("");
77
70
  instance.log("✅ " +
78
71
  context.environment.shortName +
@@ -1 +1 @@
1
- {"version":3,"file":"setupContext.js","sourceRoot":"","sources":["../../../../../../src/apps/cli/commands/project/setup/setupContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gDAA4E;AAE5E,iDAAgD;AAChD,iDAAgD;AAChD,qDAAoD;AAE7C,IAAM,YAAY,GAAG,UAC1B,QAAyB,EACzB,OAAgB;;;;;gBAEhB,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACjB,QAAQ,CAAC,GAAG,CACV,oFAAoF,CACrF,CAAC;gBAEF,QAAQ,CAAC,GAAG,CACV,mBAAmB;oBACjB,OAAO,CAAC,WAAW,CAAC,SAAS;oBAC7B,GAAG;oBACH,OAAO,CAAC,aAAa;oBACrB,KAAK,CACR,CAAC;gBACF,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;qBACb,IAAA,yBAAc,EAAC,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAAjE,wBAAiE;gBACnE,qBAAM,IAAA,6BAAa,EAAC,QAAQ,EAAE,OAAO,CAAC,EAAA;;gBAAtC,SAAsC,CAAC;;;qBAErC,IAAA,gCAAqB,EAAC,OAAO,CAAC,EAA9B,wBAA8B;gBAChC,qBAAM,IAAA,6BAAa,EAAC,QAAQ,EAAE,OAAO,CAAC,EAAA;;gBAAtC,SAAsC,CAAC;;;gBAGnC,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;qBAChD,IAAA,yBAAc,EAAC,YAAY,EAAE,YAAY,CAAC,EAA1C,wBAA0C;gBAC5C,qBAAM,IAAA,iCAAe,EAAC,QAAQ,EAAE,OAAO,CAAC,EAAA;;gBAAxC,SAAwC,CAAC;;;gBAG3C,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACjB,QAAQ,CAAC,GAAG,CACV,IAAI;oBACF,OAAO,CAAC,WAAW,CAAC,SAAS;oBAC7B,GAAG;oBACH,OAAO,CAAC,aAAa;oBACrB,QAAQ,CACX,CAAC;gBAEF,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;;;;KAClB,CAAC;AAvCW,QAAA,YAAY,gBAuCvB"}
1
+ {"version":3,"file":"setupContext.js","sourceRoot":"","sources":["../../../../../../src/apps/cli/commands/project/setup/setupContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gDAAqD;AAErD,iDAAgD;AAEhD,qDAAoD;AAE7C,IAAM,YAAY,GAAG,UAC1B,QAAyB,EACzB,OAAgB;;;;;gBAEhB,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACjB,QAAQ,CAAC,GAAG,CACV,oFAAoF,CACrF,CAAC;gBAEF,QAAQ,CAAC,GAAG,CACV,mBAAmB;oBACjB,OAAO,CAAC,WAAW,CAAC,SAAS;oBAC7B,GAAG;oBACH,OAAO,CAAC,aAAa;oBACrB,KAAK,CACR,CAAC;gBACF,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;qBACb,IAAA,yBAAc,EAAC,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAAjE,wBAAiE;gBACnE,qBAAM,IAAA,6BAAa,EAAC,QAAQ,EAAE,OAAO,CAAC,EAAA;;gBAAtC,SAAsC,CAAC;;;gBAGnC,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;qBAChD,IAAA,yBAAc,EAAC,YAAY,EAAE,YAAY,CAAC,EAA1C,wBAA0C;gBAC5C,qBAAM,IAAA,iCAAe,EAAC,QAAQ,EAAE,OAAO,CAAC,EAAA;;gBAAxC,SAAwC,CAAC;;;gBAG3C,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACjB,QAAQ,CAAC,GAAG,CACV,IAAI;oBACF,OAAO,CAAC,WAAW,CAAC,SAAS;oBAC7B,GAAG;oBACH,OAAO,CAAC,aAAa;oBACrB,QAAQ,CACX,CAAC;gBAEF,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;;;;KAClB,CAAC;AApCW,QAAA,YAAY,gBAoCvB"}
@@ -40107,7 +40107,7 @@ exports.readConfigSync = readConfigSync;
40107
40107
 
40108
40108
  exports.__esModule = true;
40109
40109
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
40110
- exports.PIPELINE_IMAGE_TAG = "main-c6987376" || 0;
40110
+ exports.PIPELINE_IMAGE_TAG = "main-b35071da" || 0;
40111
40111
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
40112
40112
 
40113
40113
  /***/ }),
@@ -41545,20 +41545,21 @@ exports.__esModule = true;
41545
41545
  exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
41546
41546
  var context_1 = __nccwpck_require__(2041);
41547
41547
  var gitlab_1 = __nccwpck_require__(4997);
41548
+ var utils_1 = __nccwpck_require__(463);
41548
41549
  var deployJob_1 = __nccwpck_require__(2256);
41549
41550
  var jobName_1 = __nccwpck_require__(7311);
41550
41551
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
41551
41552
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
41552
41553
  var getCloudSqlVariables = function (_a) {
41553
- var _b, _c, _d, _e;
41554
+ var _b, _c;
41554
41555
  var deployConfigRaw = _a.deployConfigRaw,
41555
41556
  environmentSlugPrefix = _a.environmentSlugPrefix,
41556
41557
  env = _a.env,
41557
41558
  componentName = _a.componentName,
41558
41559
  fullConfig = _a.fullConfig;
41559
41560
  if (deployConfigRaw && deployConfigRaw.cloudSql) {
41560
- var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_c = deployConfigRaw.cloudSql.dbBaseName) !== null && _c !== void 0 ? _c : componentName].filter(Boolean).join("-");
41561
- var additionalQueryParamsString = Object.entries((_d = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _d !== void 0 ? _d : {}).map(function (_a) {
41561
+ var DB_NAME = (0, utils_1.getFullDbName)(deployConfigRaw.cloudSql, fullConfig, environmentSlugPrefix, componentName);
41562
+ var additionalQueryParamsString = Object.entries((_b = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _b !== void 0 ? _b : {}).map(function (_a) {
41562
41563
  var _b = __read(_a, 2),
41563
41564
  key = _b[0],
41564
41565
  value = _b[1];
@@ -41567,7 +41568,7 @@ var getCloudSqlVariables = function (_a) {
41567
41568
  return {
41568
41569
  CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
41569
41570
  DB_NAME: DB_NAME,
41570
- DB_USER: (_e = deployConfigRaw.cloudSql.dbUser) !== null && _e !== void 0 ? _e : "postgres",
41571
+ DB_USER: (_c = deployConfigRaw.cloudSql.dbUser) !== null && _c !== void 0 ? _c : "postgres",
41571
41572
  DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
41572
41573
  DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME".concat(additionalQueryParamsString),
41573
41574
  DATABASE_JDBC_URL: "jdbc:postgresql:///$DB_NAME?cloudSqlInstance=$CLOUD_SQL_INSTANCE_CONNECTION_NAME&socketFactory=com.google.cloud.sql.postgres.SocketFactory&user=$DB_USER&password=$DB_PASSWORD".concat(additionalQueryParamsString)
@@ -41786,6 +41787,22 @@ exports.getCloudRunJobName = getCloudRunJobName;
41786
41787
 
41787
41788
  /***/ }),
41788
41789
 
41790
+ /***/ 463:
41791
+ /***/ ((__unused_webpack_module, exports) => {
41792
+
41793
+ "use strict";
41794
+
41795
+
41796
+ exports.__esModule = true;
41797
+ exports.getFullDbName = void 0;
41798
+ var getFullDbName = function (cloudSqlConfig, fullConfig, environmentSlugPrefix, componentName) {
41799
+ var _a, _b;
41800
+ return [(_a = cloudSqlConfig.dbNamePrefix) !== null && _a !== void 0 ? _a : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_b = cloudSqlConfig.dbBaseName) !== null && _b !== void 0 ? _b : componentName].filter(Boolean).join("-");
41801
+ };
41802
+ exports.getFullDbName = getFullDbName;
41803
+
41804
+ /***/ }),
41805
+
41789
41806
  /***/ 6531:
41790
41807
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
41791
41808
 
@@ -42016,8 +42033,9 @@ exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
42016
42033
 
42017
42034
 
42018
42035
  exports.__esModule = true;
42019
- exports.createCloudsqlBaseConfig = exports.getKubernetesCloudSQLConfig = exports.hasKubernetesCloudSQL = void 0;
42036
+ exports.createKubernetesCloudsqlBaseValues = exports.hasKubernetesCloudSQL = void 0;
42020
42037
  var context_1 = __nccwpck_require__(2041);
42038
+ var utils_1 = __nccwpck_require__(463);
42021
42039
  var types_1 = __nccwpck_require__(3109);
42022
42040
  var hasKubernetesCloudSQL = function (context) {
42023
42041
  var _a, _b;
@@ -42027,22 +42045,42 @@ var hasKubernetesCloudSQL = function (context) {
42027
42045
  return false;
42028
42046
  };
42029
42047
  exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
42030
- var getKubernetesCloudSQLConfig = function (context) {
42031
- var _a;
42032
- if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
42033
- return (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
42048
+ var createKubernetesCloudsqlBaseValues = function (context) {
42049
+ var _a, _b, _c, _d, _e;
42050
+ if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
42051
+ throw new Error("cannot get cloud sql config");
42052
+ }
42053
+ var config = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
42054
+ if (!config) {
42055
+ throw new Error("cannot get cloud sql config");
42056
+ }
42057
+ var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
42058
+ if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
42059
+ var instanceConnectionName = "".concat((_b = config.projectId) !== null && _b !== void 0 ? _b : "skynet-164509", ":").concat((_c = config.region) !== null && _c !== void 0 ? _c : "europe-west6", ":").concat((_d = config.instanceId) !== null && _d !== void 0 ? _d : context.environment.envVars.KUBE_NAMESPACE);
42060
+ return {
42061
+ cloudsql: {
42062
+ enabled: config.enabled,
42063
+ dbUser: "postgres",
42064
+ instanceConnectionName: instanceConnectionName,
42065
+ proxyCredentials: proxyCredentials,
42066
+ fullDbName: context.environment.envVars.KUBE_APP_NAME
42067
+ }
42068
+ };
42069
+ } else if (config.type === "unmanaged") {
42070
+ return {
42071
+ cloudsql: {
42072
+ enabled: config.enabled,
42073
+ dbUser: (_e = config.dbUser) !== null && _e !== void 0 ? _e : "postgres",
42074
+ instanceConnectionName: config.instanceConnectionName,
42075
+ proxyCredentials: proxyCredentials,
42076
+ fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName)
42077
+ }
42078
+ };
42079
+ } else {
42080
+ throw new Error("unknonw type");
42034
42081
  }
42035
- throw new Error("cannot get cloud sql config");
42036
- };
42037
- exports.getKubernetesCloudSQLConfig = getKubernetesCloudSQLConfig;
42038
- var createCloudsqlBaseConfig = function (context) {
42039
- return {
42040
- cloudsql: {
42041
- proxyCredentials: "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"))
42042
- }
42043
- };
42044
42082
  };
42045
- exports.createCloudsqlBaseConfig = createCloudsqlBaseConfig;
42083
+ exports.createKubernetesCloudsqlBaseValues = createKubernetesCloudsqlBaseValues;
42046
42084
 
42047
42085
  /***/ }),
42048
42086
 
@@ -42425,7 +42463,7 @@ var createKubeValues = function (context) {
42425
42463
  var defaultKubeValues = (0, lodash_1.merge)({
42426
42464
  env: env,
42427
42465
  application: createAppConfig(context, application)
42428
- }, (0, cloudSql_1.hasKubernetesCloudSQL)(context) ? (0, cloudSql_1.createCloudsqlBaseConfig)(context) : {}, ((_b = (_a = deployConfig.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
42466
+ }, (0, cloudSql_1.hasKubernetesCloudSQL)(context) ? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context) : {}, ((_b = (_a = deployConfig.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
42429
42467
  var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({
42430
42468
  jobs: removeFalsy(jobs),
42431
42469
  cronjobs: removeFalsy(cronjobs)
@@ -1464,6 +1464,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
1464
1464
  };
1465
1465
  exports.__esModule = true;
1466
1466
  var pipeline_1 = __nccwpck_require__(25355);
1467
+ var pipeline_2 = __nccwpck_require__(25355);
1467
1468
  var child_process_promise_1 = __nccwpck_require__(75763);
1468
1469
  var fs_extra_1 = __nccwpck_require__(85501);
1469
1470
  var tmp_promise_1 = __nccwpck_require__(68841);
@@ -1494,13 +1495,13 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
1494
1495
  if (env === "review") {
1495
1496
  vorpal.log("⚠️ connection string does not include mr information on review environments");
1496
1497
  }
1497
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) return [3 /*break*/, 3];
1498
+ if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) return [3 /*break*/, 3];
1498
1499
  return [4 /*yield*/, getProxyInfoForKubernetes(context)];
1499
1500
  case 2:
1500
1501
  proxyInfo = _c.sent();
1501
1502
  return [3 /*break*/, 6];
1502
1503
  case 3:
1503
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) return [3 /*break*/, 5];
1504
+ if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) return [3 /*break*/, 5];
1504
1505
  return [4 /*yield*/, getProxyInfoForCloudRun(context)];
1505
1506
  case 4:
1506
1507
  proxyInfo = _c.sent();
@@ -1562,27 +1563,20 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
1562
1563
  });
1563
1564
  }); });
1564
1565
  var getProxyInfoForKubernetes = function (context) { return __awaiter(void 0, void 0, void 0, function () {
1565
- var envVars, DB_PASSWORD, DB_NAME, values, projectId, defaultInstanceId, instanceId, defaultRegion, region, instanceName;
1566
- var _a, _b, _c, _d;
1567
- return __generator(this, function (_e) {
1568
- switch (_e.label) {
1566
+ var envVars, cloudSqlValues, DB_PASSWORD, DB_NAME, instanceName;
1567
+ return __generator(this, function (_a) {
1568
+ switch (_a.label) {
1569
1569
  case 0:
1570
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
1570
+ if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
1571
1571
  throw new Error("unsupported");
1572
1572
  }
1573
1573
  return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(this, context.environment.shortName, context.componentName)];
1574
1574
  case 1:
1575
- envVars = _e.sent();
1575
+ envVars = _a.sent();
1576
+ cloudSqlValues = (0, pipeline_1.createKubernetesCloudsqlBaseValues)(context);
1576
1577
  DB_PASSWORD = (envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD) || (envVars === null || envVars === void 0 ? void 0 : envVars.POSTGRESQL_PASSWORD);
1577
- DB_NAME = context.environment.envVars.KUBE_APP_NAME;
1578
- values = context.componentConfig.deploy.values;
1579
- projectId = ((_a = values === null || values === void 0 ? void 0 : values.cloudsql) === null || _a === void 0 ? void 0 : _a.projectId) ||
1580
- ((_b = context.componentConfig.deploy.cluster) === null || _b === void 0 ? void 0 : _b.projectId);
1581
- defaultInstanceId = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "-").concat(context.environment.shortName);
1582
- instanceId = ((_c = values === null || values === void 0 ? void 0 : values.cloudsql) === null || _c === void 0 ? void 0 : _c.instanceId) || defaultInstanceId;
1583
- defaultRegion = "europe-west6";
1584
- region = ((_d = values === null || values === void 0 ? void 0 : values.cloudsql) === null || _d === void 0 ? void 0 : _d.region) || defaultRegion;
1585
- instanceName = "".concat(projectId, ":").concat(region, ":").concat(instanceId);
1578
+ DB_NAME = cloudSqlValues.cloudsql.fullDbName;
1579
+ instanceName = cloudSqlValues.cloudsql.instanceConnectionName;
1586
1580
  return [2 /*return*/, {
1587
1581
  instanceName: instanceName,
1588
1582
  DB_PASSWORD: DB_PASSWORD,
@@ -1597,7 +1591,7 @@ var getProxyInfoForCloudRun = function (context) { return __awaiter(void 0, void
1597
1591
  return __generator(this, function (_a) {
1598
1592
  switch (_a.label) {
1599
1593
  case 0:
1600
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ||
1594
+ if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ||
1601
1595
  !context.componentConfig.deploy.cloudSql) {
1602
1596
  throw new Error("unsupported");
1603
1597
  }
@@ -4551,69 +4545,6 @@ exports.setupCloudRun = setupCloudRun;
4551
4545
 
4552
4546
  /***/ }),
4553
4547
 
4554
- /***/ 63660:
4555
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
4556
-
4557
- "use strict";
4558
-
4559
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4560
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4561
- return new (P || (P = Promise))(function (resolve, reject) {
4562
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4563
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
4564
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
4565
- step((generator = generator.apply(thisArg, _arguments || [])).next());
4566
- });
4567
- };
4568
- var __generator = (this && this.__generator) || function (thisArg, body) {
4569
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
4570
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
4571
- function verb(n) { return function (v) { return step([n, v]); }; }
4572
- function step(op) {
4573
- if (f) throw new TypeError("Generator is already executing.");
4574
- while (_) try {
4575
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
4576
- if (y = 0, t) op = [op[0] & 2, t.value];
4577
- switch (op[0]) {
4578
- case 0: case 1: t = op; break;
4579
- case 4: _.label++; return { value: op[1], done: false };
4580
- case 5: _.label++; y = op[1]; op = [0]; continue;
4581
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
4582
- default:
4583
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
4584
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
4585
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
4586
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
4587
- if (t[2]) _.ops.pop();
4588
- _.trys.pop(); continue;
4589
- }
4590
- op = body.call(thisArg, _);
4591
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
4592
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
4593
- }
4594
- };
4595
- exports.__esModule = true;
4596
- exports.setupCloudSQL = void 0;
4597
- var pipeline_1 = __nccwpck_require__(25355);
4598
- var setupCloudSQL = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
4599
- var config;
4600
- return __generator(this, function (_a) {
4601
- if (!(0, pipeline_1.hasKubernetesCloudSQL)(context)) {
4602
- throw new Error("cannot setup cloudsql, as it has none");
4603
- }
4604
- config = (0, pipeline_1.getKubernetesCloudSQLConfig)(context);
4605
- instance.log("");
4606
- instance.log("! make sure to provide cloudsqlProxyCredentials for the cloud sql service account in " +
4607
- config.projectId);
4608
- instance.log("");
4609
- return [2 /*return*/];
4610
- });
4611
- }); };
4612
- exports.setupCloudSQL = setupCloudSQL;
4613
- //# sourceMappingURL=setupCloudSQL.js.map
4614
-
4615
- /***/ }),
4616
-
4617
4548
  /***/ 40663:
4618
4549
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
4619
4550
 
@@ -4659,7 +4590,6 @@ exports.__esModule = true;
4659
4590
  exports.setupContext = void 0;
4660
4591
  var pipeline_1 = __nccwpck_require__(25355);
4661
4592
  var setupCloudRun_1 = __nccwpck_require__(89010);
4662
- var setupCloudSQL_1 = __nccwpck_require__(63660);
4663
4593
  var setupKubernetes_1 = __nccwpck_require__(82308);
4664
4594
  var setupContext = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
4665
4595
  var deployConfig;
@@ -4680,19 +4610,13 @@ var setupContext = function (instance, context) { return __awaiter(void 0, void
4680
4610
  _a.sent();
4681
4611
  _a.label = 2;
4682
4612
  case 2:
4683
- if (!(0, pipeline_1.hasKubernetesCloudSQL)(context)) return [3 /*break*/, 4];
4684
- return [4 /*yield*/, (0, setupCloudSQL_1.setupCloudSQL)(instance, context)];
4613
+ deployConfig = context.componentConfig.deploy;
4614
+ if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) return [3 /*break*/, 4];
4615
+ return [4 /*yield*/, (0, setupKubernetes_1.setupKubernetes)(instance, context)];
4685
4616
  case 3:
4686
4617
  _a.sent();
4687
4618
  _a.label = 4;
4688
4619
  case 4:
4689
- deployConfig = context.componentConfig.deploy;
4690
- if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) return [3 /*break*/, 6];
4691
- return [4 /*yield*/, (0, setupKubernetes_1.setupKubernetes)(instance, context)];
4692
- case 5:
4693
- _a.sent();
4694
- _a.label = 6;
4695
- case 6:
4696
4620
  instance.log("");
4697
4621
  instance.log("✅ " +
4698
4622
  context.environment.shortName +
@@ -351506,7 +351430,7 @@ exports.readConfigSync = readConfigSync;
351506
351430
 
351507
351431
  exports.__esModule = true;
351508
351432
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
351509
- exports.PIPELINE_IMAGE_TAG = "main-c6987376" || 0;
351433
+ exports.PIPELINE_IMAGE_TAG = "main-b35071da" || 0;
351510
351434
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
351511
351435
 
351512
351436
  /***/ }),
@@ -352944,20 +352868,21 @@ exports.__esModule = true;
352944
352868
  exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
352945
352869
  var context_1 = __nccwpck_require__(22041);
352946
352870
  var gitlab_1 = __nccwpck_require__(84997);
352871
+ var utils_1 = __nccwpck_require__(70463);
352947
352872
  var deployJob_1 = __nccwpck_require__(82256);
352948
352873
  var jobName_1 = __nccwpck_require__(77311);
352949
352874
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
352950
352875
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
352951
352876
  var getCloudSqlVariables = function (_a) {
352952
- var _b, _c, _d, _e;
352877
+ var _b, _c;
352953
352878
  var deployConfigRaw = _a.deployConfigRaw,
352954
352879
  environmentSlugPrefix = _a.environmentSlugPrefix,
352955
352880
  env = _a.env,
352956
352881
  componentName = _a.componentName,
352957
352882
  fullConfig = _a.fullConfig;
352958
352883
  if (deployConfigRaw && deployConfigRaw.cloudSql) {
352959
- var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_c = deployConfigRaw.cloudSql.dbBaseName) !== null && _c !== void 0 ? _c : componentName].filter(Boolean).join("-");
352960
- var additionalQueryParamsString = Object.entries((_d = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _d !== void 0 ? _d : {}).map(function (_a) {
352884
+ var DB_NAME = (0, utils_1.getFullDbName)(deployConfigRaw.cloudSql, fullConfig, environmentSlugPrefix, componentName);
352885
+ var additionalQueryParamsString = Object.entries((_b = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _b !== void 0 ? _b : {}).map(function (_a) {
352961
352886
  var _b = __read(_a, 2),
352962
352887
  key = _b[0],
352963
352888
  value = _b[1];
@@ -352966,7 +352891,7 @@ var getCloudSqlVariables = function (_a) {
352966
352891
  return {
352967
352892
  CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
352968
352893
  DB_NAME: DB_NAME,
352969
- DB_USER: (_e = deployConfigRaw.cloudSql.dbUser) !== null && _e !== void 0 ? _e : "postgres",
352894
+ DB_USER: (_c = deployConfigRaw.cloudSql.dbUser) !== null && _c !== void 0 ? _c : "postgres",
352970
352895
  DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
352971
352896
  DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME".concat(additionalQueryParamsString),
352972
352897
  DATABASE_JDBC_URL: "jdbc:postgresql:///$DB_NAME?cloudSqlInstance=$CLOUD_SQL_INSTANCE_CONNECTION_NAME&socketFactory=com.google.cloud.sql.postgres.SocketFactory&user=$DB_USER&password=$DB_PASSWORD".concat(additionalQueryParamsString)
@@ -353185,6 +353110,22 @@ exports.getCloudRunJobName = getCloudRunJobName;
353185
353110
 
353186
353111
  /***/ }),
353187
353112
 
353113
+ /***/ 70463:
353114
+ /***/ ((__unused_webpack_module, exports) => {
353115
+
353116
+ "use strict";
353117
+
353118
+
353119
+ exports.__esModule = true;
353120
+ exports.getFullDbName = void 0;
353121
+ var getFullDbName = function (cloudSqlConfig, fullConfig, environmentSlugPrefix, componentName) {
353122
+ var _a, _b;
353123
+ return [(_a = cloudSqlConfig.dbNamePrefix) !== null && _a !== void 0 ? _a : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_b = cloudSqlConfig.dbBaseName) !== null && _b !== void 0 ? _b : componentName].filter(Boolean).join("-");
353124
+ };
353125
+ exports.getFullDbName = getFullDbName;
353126
+
353127
+ /***/ }),
353128
+
353188
353129
  /***/ 16531:
353189
353130
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
353190
353131
 
@@ -353415,8 +353356,9 @@ exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
353415
353356
 
353416
353357
 
353417
353358
  exports.__esModule = true;
353418
- exports.createCloudsqlBaseConfig = exports.getKubernetesCloudSQLConfig = exports.hasKubernetesCloudSQL = void 0;
353359
+ exports.createKubernetesCloudsqlBaseValues = exports.hasKubernetesCloudSQL = void 0;
353419
353360
  var context_1 = __nccwpck_require__(22041);
353361
+ var utils_1 = __nccwpck_require__(70463);
353420
353362
  var types_1 = __nccwpck_require__(63109);
353421
353363
  var hasKubernetesCloudSQL = function (context) {
353422
353364
  var _a, _b;
@@ -353426,22 +353368,42 @@ var hasKubernetesCloudSQL = function (context) {
353426
353368
  return false;
353427
353369
  };
353428
353370
  exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
353429
- var getKubernetesCloudSQLConfig = function (context) {
353430
- var _a;
353431
- if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
353432
- return (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
353371
+ var createKubernetesCloudsqlBaseValues = function (context) {
353372
+ var _a, _b, _c, _d, _e;
353373
+ if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
353374
+ throw new Error("cannot get cloud sql config");
353375
+ }
353376
+ var config = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
353377
+ if (!config) {
353378
+ throw new Error("cannot get cloud sql config");
353379
+ }
353380
+ var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
353381
+ if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
353382
+ var instanceConnectionName = "".concat((_b = config.projectId) !== null && _b !== void 0 ? _b : "skynet-164509", ":").concat((_c = config.region) !== null && _c !== void 0 ? _c : "europe-west6", ":").concat((_d = config.instanceId) !== null && _d !== void 0 ? _d : context.environment.envVars.KUBE_NAMESPACE);
353383
+ return {
353384
+ cloudsql: {
353385
+ enabled: config.enabled,
353386
+ dbUser: "postgres",
353387
+ instanceConnectionName: instanceConnectionName,
353388
+ proxyCredentials: proxyCredentials,
353389
+ fullDbName: context.environment.envVars.KUBE_APP_NAME
353390
+ }
353391
+ };
353392
+ } else if (config.type === "unmanaged") {
353393
+ return {
353394
+ cloudsql: {
353395
+ enabled: config.enabled,
353396
+ dbUser: (_e = config.dbUser) !== null && _e !== void 0 ? _e : "postgres",
353397
+ instanceConnectionName: config.instanceConnectionName,
353398
+ proxyCredentials: proxyCredentials,
353399
+ fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName)
353400
+ }
353401
+ };
353402
+ } else {
353403
+ throw new Error("unknonw type");
353433
353404
  }
353434
- throw new Error("cannot get cloud sql config");
353435
- };
353436
- exports.getKubernetesCloudSQLConfig = getKubernetesCloudSQLConfig;
353437
- var createCloudsqlBaseConfig = function (context) {
353438
- return {
353439
- cloudsql: {
353440
- proxyCredentials: "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"))
353441
- }
353442
- };
353443
353405
  };
353444
- exports.createCloudsqlBaseConfig = createCloudsqlBaseConfig;
353406
+ exports.createKubernetesCloudsqlBaseValues = createKubernetesCloudsqlBaseValues;
353445
353407
 
353446
353408
  /***/ }),
353447
353409
 
@@ -353824,7 +353786,7 @@ var createKubeValues = function (context) {
353824
353786
  var defaultKubeValues = (0, lodash_1.merge)({
353825
353787
  env: env,
353826
353788
  application: createAppConfig(context, application)
353827
- }, (0, cloudSql_1.hasKubernetesCloudSQL)(context) ? (0, cloudSql_1.createCloudsqlBaseConfig)(context) : {}, ((_b = (_a = deployConfig.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
353789
+ }, (0, cloudSql_1.hasKubernetesCloudSQL)(context) ? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context) : {}, ((_b = (_a = deployConfig.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
353828
353790
  var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({
353829
353791
  jobs: removeFalsy(jobs),
353830
353792
  cronjobs: removeFalsy(cronjobs)