@catladder/cli 0.0.0-inventory-2f61feef → 0.0.0-jdbc-e0855190

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.
Files changed (31) hide show
  1. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +106 -45
  2. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
  3. package/dist/apps/cli/commands/project/commandSecretsClearBackups.d.ts +5 -0
  4. package/dist/apps/cli/commands/project/commandSecretsClearBackups.js +90 -0
  5. package/dist/apps/cli/commands/project/commandSecretsClearBackups.js.map +1 -0
  6. package/dist/apps/cli/commands/project/index.js +2 -0
  7. package/dist/apps/cli/commands/project/index.js.map +1 -1
  8. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +2 -2
  9. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
  10. package/dist/apps/cli/commands/project/setup/setupCloudRun.js +18 -4
  11. package/dist/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
  12. package/dist/apps/cli/commands/project/setup/setupCloudSQL.js +2 -2
  13. package/dist/apps/cli/commands/project/setup/setupCloudSQL.js.map +1 -1
  14. package/dist/apps/cli/commands/project/setup/setupContext.js +1 -1
  15. package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -1
  16. package/dist/bundles/catenv/index.js +1150 -352
  17. package/dist/bundles/cli/index.js +1477 -505
  18. package/dist/config/getProjectConfig.d.ts +1 -1
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/dist/utils/gitlab.d.ts +3 -1
  21. package/dist/utils/gitlab.js +60 -9
  22. package/dist/utils/gitlab.js.map +1 -1
  23. package/package.json +2 -2
  24. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +105 -36
  25. package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +27 -0
  26. package/src/apps/cli/commands/project/index.ts +2 -0
  27. package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +21 -10
  28. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +8 -1
  29. package/src/apps/cli/commands/project/setup/setupCloudSQL.ts +6 -3
  30. package/src/apps/cli/commands/project/setup/setupContext.ts +2 -2
  31. package/src/utils/gitlab.ts +50 -12
@@ -613,7 +613,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
613
613
  return (mod && mod.__esModule) ? mod : { "default": mod };
614
614
  };
615
615
  exports.__esModule = true;
616
- exports.upsertAllVariables = exports.getVariableValueByRawName = exports.getAllVariables = exports.getProjectInfo = exports.doGitlabRequest = exports.getGitlabToken = exports.setupGitlabToken = exports.hasGitlabToken = void 0;
616
+ exports.upsertAllVariables = exports.clearBackups = exports.getVariableValueByRawName = exports.getAllVariables = exports.getProjectInfo = exports.doGitlabRequest = exports.getGitlabToken = exports.setupGitlabToken = exports.hasGitlabToken = void 0;
617
617
  var pipeline_1 = __nccwpck_require__(5355);
618
618
  var child_process_promise_1 = __nccwpck_require__(5763);
619
619
  var lodash_1 = __nccwpck_require__(3255);
@@ -687,28 +687,31 @@ var getGitlabToken = function (vorpal) { return __awaiter(void 0, void 0, void 0
687
687
  });
688
688
  }); };
689
689
  exports.getGitlabToken = getGitlabToken;
690
- var doGitlabRequest = function (vorpal, path, data, update) {
690
+ var doGitlabRequest = function (vorpal, path, data, method) {
691
691
  if (data === void 0) { data = undefined; }
692
+ if (method === void 0) { method = "GET"; }
692
693
  return __awaiter(void 0, void 0, void 0, function () {
693
- var rootToken, method, result, _a, _b, _c, _d, _e;
694
+ var rootToken, result, _a, _b, _c, _d, _e;
694
695
  return __generator(this, function (_f) {
695
696
  switch (_f.label) {
696
697
  case 0: return [4 /*yield*/, (0, exports.getGitlabToken)(vorpal)];
697
698
  case 1:
698
699
  rootToken = _f.sent();
699
- method = data ? (update ? "PUT" : "POST") : "GET";
700
700
  return [4 /*yield*/, (0, node_fetch_1["default"])("https://git.panter.ch/api/v4/".concat(path), {
701
701
  method: method,
702
702
  headers: {
703
703
  "Content-Type": "application/json",
704
704
  "Private-Token": rootToken
705
705
  },
706
- body: JSON.stringify(data)
706
+ body: data ? JSON.stringify(data) : undefined
707
707
  })];
708
708
  case 2:
709
709
  result = _f.sent();
710
710
  if (result.status >= 200 && result.status < 400) {
711
- return [2 /*return*/, result.json()];
711
+ if (result.headers.get("content-type") === "application/json") {
712
+ return [2 /*return*/, result.json()];
713
+ }
714
+ return [2 /*return*/, null];
712
715
  }
713
716
  if (result.status === 404) {
714
717
  throw new Error("not found");
@@ -790,7 +793,7 @@ var createVariable = function (vorpal, projectId, key, value, masked, environmen
790
793
  value: value,
791
794
  masked: masked && isMaskable(value),
792
795
  environment_scope: environment_scope
793
- })];
796
+ }, "POST")];
794
797
  case 1: return [2 /*return*/, _a.sent()];
795
798
  }
796
799
  });
@@ -804,12 +807,20 @@ var updateVariable = function (vorpal, projectId, key, value, masked) {
804
807
  case 0: return [4 /*yield*/, (0, exports.doGitlabRequest)(vorpal, "projects/".concat(projectId, "/variables/").concat(key), {
805
808
  value: value,
806
809
  masked: masked && isMaskable(value)
807
- }, true)];
810
+ }, "PUT")];
808
811
  case 1: return [2 /*return*/, _a.sent()];
809
812
  }
810
813
  });
811
814
  });
812
815
  };
816
+ var deleteVariable = function (vorpal, projectId, key) { return __awaiter(void 0, void 0, void 0, function () {
817
+ return __generator(this, function (_a) {
818
+ switch (_a.label) {
819
+ case 0: return [4 /*yield*/, (0, exports.doGitlabRequest)(vorpal, "projects/".concat(projectId, "/variables/").concat(key), undefined, "DELETE")];
820
+ case 1: return [2 /*return*/, _a.sent()];
821
+ }
822
+ });
823
+ }); };
813
824
  var getAllCatladderEnvVarsInGitlab = function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
814
825
  var allVariables;
815
826
  return __generator(this, function (_a) {
@@ -839,6 +850,46 @@ var getAllCatladderEnvVarsInGitlab = function (vorpal) { return __awaiter(void 0
839
850
  }
840
851
  });
841
852
  }); };
853
+ var getBackupKey = function (fullKey, timestamp) {
854
+ return "".concat(fullKey, "_backup_").concat(timestamp);
855
+ };
856
+ var clearBackups = function (vorpal, keep) { return __awaiter(void 0, void 0, void 0, function () {
857
+ var existingVariables, id, _i, _a, _b, key, backups, backupsSorted, toDelete, _c, toDelete_1, timestamp;
858
+ return __generator(this, function (_d) {
859
+ switch (_d.label) {
860
+ case 0: return [4 /*yield*/, getAllCatladderEnvVarsInGitlab(vorpal)];
861
+ case 1:
862
+ existingVariables = _d.sent();
863
+ return [4 /*yield*/, (0, exports.getProjectInfo)(vorpal)];
864
+ case 2:
865
+ id = (_d.sent()).id;
866
+ _i = 0, _a = Object.entries(existingVariables);
867
+ _d.label = 3;
868
+ case 3:
869
+ if (!(_i < _a.length)) return [3 /*break*/, 8];
870
+ _b = _a[_i], key = _b[0], backups = _b[1].backups;
871
+ backupsSorted = backups.sort(function (a, b) { return b - a; });
872
+ toDelete = backupsSorted.slice(keep);
873
+ _c = 0, toDelete_1 = toDelete;
874
+ _d.label = 4;
875
+ case 4:
876
+ if (!(_c < toDelete_1.length)) return [3 /*break*/, 7];
877
+ timestamp = toDelete_1[_c];
878
+ return [4 /*yield*/, deleteVariable(vorpal, id, getBackupKey(key, timestamp))];
879
+ case 5:
880
+ _d.sent();
881
+ _d.label = 6;
882
+ case 6:
883
+ _c++;
884
+ return [3 /*break*/, 4];
885
+ case 7:
886
+ _i++;
887
+ return [3 /*break*/, 3];
888
+ case 8: return [2 /*return*/];
889
+ }
890
+ });
891
+ }); };
892
+ exports.clearBackups = clearBackups;
842
893
  var upsertAllVariables = function (vorpal, variables, env, componentName, backup, masked // FIXME: would be better to have this per variable
843
894
  ) {
844
895
  if (backup === void 0) { backup = true; }
@@ -871,7 +922,7 @@ var upsertAllVariables = function (vorpal, variables, env, componentName, backup
871
922
  case 4:
872
923
  _d.sent();
873
924
  if (!backup) return [3 /*break*/, 6];
874
- return [4 /*yield*/, createVariable(vorpal, id, fullKey + "_backup_" + new Date().getTime(), oldValue, masked, "_backup")];
925
+ return [4 /*yield*/, createVariable(vorpal, id, getBackupKey(fullKey, new Date().getTime()), oldValue, masked, "_backup")];
875
926
  case 5:
876
927
  _d.sent();
877
928
  _d.label = 6;
@@ -38703,8 +38754,6 @@ var lodash_1 = __nccwpck_require__(3255);
38703
38754
 
38704
38755
  var __1 = __nccwpck_require__(5355);
38705
38756
 
38706
- var reportingJob_1 = __nccwpck_require__(9572);
38707
-
38708
38757
  var utils_1 = __nccwpck_require__(7461);
38709
38758
 
38710
38759
  var yarn_1 = __nccwpck_require__(464);
@@ -38714,12 +38763,11 @@ var constants_1 = __nccwpck_require__(1542);
38714
38763
  var getBuildInfo_1 = __nccwpck_require__(9197);
38715
38764
 
38716
38765
  var createBuildJob = function (context, _a) {
38717
- var _b, _c, _d;
38766
+ var _b, _c;
38718
38767
 
38719
38768
  var script = _a.script,
38720
38769
  variables = _a.variables,
38721
- artifacts = _a.artifacts,
38722
- def = __rest(_a, ["script", "variables", "artifacts"]);
38770
+ def = __rest(_a, ["script", "variables"]);
38723
38771
 
38724
38772
  return (0, lodash_1.merge)({
38725
38773
  name: constants_1.APP_BUILD_JOB_NAME,
@@ -38731,7 +38779,7 @@ var createBuildJob = function (context, _a) {
38731
38779
  variables: __assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
38732
38780
  script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, getBuildInfo_1.getBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
38733
38781
  artifacts: {
38734
- paths: __spreadArray([context.componentConfig.dir + "/__build_info.json", context.componentConfig.dir + "/" + reportingJob_1.INVENTORY_ARTIFACTS_DIR], __read((_d = artifacts === null || artifacts === void 0 ? void 0 : artifacts.paths) !== null && _d !== void 0 ? _d : []), false)
38782
+ paths: [context.componentConfig.dir + "/__build_info.json"]
38735
38783
  }
38736
38784
  }, def);
38737
38785
  };
@@ -38759,6 +38807,168 @@ exports.getBuildInfo = getBuildInfo;
38759
38807
 
38760
38808
  /***/ }),
38761
38809
 
38810
+ /***/ 2644:
38811
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
38812
+
38813
+ "use strict";
38814
+
38815
+
38816
+ var __assign = this && this.__assign || function () {
38817
+ __assign = Object.assign || function (t) {
38818
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
38819
+ s = arguments[i];
38820
+
38821
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
38822
+ }
38823
+
38824
+ return t;
38825
+ };
38826
+
38827
+ return __assign.apply(this, arguments);
38828
+ };
38829
+
38830
+ var __read = this && this.__read || function (o, n) {
38831
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
38832
+ if (!m) return o;
38833
+ var i = m.call(o),
38834
+ r,
38835
+ ar = [],
38836
+ e;
38837
+
38838
+ try {
38839
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
38840
+ } catch (error) {
38841
+ e = {
38842
+ error: error
38843
+ };
38844
+ } finally {
38845
+ try {
38846
+ if (r && !r.done && (m = i["return"])) m.call(i);
38847
+ } finally {
38848
+ if (e) throw e.error;
38849
+ }
38850
+ }
38851
+
38852
+ return ar;
38853
+ };
38854
+
38855
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
38856
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
38857
+ if (ar || !(i in from)) {
38858
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
38859
+ ar[i] = from[i];
38860
+ }
38861
+ }
38862
+ return to.concat(ar || Array.prototype.slice.call(from));
38863
+ };
38864
+
38865
+ exports.__esModule = true;
38866
+ exports.createCustomBuildJobs = void 0;
38867
+
38868
+ var path_1 = __nccwpck_require__(1017);
38869
+
38870
+ var utils_1 = __nccwpck_require__(7461);
38871
+
38872
+ var constants_1 = __nccwpck_require__(1542);
38873
+
38874
+ var createBuildJob_1 = __nccwpck_require__(8063);
38875
+
38876
+ var docker_1 = __nccwpck_require__(3219);
38877
+
38878
+ var types_1 = __nccwpck_require__(1197);
38879
+
38880
+ var RUNNER_BUILD_VARIABLES = {
38881
+ KUBERNETES_CPU_REQUEST: "0.5",
38882
+ KUBERNETES_CPU_LIMIT: "2",
38883
+ KUBERNETES_MEMORY_REQUEST: "2Gi",
38884
+ KUBERNETES_MEMORY_LIMIT: "4Gi"
38885
+ };
38886
+
38887
+ var createCustomBuildJobs = function (context) {
38888
+ var _a, _b, _c, _d;
38889
+
38890
+ var buildConfig = context.componentConfig.build;
38891
+
38892
+ if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
38893
+ throw new Error("deploy config is not custom");
38894
+ }
38895
+
38896
+ var appBuildJob = buildConfig.buildCommand !== null ? (0, createBuildJob_1.createBuildJob)(context, {
38897
+ image: buildConfig.jobImage,
38898
+ variables: __assign({}, RUNNER_BUILD_VARIABLES),
38899
+ script: __spreadArray([], __read((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : []), false),
38900
+ artifacts: {
38901
+ paths: __spreadArray([(0, path_1.join)(context.componentConfig.dir, "__build_info.json"), (0, path_1.join)(context.componentConfig.dir, "dist")], __read((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
38902
+ return (0, path_1.join)(context.componentConfig.dir, path);
38903
+ })) !== null && _c !== void 0 ? _c : []), false)
38904
+ }
38905
+ }) : null;
38906
+ return __spreadArray(__spreadArray([], __read(appBuildJob ? [appBuildJob] : []), false), __read((0, docker_1.requiresDockerBuild)(context) ? [(0, docker_1.createDockerBuildJobDefault)(context, {
38907
+ script: [((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : "" // e.g. custom,
38908
+ ].filter(Boolean),
38909
+ variables: {},
38910
+ needs: appBuildJob ? [constants_1.APP_BUILD_JOB_NAME] : []
38911
+ })] : []), false);
38912
+ };
38913
+
38914
+ exports.createCustomBuildJobs = createCustomBuildJobs;
38915
+
38916
+ /***/ }),
38917
+
38918
+ /***/ 3437:
38919
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
38920
+
38921
+ "use strict";
38922
+
38923
+
38924
+ var __read = this && this.__read || function (o, n) {
38925
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
38926
+ if (!m) return o;
38927
+ var i = m.call(o),
38928
+ r,
38929
+ ar = [],
38930
+ e;
38931
+
38932
+ try {
38933
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
38934
+ } catch (error) {
38935
+ e = {
38936
+ error: error
38937
+ };
38938
+ } finally {
38939
+ try {
38940
+ if (r && !r.done && (m = i["return"])) m.call(i);
38941
+ } finally {
38942
+ if (e) throw e.error;
38943
+ }
38944
+ }
38945
+
38946
+ return ar;
38947
+ };
38948
+
38949
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
38950
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
38951
+ if (ar || !(i in from)) {
38952
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
38953
+ ar[i] = from[i];
38954
+ }
38955
+ }
38956
+ return to.concat(ar || Array.prototype.slice.call(from));
38957
+ };
38958
+
38959
+ exports.__esModule = true;
38960
+ exports.createCustomJobs = void 0;
38961
+
38962
+ var buildJob_1 = __nccwpck_require__(2644);
38963
+
38964
+ var createCustomJobs = function (context) {
38965
+ return __spreadArray([], __read((0, buildJob_1.createCustomBuildJobs)(context)), false);
38966
+ };
38967
+
38968
+ exports.createCustomJobs = createCustomJobs;
38969
+
38970
+ /***/ }),
38971
+
38762
38972
  /***/ 3219:
38763
38973
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
38764
38974
 
@@ -38964,6 +39174,8 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
38964
39174
  exports.__esModule = true;
38965
39175
  exports.BUILD_TYPES = void 0;
38966
39176
 
39177
+ var custom_1 = __nccwpck_require__(3437);
39178
+
38967
39179
  var node_1 = __nccwpck_require__(6994);
38968
39180
 
38969
39181
  __exportStar(__nccwpck_require__(1197), exports);
@@ -39003,6 +39215,12 @@ exports.BUILD_TYPES = {
39003
39215
  startCommand: "node main.js"
39004
39216
  };
39005
39217
  }
39218
+ },
39219
+ custom: {
39220
+ jobs: custom_1.createCustomJobs,
39221
+ defaults: function () {
39222
+ return {};
39223
+ }
39006
39224
  }
39007
39225
  };
39008
39226
 
@@ -39084,10 +39302,8 @@ var constants_2 = __nccwpck_require__(9284);
39084
39302
 
39085
39303
  var yarn_1 = __nccwpck_require__(464);
39086
39304
 
39087
- var reportingJob_1 = __nccwpck_require__(9572);
39088
-
39089
39305
  var createNodeBuildJobs = function (context) {
39090
- var _a, _b, _c, _d, _e, _f, _g;
39306
+ var _a, _b, _c, _d, _e;
39091
39307
 
39092
39308
  var buildConfig = context.componentConfig.build;
39093
39309
 
@@ -39096,17 +39312,14 @@ var createNodeBuildJobs = function (context) {
39096
39312
  }
39097
39313
 
39098
39314
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
39099
- var yarnReportDependenciesListCommand = ((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.isClassic) ? "npm ls --depth 0 --json -prod | jq '.dependencies | to_entries | .[] | {artifact: .key, version: .value.version, type: \"npm\"}'" : "yarn info --json -A| jq '{version: .children.Version, artifact: .value, type: \"npm\" }'";
39100
- var debugcom = ((_b = context.packageManagerInfo) === null || _b === void 0 ? void 0 : _b.isClassic) ? "npm ls --depth 0 --json -prod" : "yarn info --json -A";
39101
- var yarnReportDependenciesCommand = ["mkdir -p ".concat(reportingJob_1.INVENTORY_ARTIFACTS_DIR_DEPENDENCIES), yarnReportDependenciesListCommand + " > " + reportingJob_1.INVENTORY_ARTIFACTS_DIR_DEPENDENCIES + "/app.jsonl"];
39102
39315
  var appBuildJob = buildConfig.buildCommand !== null ? (0, createBuildJob_1.createBuildJob)(context, {
39103
39316
  variables: __assign({}, constants_2.NODE_RUNNER_BUILD_VARIABLES),
39104
39317
  cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read((0, cache_1.getNextCache)(context)), false),
39105
- script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(yarnInstall), false), __read((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : []), false), [debugcom], false), __read(yarnReportDependenciesCommand), false),
39318
+ script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : []), false),
39106
39319
  artifacts: {
39107
- paths: __spreadArray([(0, path_1.join)(context.componentConfig.dir, "dist"), (0, path_1.join)(context.componentConfig.dir, ".next")], __read((_e = (_d = buildConfig.artifactsPaths) === null || _d === void 0 ? void 0 : _d.map(function (path) {
39320
+ paths: __spreadArray([(0, path_1.join)(context.componentConfig.dir, "__build_info.json"), (0, path_1.join)(context.componentConfig.dir, "dist"), (0, path_1.join)(context.componentConfig.dir, ".next")], __read((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
39108
39321
  return (0, path_1.join)(context.componentConfig.dir, path);
39109
- })) !== null && _e !== void 0 ? _e : []), false)
39322
+ })) !== null && _c !== void 0 ? _c : []), false)
39110
39323
  }
39111
39324
  }) : null;
39112
39325
  return __spreadArray(__spreadArray([], __read(appBuildJob ? [appBuildJob] : []), false), __read((0, docker_1.requiresDockerBuild)(context) ? [(0, docker_1.createDockerBuildJobDefault)(context, {
@@ -39121,9 +39334,9 @@ var createNodeBuildJobs = function (context) {
39121
39334
  prodOnly: true,
39122
39335
  noScripts: true
39123
39336
  }),
39124
- DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.pathsToCopyInDocker.map(function (dir) {
39337
+ DOCKER_COPY_WORKSPACE_FILES: (_e = (_d = context.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.pathsToCopyInDocker.map(function (dir) {
39125
39338
  return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir);
39126
- })) === null || _g === void 0 ? void 0 : _g.join("\n")
39339
+ })) === null || _e === void 0 ? void 0 : _e.join("\n")
39127
39340
  },
39128
39341
  needs: appBuildJob ? [constants_1.APP_BUILD_JOB_NAME] : []
39129
39342
  })] : []), false);
@@ -39180,14 +39393,21 @@ exports.getNextCache = exports.getNodeCache = exports.getNodeModulesCache = expo
39180
39393
  var path_1 = __nccwpck_require__(1017);
39181
39394
 
39182
39395
  var getYarnCache = function (context, policy) {
39396
+ var _a;
39397
+
39183
39398
  if (policy === void 0) {
39184
39399
  policy = "pull-push";
39185
39400
  }
39186
39401
 
39187
- return [{
39402
+ var componentIsInWorkspace = (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace;
39403
+ return [componentIsInWorkspace ? {
39188
39404
  key: "yarn",
39189
39405
  policy: policy,
39190
39406
  paths: [".yarn"]
39407
+ } : {
39408
+ key: context.componentConfig.dir + "-yarn",
39409
+ policy: policy,
39410
+ paths: [(0, path_1.join)(context.componentConfig.dir, ".yarn")]
39191
39411
  }];
39192
39412
  };
39193
39413
 
@@ -39595,7 +39815,7 @@ var getYarnInstallCommand = function (context, options) {
39595
39815
 
39596
39816
  return (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.version.startsWith(v);
39597
39817
  });
39598
- return (options === null || options === void 0 ? void 0 : options.prodOnly) ? "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "").concat(doesNotShipWithBuiltInPlugins ? "yarn plugin import workspace-tools && " : " ", "yarn workspaces focus --production") // needs yarn plugin import workspace-tools
39818
+ return (options === null || options === void 0 ? void 0 : options.prodOnly) ? "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "").concat(doesNotShipWithBuiltInPlugins ? "yarn plugin import workspace-tools && " : " ", "yarn workspaces focus --production && yarn rebuild") // needs yarn plugin import workspace-tools
39599
39819
  : "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "", "yarn install --immutable");
39600
39820
  };
39601
39821
 
@@ -39839,17 +40059,312 @@ exports.readConfigSync = readConfigSync;
39839
40059
 
39840
40060
  exports.__esModule = true;
39841
40061
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
39842
- exports.PIPELINE_IMAGE_TAG = "inventory-2f61feef" || 0;
40062
+ exports.PIPELINE_IMAGE_TAG = "jdbc-e0855190" || 0;
39843
40063
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
39844
40064
 
39845
40065
  /***/ }),
39846
40066
 
40067
+ /***/ 5706:
40068
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
40069
+
40070
+ "use strict";
40071
+
40072
+
40073
+ exports.__esModule = true;
40074
+ exports.getEnvConfig = void 0;
40075
+
40076
+ var utils_1 = __nccwpck_require__(7461);
40077
+
40078
+ var getEnvConfig = function (config, componentName, env) {
40079
+ var _a, _b;
40080
+
40081
+ var defaultConfig = config.components[componentName];
40082
+
40083
+ if (!defaultConfig) {
40084
+ throw new Error("unknown component " + componentName);
40085
+ }
40086
+
40087
+ var envCustomizations = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
40088
+
40089
+ if (envCustomizations === false) {
40090
+ throw new Error("env is disabled: " + env);
40091
+ }
40092
+
40093
+ return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
40094
+ };
40095
+
40096
+ exports.getEnvConfig = getEnvConfig;
40097
+
40098
+ /***/ }),
40099
+
40100
+ /***/ 4811:
40101
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
40102
+
40103
+ "use strict";
40104
+
40105
+
40106
+ exports.__esModule = true;
40107
+ exports.getEnvType = void 0;
40108
+
40109
+ var types_1 = __nccwpck_require__(1753);
40110
+
40111
+ var getEnvType = function (env, envConfig) {
40112
+ if (envConfig.type) return envConfig.type;
40113
+
40114
+ if ((0, types_1.isKnowEnvType)(env)) {
40115
+ return env;
40116
+ }
40117
+
40118
+ throw new Error("unknown env type: " + env);
40119
+ };
40120
+
40121
+ exports.getEnvType = getEnvType;
40122
+
40123
+ /***/ }),
40124
+
39847
40125
  /***/ 740:
39848
40126
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
39849
40127
 
39850
40128
  "use strict";
39851
40129
 
39852
40130
 
40131
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
40132
+ function adopt(value) {
40133
+ return value instanceof P ? value : new P(function (resolve) {
40134
+ resolve(value);
40135
+ });
40136
+ }
40137
+
40138
+ return new (P || (P = Promise))(function (resolve, reject) {
40139
+ function fulfilled(value) {
40140
+ try {
40141
+ step(generator.next(value));
40142
+ } catch (e) {
40143
+ reject(e);
40144
+ }
40145
+ }
40146
+
40147
+ function rejected(value) {
40148
+ try {
40149
+ step(generator["throw"](value));
40150
+ } catch (e) {
40151
+ reject(e);
40152
+ }
40153
+ }
40154
+
40155
+ function step(result) {
40156
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
40157
+ }
40158
+
40159
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
40160
+ });
40161
+ };
40162
+
40163
+ var __generator = this && this.__generator || function (thisArg, body) {
40164
+ var _ = {
40165
+ label: 0,
40166
+ sent: function () {
40167
+ if (t[0] & 1) throw t[1];
40168
+ return t[1];
40169
+ },
40170
+ trys: [],
40171
+ ops: []
40172
+ },
40173
+ f,
40174
+ y,
40175
+ t,
40176
+ g;
40177
+ return g = {
40178
+ next: verb(0),
40179
+ "throw": verb(1),
40180
+ "return": verb(2)
40181
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
40182
+ return this;
40183
+ }), g;
40184
+
40185
+ function verb(n) {
40186
+ return function (v) {
40187
+ return step([n, v]);
40188
+ };
40189
+ }
40190
+
40191
+ function step(op) {
40192
+ if (f) throw new TypeError("Generator is already executing.");
40193
+
40194
+ while (_) try {
40195
+ 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;
40196
+ if (y = 0, t) op = [op[0] & 2, t.value];
40197
+
40198
+ switch (op[0]) {
40199
+ case 0:
40200
+ case 1:
40201
+ t = op;
40202
+ break;
40203
+
40204
+ case 4:
40205
+ _.label++;
40206
+ return {
40207
+ value: op[1],
40208
+ done: false
40209
+ };
40210
+
40211
+ case 5:
40212
+ _.label++;
40213
+ y = op[1];
40214
+ op = [0];
40215
+ continue;
40216
+
40217
+ case 7:
40218
+ op = _.ops.pop();
40219
+
40220
+ _.trys.pop();
40221
+
40222
+ continue;
40223
+
40224
+ default:
40225
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
40226
+ _ = 0;
40227
+ continue;
40228
+ }
40229
+
40230
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
40231
+ _.label = op[1];
40232
+ break;
40233
+ }
40234
+
40235
+ if (op[0] === 6 && _.label < t[1]) {
40236
+ _.label = t[1];
40237
+ t = op;
40238
+ break;
40239
+ }
40240
+
40241
+ if (t && _.label < t[2]) {
40242
+ _.label = t[2];
40243
+
40244
+ _.ops.push(op);
40245
+
40246
+ break;
40247
+ }
40248
+
40249
+ if (t[2]) _.ops.pop();
40250
+
40251
+ _.trys.pop();
40252
+
40253
+ continue;
40254
+ }
40255
+
40256
+ op = body.call(thisArg, _);
40257
+ } catch (e) {
40258
+ op = [6, e];
40259
+ y = 0;
40260
+ } finally {
40261
+ f = t = 0;
40262
+ }
40263
+
40264
+ if (op[0] & 5) throw op[1];
40265
+ return {
40266
+ value: op[0] ? op[1] : void 0,
40267
+ done: true
40268
+ };
40269
+ }
40270
+ };
40271
+
40272
+ exports.__esModule = true;
40273
+ exports.getEnvironment = void 0;
40274
+
40275
+ var getEnvironmentContext_1 = __nccwpck_require__(4650);
40276
+
40277
+ var getEnvironmentVariables_1 = __nccwpck_require__(6602);
40278
+
40279
+ var getEnvironment = function (config, componentName, env, commitInfo) {
40280
+ return __awaiter(void 0, void 0, void 0, function () {
40281
+ var _a, envVars, secretEnvVarKeys, host, url, envContext, envType;
40282
+
40283
+ return __generator(this, function (_b) {
40284
+ switch (_b.label) {
40285
+ case 0:
40286
+ return [4
40287
+ /*yield*/
40288
+ , (0, getEnvironmentVariables_1.getEnvironmentVariables)(config, componentName, env, commitInfo)];
40289
+
40290
+ case 1:
40291
+ _a = _b.sent(), envVars = _a.envVars, secretEnvVarKeys = _a.secretEnvVarKeys, host = _a.host, url = _a.url;
40292
+ envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
40293
+ envType = envContext.envType;
40294
+ return [2
40295
+ /*return*/
40296
+ , {
40297
+ envType: envType,
40298
+ host: host,
40299
+ url: url,
40300
+ gitlabEnvironment: {
40301
+ name: envContext.gitlabEnvironmentName,
40302
+ url: url
40303
+ },
40304
+ fullName: envContext.fullName,
40305
+ slug: envContext.environmentSlug,
40306
+ shortName: env,
40307
+ envVars: envVars,
40308
+ secretEnvVarKeys: secretEnvVarKeys
40309
+ }];
40310
+ }
40311
+ });
40312
+ });
40313
+ };
40314
+
40315
+ exports.getEnvironment = getEnvironment;
40316
+
40317
+ /***/ }),
40318
+
40319
+ /***/ 4650:
40320
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
40321
+
40322
+ "use strict";
40323
+
40324
+
40325
+ exports.__esModule = true;
40326
+ exports.getEnvironmentContext = void 0;
40327
+
40328
+ var getEnvConfig_1 = __nccwpck_require__(5706);
40329
+
40330
+ var getEnvType_1 = __nccwpck_require__(4811);
40331
+
40332
+ var getEnvironmentSlug = function (envConfig, env, componentName, commitInfo) {
40333
+ var envType = (0, getEnvType_1.getEnvType)(env, envConfig);
40334
+ return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
40335
+ };
40336
+
40337
+ var getEnvironmentContext = function (config, env, componentName, commitInfo) {
40338
+ var envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env);
40339
+ var envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw);
40340
+ var environmentSlug = getEnvironmentSlug(envConfigRaw, env, componentName, commitInfo);
40341
+ var gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
40342
+ var fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
40343
+ return {
40344
+ envConfigRaw: envConfigRaw,
40345
+ deployConfigRaw: envConfigRaw.deploy,
40346
+ buildConfigRaw: envConfigRaw.build,
40347
+ environmentSlug: environmentSlug,
40348
+ gitlabEnvironmentName: gitlabEnvironmentName,
40349
+ fullName: fullName,
40350
+ envType: envType,
40351
+ commitInfo: commitInfo,
40352
+ componentName: componentName,
40353
+ env: env,
40354
+ fullConfig: config
40355
+ };
40356
+ };
40357
+
40358
+ exports.getEnvironmentContext = getEnvironmentContext;
40359
+
40360
+ /***/ }),
40361
+
40362
+ /***/ 6602:
40363
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
40364
+
40365
+ "use strict";
40366
+
40367
+
39853
40368
  var __assign = this && this.__assign || function () {
39854
40369
  __assign = Object.assign || function (t) {
39855
40370
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -40040,97 +40555,42 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
40040
40555
  return to.concat(ar || Array.prototype.slice.call(from));
40041
40556
  };
40042
40557
 
40043
- var __importDefault = this && this.__importDefault || function (mod) {
40044
- return mod && mod.__esModule ? mod : {
40045
- "default": mod
40046
- };
40047
- };
40048
-
40049
40558
  exports.__esModule = true;
40050
- exports.getEnvironment = exports.getSecretVarNameForContext = exports.getSecretVarName = void 0;
40559
+ exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironmentVariables = void 0;
40051
40560
 
40052
40561
  var lodash_1 = __nccwpck_require__(3255);
40053
40562
 
40054
- var slugify_1 = __importDefault(__nccwpck_require__(4035));
40055
-
40056
40563
  var deploy_1 = __nccwpck_require__(223);
40057
40564
 
40058
- var types_1 = __nccwpck_require__(3109);
40059
-
40060
- var config_1 = __nccwpck_require__(9997);
40061
-
40062
- var utils_1 = __nccwpck_require__(7461);
40565
+ var getEnvironmentContext_1 = __nccwpck_require__(4650);
40063
40566
 
40064
40567
  var resolveReferences_1 = __nccwpck_require__(928);
40065
40568
 
40066
- var sanitizeForEnVar = function (s) {
40067
- return s.replace(/-/g, "_");
40068
- };
40069
-
40070
- var getSecretVarName = function (env, componentName, key) {
40071
- return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
40072
- }; // remove dash from component name
40073
-
40074
-
40075
- exports.getSecretVarName = getSecretVarName;
40076
-
40077
- var addIndexVar = function (vars) {
40078
- return __assign(__assign({}, vars), {
40079
- _ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars))
40080
- });
40081
- };
40082
-
40083
- var getSecretVarNameForContext = function (context, key) {
40084
- return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
40085
- };
40086
-
40087
- exports.getSecretVarNameForContext = getSecretVarNameForContext;
40088
-
40089
- var getEnvironment = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
40569
+ var getEnvironmentVariables = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
40090
40570
  ) {
40091
40571
  if (alreadyVisited === void 0) {
40092
40572
  alreadyVisited = {};
40093
40573
  }
40094
40574
 
40095
40575
  return __awaiter(void 0, void 0, void 0, function () {
40096
- var defaultConfig, envConfig, mergedConfig, envType, basePredefinedVariables, gitlabEnvironmentName, environmentSlug, predefinedVariables, host, url, fullName, devLocalConfig, port, componentSlug, envInUrl, domainCanonical, HOST_CANONICAL, KUBE_APP_NAME_PREFIX, KUBE_APP_NAME, KUBE_NAMESPACE, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
40576
+ var environmentContext, envConfigRaw, deployConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
40097
40577
 
40098
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
40578
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
40099
40579
 
40100
- return __generator(this, function (_o) {
40101
- switch (_o.label) {
40580
+ return __generator(this, function (_k) {
40581
+ switch (_k.label) {
40102
40582
  case 0:
40103
- defaultConfig = config.components[componentName];
40104
-
40105
- if (!defaultConfig) {
40106
- throw new Error("unknown component " + componentName);
40107
- }
40108
-
40109
- envConfig = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
40110
-
40111
- if (envConfig === false) {
40112
- throw new Error("env is disabled: " + env);
40113
- }
40114
-
40115
- mergedConfig = (0, utils_1.mergeWithMergingArrays)(defaultConfig, envConfig);
40116
- envType = (_c = envConfig === null || envConfig === void 0 ? void 0 : envConfig.type) !== null && _c !== void 0 ? _c : (0, config_1.isKnowEnvType)(env) ? env : null;
40117
-
40118
- if (!envType) {
40119
- throw new Error("Missing type in environment " + env + " in component " + componentName);
40120
- }
40121
-
40583
+ environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
40584
+ envConfigRaw = environmentContext.envConfigRaw, deployConfigRaw = environmentContext.deployConfigRaw, envType = environmentContext.envType;
40122
40585
  basePredefinedVariables = {
40123
40586
  ENV_SHORT: env,
40124
- APP_DIR: mergedConfig.dir,
40587
+ APP_DIR: envConfigRaw.dir,
40125
40588
  ENV_TYPE: envType
40126
40589
  };
40127
- gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
40128
- environmentSlug = envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
40129
- fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
40130
40590
 
40131
40591
  if (envType === "local") {
40132
- devLocalConfig = mergedConfig;
40133
- port = (_d = devLocalConfig.port) !== null && _d !== void 0 ? _d : 3000;
40592
+ devLocalConfig = envConfigRaw;
40593
+ port = (_a = devLocalConfig.port) !== null && _a !== void 0 ? _a : 3000;
40134
40594
  host = "localhost:" + port;
40135
40595
  url = "http://" + host;
40136
40596
  predefinedVariables = {
@@ -40139,34 +40599,22 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
40139
40599
  PORT: port.toString()
40140
40600
  };
40141
40601
  } else {
40142
- componentSlug = (0, slugify_1["default"])(componentName);
40143
- envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
40144
- domainCanonical = (mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.deploy) && (mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.deploy.type) === "kubernetes" && ((_e = mergedConfig.deploy.cluster) === null || _e === void 0 ? void 0 : _e.domainCanonical) || // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
40145
- config.domainCanonical || "panter.cloud";
40146
- HOST_CANONICAL = (0, types_1.isOfDeployType)(mergedConfig.deploy, "google-cloudrun") ? fullName.toLowerCase() + "-" + process.env[(0, exports.getSecretVarName)(env, componentName, deploy_1.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)] : "".concat(componentSlug, ".").concat(envInUrl, ".").concat(config.appName, ".").concat(config.customerName, ".").concat(domainCanonical);
40147
- host = (_f = mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.host) !== null && _f !== void 0 ? _f : HOST_CANONICAL;
40602
+ additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
40603
+ host = (_c = (_b = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _b !== void 0 ? _b : additionalEnvVars.HOST_CANONICAL) !== null && _c !== void 0 ? _c : "unknown-host.example.com";
40148
40604
  url = "https://".concat(host);
40149
- KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
40150
- KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
40151
- KUBE_NAMESPACE = (0, deploy_1.getKubernetesNamespace)(config, env);
40152
- predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
40153
- HOST_CANONICAL: HOST_CANONICAL,
40605
+ predefinedVariables = __assign(__assign(__assign({}, basePredefinedVariables), {
40154
40606
  HOST: host,
40155
- ROOT_URL: url,
40156
- KUBE_NAMESPACE: KUBE_NAMESPACE,
40157
- KUBE_APP_NAME: KUBE_APP_NAME,
40158
- KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX
40159
- });
40607
+ ROOT_URL: url
40608
+ }), additionalEnvVars);
40160
40609
  }
40161
40610
 
40162
- publicEnvVarsRaw = (_h = (_g = mergedConfig.vars) === null || _g === void 0 ? void 0 : _g.public) !== null && _h !== void 0 ? _h : {};
40163
- additionalSecretKeys = mergedConfig.deploy ? deploy_1.DEPLOY_TYPES[mergedConfig.deploy.type].additionalSecretKeys( // eslint-disable-next-line @typescript-eslint/no-explicit-any
40164
- mergedConfig.deploy) : [];
40165
- secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_k = (_j = mergedConfig.vars) === null || _j === void 0 ? void 0 : _j.secret) !== null && _k !== void 0 ? _k : []), false), __read(additionalSecretKeys), false);
40611
+ publicEnvVarsRaw = (_e = (_d = envConfigRaw.vars) === null || _d === void 0 ? void 0 : _d.public) !== null && _e !== void 0 ? _e : {};
40612
+ additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
40613
+ secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []), false), __read(additionalSecretKeys), false);
40166
40614
  secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
40167
40615
  return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
40168
40616
  }));
40169
- legacyFromComponents = (_m = (_l = mergedConfig.vars) === null || _l === void 0 ? void 0 : _l.fromComponents) !== null && _m !== void 0 ? _m : {};
40617
+ legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
40170
40618
  publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
40171
40619
  publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
40172
40620
  var _b = __read(_a, 2),
@@ -40178,50 +40626,65 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
40178
40626
  envVarsRaw = addIndexVar(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized));
40179
40627
  return [4
40180
40628
  /*yield*/
40181
- , (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (componentName, variableName, alreadyVisited) {
40629
+ , (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (otherComponentName, variableName, alreadyVisited) {
40182
40630
  return __awaiter(void 0, void 0, void 0, function () {
40183
- var envVars;
40631
+ var otherEnvVars;
40184
40632
  return __generator(this, function (_a) {
40185
40633
  switch (_a.label) {
40186
40634
  case 0:
40187
40635
  return [4
40188
40636
  /*yield*/
40189
- , (0, exports.getEnvironment)(config, componentName, env, commitInfo, alreadyVisited)];
40637
+ , (0, exports.getEnvironmentVariables)(config, otherComponentName, env, commitInfo, alreadyVisited)];
40190
40638
 
40191
40639
  case 1:
40192
- envVars = _a.sent().envVars;
40640
+ otherEnvVars = _a.sent().envVars;
40193
40641
  return [2
40194
40642
  /*return*/
40195
- , envVars[variableName]];
40643
+ , otherEnvVars[variableName]];
40196
40644
  }
40197
40645
  });
40198
40646
  });
40199
40647
  }, alreadyVisited)];
40200
40648
 
40201
40649
  case 1:
40202
- envVars = _o.sent();
40650
+ envVars = _k.sent();
40203
40651
  return [2
40204
40652
  /*return*/
40205
40653
  , {
40206
- envType: envType,
40207
- host: host,
40208
- url: url,
40209
- gitlabEnvironment: {
40210
- name: gitlabEnvironmentName,
40211
- url: url
40212
- },
40213
- fullName: fullName,
40214
- slug: environmentSlug,
40215
- shortName: env,
40216
40654
  envVars: envVars,
40217
- secretEnvVarKeys: secretEnvVarKeys
40655
+ secretEnvVarKeys: secretEnvVarKeys,
40656
+ host: host,
40657
+ url: url
40218
40658
  }];
40219
40659
  }
40220
40660
  });
40221
40661
  });
40222
40662
  };
40223
40663
 
40224
- exports.getEnvironment = getEnvironment;
40664
+ exports.getEnvironmentVariables = getEnvironmentVariables;
40665
+
40666
+ var sanitizeForEnVar = function (s) {
40667
+ return s.replace(/-/g, "_");
40668
+ };
40669
+
40670
+ var getSecretVarName = function (env, componentName, key) {
40671
+ return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
40672
+ }; // remove dash from component name
40673
+
40674
+
40675
+ exports.getSecretVarName = getSecretVarName;
40676
+
40677
+ var addIndexVar = function (vars) {
40678
+ return __assign(__assign({}, vars), {
40679
+ _ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars))
40680
+ });
40681
+ };
40682
+
40683
+ var getSecretVarNameForContext = function (context, key) {
40684
+ return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
40685
+ };
40686
+
40687
+ exports.getSecretVarNameForContext = getSecretVarNameForContext;
40225
40688
 
40226
40689
  /***/ }),
40227
40690
 
@@ -40456,34 +40919,30 @@ var utils_1 = __nccwpck_require__(7461);
40456
40919
 
40457
40920
  var getEnvironment_1 = __nccwpck_require__(740);
40458
40921
 
40922
+ var getEnvironmentContext_1 = __nccwpck_require__(4650);
40923
+
40459
40924
  __exportStar(__nccwpck_require__(740), exports);
40460
40925
 
40926
+ __exportStar(__nccwpck_require__(6602), exports);
40927
+
40461
40928
  var createContext = function (config, componentName, env, commitInfo, packageManagerInfo) {
40462
40929
  return __awaiter(void 0, void 0, void 0, function () {
40463
- var rawConfig, envConfig, componentConfigWithoutDefaults, defaults, componentConfig;
40930
+ var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
40464
40931
 
40465
40932
  var _a;
40466
40933
 
40467
- var _b, _c;
40468
-
40469
- return __generator(this, function (_d) {
40470
- switch (_d.label) {
40934
+ return __generator(this, function (_b) {
40935
+ switch (_b.label) {
40471
40936
  case 0:
40472
40937
  if (!/^[a-z0-9-]+$/.test(componentName)) {
40473
40938
  throw new Error("componentName may only contain lower case letters, numbers and -");
40474
40939
  }
40475
40940
 
40476
- rawConfig = config.components[componentName];
40477
-
40478
- if (!rawConfig) {
40479
- throw new Error("unknown component " + componentName);
40480
- }
40481
-
40482
- envConfig = (_c = (_b = rawConfig.env) === null || _b === void 0 ? void 0 : _b[env]) !== null && _c !== void 0 ? _c : {};
40483
- componentConfigWithoutDefaults = (0, utils_1.mergeWithMergingArrays)(rawConfig, envConfig);
40941
+ envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
40942
+ componentConfigWithoutDefaults = envContext.envConfigRaw;
40484
40943
  defaults = componentConfigWithoutDefaults.deploy ? {
40485
- build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(),
40486
- deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults()
40944
+ build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
40945
+ deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext)
40487
40946
  } : {
40488
40947
  build: {},
40489
40948
  deploy: {}
@@ -40501,7 +40960,7 @@ var createContext = function (config, componentName, env, commitInfo, packageMan
40501
40960
  case 1:
40502
40961
  return [2
40503
40962
  /*return*/
40504
- , (_a.environment = _d.sent(), _a.commitInfo = commitInfo, _a.packageManagerInfo = packageManagerInfo, _a)];
40963
+ , (_a.environment = _b.sent(), _a.commitInfo = commitInfo, _a.packageManagerInfo = packageManagerInfo, _a)];
40505
40964
  }
40506
40965
  });
40507
40966
  });
@@ -41040,115 +41499,392 @@ var __read = this && this.__read || function (o, n) {
41040
41499
  return ar;
41041
41500
  };
41042
41501
 
41043
- var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
41044
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
41045
- if (ar || !(i in from)) {
41046
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
41047
- ar[i] = from[i];
41048
- }
41049
- }
41050
- return to.concat(ar || Array.prototype.slice.call(from));
41051
- };
41052
-
41502
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
41503
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
41504
+ if (ar || !(i in from)) {
41505
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
41506
+ ar[i] = from[i];
41507
+ }
41508
+ }
41509
+ return to.concat(ar || Array.prototype.slice.call(from));
41510
+ };
41511
+
41512
+ exports.__esModule = true;
41513
+ exports.createGoogleCloudRunDeployJobs = void 0;
41514
+
41515
+ var js_yaml_1 = __nccwpck_require__(3618);
41516
+
41517
+ var lodash_1 = __nccwpck_require__(3255);
41518
+
41519
+ var _1 = __nccwpck_require__(1344);
41520
+
41521
+ var docker_1 = __nccwpck_require__(3219);
41522
+
41523
+ var getLabels_1 = __nccwpck_require__(486);
41524
+
41525
+ var runner_1 = __nccwpck_require__(5071);
41526
+
41527
+ var base_1 = __nccwpck_require__(9177);
41528
+
41529
+ var types_1 = __nccwpck_require__(3109);
41530
+
41531
+ var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(2607);
41532
+
41533
+ var database_1 = __nccwpck_require__(1384);
41534
+
41535
+ var gitlab_1 = __nccwpck_require__(4997);
41536
+
41537
+ var createGoogleCloudRunDeployJobs = function (context) {
41538
+ var _a;
41539
+
41540
+ var deployConfig = context.componentConfig.deploy;
41541
+
41542
+ if (deployConfig === false) {
41543
+ return [];
41544
+ }
41545
+
41546
+ if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
41547
+ // should not happen
41548
+ throw new Error("deploy config is wrong");
41549
+ }
41550
+
41551
+ var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
41552
+ var fullAppName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
41553
+ var dockerUrl = "".concat(deployConfig.region, "-docker.pkg.dev/").concat(deployConfig.projectId, "/catladder-deploy/").concat(fullAppName);
41554
+ var gcloudImageName = "".concat(dockerUrl, "/$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG");
41555
+
41556
+ var pushImageToArtifactsRegistry = __spreadArray(__spreadArray([docker_1.gitlabDockerLogin], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud auth configure-docker ".concat(deployConfig.region, "-docker.pkg.dev"), "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG ".concat(gcloudImageName), "docker push ".concat(gcloudImageName)], false);
41557
+
41558
+ var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, _1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
41559
+ var labelsString = Object.entries((0, getLabels_1.getLabels)(context)).map(function (_a) {
41560
+ var _b = __read(_a, 2),
41561
+ key = _b[0],
41562
+ value = _b[1];
41563
+
41564
+ return "".concat(key, "=").concat(value);
41565
+ }).join(",");
41566
+ var commonArgs = "--project ".concat(deployConfig.projectId, " --region=").concat(deployConfig.region);
41567
+ var cloudRunArgs = deployConfig.cloudSql ? "--set-cloudsql-instances=".concat(deployConfig.cloudSql.instanceConnectionName) : "";
41568
+ var commonDeployArgs = "--image ".concat(gcloudImageName, " ").concat(commonArgs, " ").concat(cloudRunArgs, " --labels ").concat(labelsString);
41569
+ var serviceName = context.environment.fullName.toLowerCase();
41570
+
41571
+ var getServiceDeployScript = function (service) {
41572
+ var _a;
41573
+
41574
+ var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
41575
+ var commandArg = command ? "--command=\"".concat(command.split(" ").join(","), "\"") : "";
41576
+ return "gcloud run deploy ".concat(serviceName, " ").concat(commandArg, " ").concat(commonDeployArgs, " --env-vars-file=____envvars.yaml --allow-unauthenticated");
41577
+ };
41578
+
41579
+ var getJobCreateScripts = function (jobName, job) {
41580
+ // due to some oversight from google, jobs create does not accept `--env-vars-file` 🤦
41581
+ // lucky, update on the other hand accepts it... so let's just imediatly update it
41582
+ // also we cannot upsert a job, so we have to create it and catch the error and then update
41583
+ var args = "".concat(jobName, " --command=\"").concat(job.command.split(" ").join(","), "\" ").concat(commonDeployArgs, " --memory=").concat(job.memory || "512Mi");
41584
+ return __spreadArray(__spreadArray([], __read((0, gitlab_1.allowFailureInScripts)(["gcloud beta run jobs create ".concat(args)])), false), ["gcloud beta run jobs update ".concat(args, " --env-vars-file=____envvars.yaml")], false);
41585
+ };
41586
+
41587
+ var getJobRunScript = function (jobName) {
41588
+ return "gcloud beta run jobs execute ".concat(jobName, " ").concat(commonArgs);
41589
+ };
41590
+
41591
+ var getFullJobName = function (name) {
41592
+ return context.environment.fullName.toLowerCase() + "-" + name.toLowerCase();
41593
+ };
41594
+
41595
+ var jobsWithNames = Object.entries((_a = deployConfig.jobs) !== null && _a !== void 0 ? _a : {}) // filter out disabled jobs
41596
+ .filter(function (entry) {
41597
+ return Boolean(entry[1]);
41598
+ }).map(function (_a) {
41599
+ var _b = __read(_a, 2),
41600
+ name = _b[0],
41601
+ job = _b[1];
41602
+
41603
+ return [getFullJobName(name), job];
41604
+ });
41605
+
41606
+ var cloudRunDeployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(["echo \"$ENV_VARS\" > ____envvars.yaml"], __read(deployConfig.cloudSql ? (0, database_1.getDatabaseCreateScript)(context, deployConfig) // we create the db, so that we can also delete it afterwards
41607
+ : []), false), __read(jobsWithNames.map(function (_a) {
41608
+ var _b = __read(_a, 2),
41609
+ name = _b[0],
41610
+ job = _b[1];
41611
+
41612
+ return getJobCreateScripts(name, job);
41613
+ }).flat()), false), __read(jobsWithNames.filter(function (_a) {
41614
+ var _b = __read(_a, 2),
41615
+ job = _b[1];
41616
+
41617
+ return job.when === "preDeploy";
41618
+ }).map(function (_a) {
41619
+ var _b = __read(_a, 1),
41620
+ name = _b[0];
41621
+
41622
+ return getJobRunScript(name);
41623
+ })), false), __read(deployConfig.service !== false ? [getServiceDeployScript(deployConfig.service)] : []), false), __read(jobsWithNames.filter(function (_a) {
41624
+ var _b = __read(_a, 2),
41625
+ job = _b[1];
41626
+
41627
+ return job.when === "postDeploy";
41628
+ }).map(function (_a) {
41629
+ var _b = __read(_a, 1),
41630
+ name = _b[0];
41631
+
41632
+ return getJobRunScript(name);
41633
+ })), false), ["docker image rm ".concat(gcloudImageName)], false);
41634
+
41635
+ var cloudRunStopScripts = __spreadArray(__spreadArray(__spreadArray([], __read(deployConfig.service !== false ? ["gcloud run services delete ".concat(serviceName, " ").concat(commonArgs)] : []), false), __read(jobsWithNames.map(function (_a) {
41636
+ var _b = __read(_a, 1),
41637
+ name = _b[0];
41638
+
41639
+ return "gcloud beta run jobs delete ".concat(name, " ").concat(commonArgs);
41640
+ })), false), __read(deployConfig.cloudSql && deployConfig.cloudSql.deleteDatabaseOnStop ? (0, database_1.getDatabaseDeleteScript)(context, deployConfig) : []), false);
41641
+
41642
+ var baseStopJob = (0, base_1.getBaseDeploymentStopJob)(context);
41643
+ return [(0, lodash_1.merge)({}, baseDeploymentJob, (0, docker_1.getDockerJobBaseProps)(context), {
41644
+ artifacts: {
41645
+ paths: ["____envvars.yaml"]
41646
+ },
41647
+ variables: {
41648
+ CLOUDSDK_CORE_DISABLE_PROMPTS: "1",
41649
+ ENV_VARS: (0, js_yaml_1.dump)(allEnvVars, {
41650
+ lineWidth: -1,
41651
+ quotingType: "'",
41652
+ forceQuotes: true
41653
+ })
41654
+ },
41655
+ image: (0, runner_1.getRunnerImage)("gcloud"),
41656
+ script: __spreadArray(__spreadArray([], __read(pushImageToArtifactsRegistry), false), __read(cloudRunDeployScripts), false)
41657
+ }), (0, lodash_1.merge)({}, baseStopJob, {
41658
+ image: (0, runner_1.getRunnerImage)("gcloud"),
41659
+ variables: {
41660
+ CLOUDSDK_CORE_DISABLE_PROMPTS: "1"
41661
+ },
41662
+ script: __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(cloudRunStopScripts), false)
41663
+ })];
41664
+ };
41665
+
41666
+ exports.createGoogleCloudRunDeployJobs = createGoogleCloudRunDeployJobs;
41667
+
41668
+ /***/ }),
41669
+
41670
+ /***/ 1344:
41671
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
41672
+
41673
+ "use strict";
41674
+
41675
+
41676
+ var __assign = this && this.__assign || function () {
41677
+ __assign = Object.assign || function (t) {
41678
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
41679
+ s = arguments[i];
41680
+
41681
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41682
+ }
41683
+
41684
+ return t;
41685
+ };
41686
+
41687
+ return __assign.apply(this, arguments);
41688
+ };
41689
+
41690
+ var __read = this && this.__read || function (o, n) {
41691
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
41692
+ if (!m) return o;
41693
+ var i = m.call(o),
41694
+ r,
41695
+ ar = [],
41696
+ e;
41697
+
41698
+ try {
41699
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
41700
+ } catch (error) {
41701
+ e = {
41702
+ error: error
41703
+ };
41704
+ } finally {
41705
+ try {
41706
+ if (r && !r.done && (m = i["return"])) m.call(i);
41707
+ } finally {
41708
+ if (e) throw e.error;
41709
+ }
41710
+ }
41711
+
41712
+ return ar;
41713
+ };
41714
+
41715
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
41716
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
41717
+ if (ar || !(i in from)) {
41718
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
41719
+ ar[i] = from[i];
41720
+ }
41721
+ }
41722
+ return to.concat(ar || Array.prototype.slice.call(from));
41723
+ };
41724
+
41725
+ exports.__esModule = true;
41726
+ exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
41727
+
41728
+ var context_1 = __nccwpck_require__(2041);
41729
+
41730
+ var gitlab_1 = __nccwpck_require__(4997);
41731
+
41732
+ var deployJob_1 = __nccwpck_require__(2256);
41733
+
41734
+ exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
41735
+ exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
41736
+
41737
+ var getCloudSqlVariables = function (_a) {
41738
+ var _b;
41739
+
41740
+ var deployConfigRaw = _a.deployConfigRaw,
41741
+ environmentSlug = _a.environmentSlug,
41742
+ env = _a.env,
41743
+ componentName = _a.componentName,
41744
+ fullConfig = _a.fullConfig;
41745
+
41746
+ if (deployConfigRaw && deployConfigRaw.cloudSql) {
41747
+ var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlug].filter(Boolean).join("-");
41748
+ return {
41749
+ CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
41750
+ DB_NAME: DB_NAME,
41751
+ DB_USER: "postgres",
41752
+ DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
41753
+ DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME",
41754
+ 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"
41755
+ };
41756
+ }
41757
+
41758
+ return {};
41759
+ };
41760
+
41761
+ exports.GCLOUD_RUN_DEPLOY_TYPE = {
41762
+ jobs: deployJob_1.createGoogleCloudRunDeployJobs,
41763
+ defaults: function (_a) {
41764
+ var deployConfigRaw = _a.deployConfigRaw,
41765
+ envType = _a.envType;
41766
+
41767
+ if (deployConfigRaw && deployConfigRaw.cloudSql) {
41768
+ return {
41769
+ cloudSql: {
41770
+ deleteDatabaseOnStop: envType === "review"
41771
+ }
41772
+ };
41773
+ }
41774
+
41775
+ return {};
41776
+ },
41777
+ additionalSecretKeys: function (ctx) {
41778
+ return __spreadArray([exports.GCLOUD_DEPLOY_CREDENTIALS_KEY], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? ["DB_PASSWORD"] : []), false);
41779
+ },
41780
+ getAdditionalEnvVars: function (ctx) {
41781
+ var fullName = ctx.fullName,
41782
+ env = ctx.env,
41783
+ componentName = ctx.componentName,
41784
+ deployConfigRaw = ctx.deployConfigRaw;
41785
+ var HOST_CANONICAL = fullName.toLowerCase() + "-" + process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)];
41786
+ var jobTriggers = deployConfigRaw && deployConfigRaw.jobs ? Object.fromEntries(Object.entries(deployConfigRaw.jobs).map(function (_a) {
41787
+ var _b = __read(_a, 2),
41788
+ name = _b[0],
41789
+ job = _b[1];
41790
+
41791
+ return ["CLOUD_RUN_JOB_TRIGGER_URL_" + (0, gitlab_1.sanitizeForBashVariable)(name), "https://".concat(deployConfigRaw.region, "-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/").concat(deployConfigRaw.projectId, "/jobs/").concat(name, ":run")];
41792
+ })) : {};
41793
+ return __assign(__assign({
41794
+ HOST_CANONICAL: HOST_CANONICAL
41795
+ }, getCloudSqlVariables(ctx)), jobTriggers);
41796
+ }
41797
+ };
41798
+
41799
+ /***/ }),
41800
+
41801
+ /***/ 1384:
41802
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
41803
+
41804
+ "use strict";
41805
+
41806
+
41807
+ var __read = this && this.__read || function (o, n) {
41808
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
41809
+ if (!m) return o;
41810
+ var i = m.call(o),
41811
+ r,
41812
+ ar = [],
41813
+ e;
41814
+
41815
+ try {
41816
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
41817
+ } catch (error) {
41818
+ e = {
41819
+ error: error
41820
+ };
41821
+ } finally {
41822
+ try {
41823
+ if (r && !r.done && (m = i["return"])) m.call(i);
41824
+ } finally {
41825
+ if (e) throw e.error;
41826
+ }
41827
+ }
41828
+
41829
+ return ar;
41830
+ };
41831
+
41053
41832
  exports.__esModule = true;
41054
- exports.createDeployJob = void 0;
41055
-
41056
- var js_yaml_1 = __nccwpck_require__(3618);
41057
-
41058
- var lodash_1 = __nccwpck_require__(3255);
41059
-
41060
- var _1 = __nccwpck_require__(1344);
41061
-
41062
- var docker_1 = __nccwpck_require__(3219);
41833
+ exports.getDatabaseCreateScript = exports.getDatabaseDeleteScript = void 0;
41063
41834
 
41064
- var getLabels_1 = __nccwpck_require__(486);
41835
+ var gitlab_1 = __nccwpck_require__(4997);
41065
41836
 
41066
- var runner_1 = __nccwpck_require__(5071);
41067
-
41068
- var base_1 = __nccwpck_require__(9177);
41069
-
41070
- var types_1 = __nccwpck_require__(3109);
41071
-
41072
- var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(2607);
41073
-
41074
- var createDeployJob = function (context) {
41075
- var deployConfig = context.componentConfig.deploy;
41076
-
41077
- if (deployConfig === false) {
41078
- return [];
41079
- }
41837
+ var getDatabaseDeleteScript = function (context, deployConfig) {
41838
+ var _a;
41080
41839
 
41081
- if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
41082
- // should not happen
41083
- throw new Error("deploy config is not custom");
41840
+ if (!deployConfig.cloudSql || !deployConfig.cloudSql.deleteDatabaseOnStop) {
41841
+ throw new Error("not possible");
41084
41842
  }
41085
41843
 
41086
- var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
41087
- var fullAppName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
41088
- var dockerUrl = "".concat(deployConfig.region, "-docker.pkg.dev/").concat(deployConfig.projectId, "/catladder-deploy/").concat(fullAppName);
41089
- var gcloudImageName = "".concat(dockerUrl, "/$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG");
41844
+ var DB_NAME = ((_a = context.environment.envVars) !== null && _a !== void 0 ? _a : {}).DB_NAME;
41090
41845
 
41091
- var pushImageToArtifactsRegistry = __spreadArray(__spreadArray([docker_1.gitlabDockerLogin], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud auth configure-docker ".concat(deployConfig.region, "-docker.pkg.dev"), "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG ".concat(gcloudImageName), "docker push ".concat(gcloudImageName)], false);
41846
+ if (!DB_NAME) {
41847
+ throw new Error("error: env vars did not specify DB_NAME");
41848
+ }
41092
41849
 
41093
- var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, _1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
41094
- var serviceName = context.environment.fullName.toLowerCase();
41095
- var labelsString = Object.entries((0, getLabels_1.getLabels)(context)).map(function (_a) {
41096
- var _b = __read(_a, 2),
41097
- key = _b[0],
41098
- value = _b[1];
41850
+ var _b = __read(deployConfig.cloudSql.instanceConnectionName.split(":"), 3),
41851
+ projectId = _b[0],
41852
+ region = _b[1],
41853
+ instanceId = _b[2]; // unfortunatly the database cannot be deleted right after the service has stopped, as it might still have connections
41854
+ // we have to repeate this process
41099
41855
 
41100
- return "".concat(key, "=").concat(value);
41101
- }).join(",");
41102
- var command = context.componentConfig.build.startCommand ? "--command=\"".concat(context.componentConfig.build.startCommand.split(" ").join(","), "\"") : ""; // TODO: split secrets out
41103
41856
 
41104
- var cloudRunDeploy = ["echo \"$ENV_VARS\" > ____envvars.yaml", "gcloud run deploy ".concat(serviceName, " --image ").concat(gcloudImageName, " --region=").concat(deployConfig.region, " --allow-unauthenticated --project ").concat(deployConfig.projectId, " ").concat(command, " --env-vars-file=____envvars.yaml --labels ").concat(labelsString), "docker image rm ".concat(gcloudImageName)];
41105
- var baseStopJob = (0, base_1.getBaseDeploymentStopJob)(context);
41106
- return [(0, lodash_1.merge)({}, baseDeploymentJob, (0, docker_1.getDockerJobBaseProps)(context), {
41107
- artifacts: {
41108
- paths: ["____envvars.yaml"]
41109
- },
41110
- variables: {
41111
- ENV_VARS: (0, js_yaml_1.dump)(allEnvVars, {
41112
- lineWidth: -1,
41113
- quotingType: "'",
41114
- forceQuotes: true
41115
- })
41116
- },
41117
- image: (0, runner_1.getRunnerImage)("gcloud"),
41118
- script: __spreadArray(__spreadArray([], __read(pushImageToArtifactsRegistry), false), __read(cloudRunDeploy), false)
41119
- }), (0, lodash_1.merge)({}, baseStopJob, {
41120
- image: (0, runner_1.getRunnerImage)("gcloud"),
41121
- script: __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud run services delete ".concat(serviceName, " --project ").concat(deployConfig.projectId, " --region=").concat(deployConfig.region, " --quiet")], false)
41857
+ return ["echo \"deleting database ".concat(DB_NAME, "...\""), "echo \"\uD83D\uDC46 this can take multiple attemps (3-5min), because google cloud run may still have a connection to the database after the cloud run service is shut down\"", (0, gitlab_1.repeatOnFailure)("gcloud sql databases delete ".concat(DB_NAME, " --instance=").concat(instanceId, " --project ").concat(projectId), {
41858
+ pauseInSeconds: 10
41122
41859
  })];
41123
41860
  };
41124
41861
 
41125
- exports.createDeployJob = createDeployJob;
41862
+ exports.getDatabaseDeleteScript = getDatabaseDeleteScript;
41126
41863
 
41127
- /***/ }),
41864
+ var getDatabaseCreateScript = function (context, deployConfig) {
41865
+ var _a;
41128
41866
 
41129
- /***/ 1344:
41130
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
41867
+ if (!deployConfig.cloudSql) {
41868
+ throw new Error("not possible");
41869
+ }
41131
41870
 
41132
- "use strict";
41871
+ var DB_NAME = ((_a = context.environment.envVars) !== null && _a !== void 0 ? _a : {}).DB_NAME;
41133
41872
 
41873
+ if (!DB_NAME) {
41874
+ throw new Error("error: env vars did not specify DB_NAME");
41875
+ }
41134
41876
 
41135
- exports.__esModule = true;
41136
- exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
41877
+ var _b = __read(deployConfig.cloudSql.instanceConnectionName.split(":"), 3),
41878
+ projectId = _b[0],
41879
+ region = _b[1],
41880
+ instanceId = _b[2]; // may fail if it already exists
41137
41881
 
41138
- var deployJob_1 = __nccwpck_require__(2256);
41139
41882
 
41140
- exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
41141
- exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
41142
- exports.GCLOUD_RUN_DEPLOY_TYPE = {
41143
- jobs: deployJob_1.createDeployJob,
41144
- defaults: function () {
41145
- return {};
41146
- },
41147
- additionalSecretKeys: function () {
41148
- return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
41149
- }
41883
+ return (0, gitlab_1.allowFailureInScripts)(["echo \"ensuring Database...\"", "gcloud sql databases create ".concat(DB_NAME, " --instance=").concat(instanceId, " --project ").concat(projectId)]);
41150
41884
  };
41151
41885
 
41886
+ exports.getDatabaseCreateScript = getDatabaseCreateScript;
41887
+
41152
41888
  /***/ }),
41153
41889
 
41154
41890
  /***/ 2607:
@@ -41172,43 +41908,6 @@ exports.gcloudServiceAccountLoginCommands = gcloudServiceAccountLoginCommands;
41172
41908
 
41173
41909
  /***/ }),
41174
41910
 
41175
- /***/ 3539:
41176
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
41177
-
41178
- "use strict";
41179
-
41180
-
41181
- exports.__esModule = true;
41182
- exports.getCloudSQLConfig = exports.hasCloudSQL = void 0;
41183
-
41184
- var types_1 = __nccwpck_require__(3109);
41185
-
41186
- var hasCloudSQL = function (context) {
41187
- var _a, _b;
41188
-
41189
- if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
41190
- return (_b = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql) === null || _b === void 0 ? void 0 : _b.enabled;
41191
- }
41192
-
41193
- return false;
41194
- };
41195
-
41196
- exports.hasCloudSQL = hasCloudSQL;
41197
-
41198
- var getCloudSQLConfig = function (context) {
41199
- var _a;
41200
-
41201
- if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
41202
- return (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
41203
- }
41204
-
41205
- throw new Error("cannot get cloud sql config");
41206
- };
41207
-
41208
- exports.getCloudSQLConfig = getCloudSQLConfig;
41209
-
41210
- /***/ }),
41211
-
41212
41911
  /***/ 6531:
41213
41912
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
41214
41913
 
@@ -41302,6 +42001,9 @@ exports.CUSTOM_DEPLOY_TYPE = {
41302
42001
  },
41303
42002
  additionalSecretKeys: function () {
41304
42003
  return [];
42004
+ },
42005
+ getAdditionalEnvVars: function () {
42006
+ return {};
41305
42007
  }
41306
42008
  };
41307
42009
 
@@ -41365,6 +42067,9 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
41365
42067
  },
41366
42068
  additionalSecretKeys: function () {
41367
42069
  return [];
42070
+ },
42071
+ getAdditionalEnvVars: function () {
42072
+ return {};
41368
42073
  }
41369
42074
  };
41370
42075
 
@@ -41404,21 +42109,19 @@ var dockerTag_1 = __nccwpck_require__(8990);
41404
42109
 
41405
42110
  var kubernetes_1 = __nccwpck_require__(5682);
41406
42111
 
42112
+ __exportStar(__nccwpck_require__(1344), exports);
42113
+
41407
42114
  __exportStar(__nccwpck_require__(5682), exports);
41408
42115
 
41409
42116
  __exportStar(__nccwpck_require__(3109), exports);
41410
42117
 
41411
42118
  __exportStar(__nccwpck_require__(2757), exports);
41412
42119
 
41413
- __exportStar(__nccwpck_require__(3539), exports);
41414
-
41415
- __exportStar(__nccwpck_require__(1344), exports);
41416
-
41417
42120
  exports.DEPLOY_TYPES = {
41418
42121
  kubernetes: kubernetes_1.KUBERNETES_DEPLOY_TYPE,
41419
42122
  custom: custom_1.CUSTOM_DEPLOY_TYPE,
41420
- "google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE,
41421
- dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE
42123
+ dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE,
42124
+ "google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE
41422
42125
  };
41423
42126
 
41424
42127
  /***/ }),
@@ -41432,20 +42135,26 @@ exports.DEPLOY_TYPES = {
41432
42135
  exports.__esModule = true;
41433
42136
  exports.additionalKubernetesSecretKeys = void 0;
41434
42137
 
41435
- var additionalKubernetesSecretKeys = function (config) {
41436
- var _a, _b, _c, _d;
42138
+ var additionalKubernetesSecretKeys = function (_a) {
42139
+ var _b, _c, _d, _e;
42140
+
42141
+ var deployConfigRaw = _a.deployConfigRaw;
42142
+
42143
+ if (!deployConfigRaw) {
42144
+ return [];
42145
+ }
41437
42146
 
41438
42147
  var keys = [];
41439
42148
 
41440
- if ((_b = (_a = config.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) {
42149
+ if ((_c = (_b = deployConfigRaw.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) {
41441
42150
  keys.push("MONGODB_ROOT_PASSWORD");
41442
42151
 
41443
- if (config.values.mongodb.architecture === "replicaset") {
42152
+ if (deployConfigRaw.values.mongodb.architecture === "replicaset") {
41444
42153
  keys.push("MONGODB_REPLICASET_KEY");
41445
42154
  }
41446
42155
  }
41447
42156
 
41448
- if ((_d = (_c = config.values) === null || _c === void 0 ? void 0 : _c.cloudsql) === null || _d === void 0 ? void 0 : _d.enabled) {
42157
+ if ((_e = (_d = deployConfigRaw.values) === null || _d === void 0 ? void 0 : _d.cloudsql) === null || _e === void 0 ? void 0 : _e.enabled) {
41449
42158
  keys.push("POSTGRESQL_PASSWORD");
41450
42159
  keys.push("cloudsqlProxyCredentials");
41451
42160
  }
@@ -41457,21 +42166,47 @@ exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
41457
42166
 
41458
42167
  /***/ }),
41459
42168
 
41460
- /***/ 395:
42169
+ /***/ 1925:
41461
42170
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
41462
42171
 
41463
42172
  "use strict";
41464
42173
 
41465
42174
 
41466
42175
  exports.__esModule = true;
41467
- exports.createCloudsqlBaseConfig = void 0;
42176
+ exports.createCloudsqlBaseConfig = exports.getKubernetesCloudSQLConfig = exports.hasKubernetesCloudSQL = void 0;
41468
42177
 
41469
- var __1 = __nccwpck_require__(5355);
42178
+ var context_1 = __nccwpck_require__(2041);
42179
+
42180
+ var types_1 = __nccwpck_require__(3109);
42181
+
42182
+ var hasKubernetesCloudSQL = function (context) {
42183
+ var _a, _b;
42184
+
42185
+ if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
42186
+ return (_b = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql) === null || _b === void 0 ? void 0 : _b.enabled;
42187
+ }
42188
+
42189
+ return false;
42190
+ };
42191
+
42192
+ exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
42193
+
42194
+ var getKubernetesCloudSQLConfig = function (context) {
42195
+ var _a;
42196
+
42197
+ if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
42198
+ return (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
42199
+ }
42200
+
42201
+ throw new Error("cannot get cloud sql config");
42202
+ };
42203
+
42204
+ exports.getKubernetesCloudSQLConfig = getKubernetesCloudSQLConfig;
41470
42205
 
41471
42206
  var createCloudsqlBaseConfig = function (context) {
41472
42207
  return {
41473
42208
  cloudsql: {
41474
- proxyCredentials: "$".concat((0, __1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"))
42209
+ proxyCredentials: "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"))
41475
42210
  }
41476
42211
  };
41477
42212
  };
@@ -41615,24 +42350,78 @@ exports.createKubernetesDeployJobs = createKubernetesDeployJobs;
41615
42350
  /***/ }),
41616
42351
 
41617
42352
  /***/ 5682:
41618
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
42353
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
41619
42354
 
41620
42355
  "use strict";
41621
42356
 
41622
42357
 
42358
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
42359
+ if (k2 === undefined) k2 = k;
42360
+ Object.defineProperty(o, k2, {
42361
+ enumerable: true,
42362
+ get: function () {
42363
+ return m[k];
42364
+ }
42365
+ });
42366
+ } : function (o, m, k, k2) {
42367
+ if (k2 === undefined) k2 = k;
42368
+ o[k2] = m[k];
42369
+ });
42370
+
42371
+ var __exportStar = this && this.__exportStar || function (m, exports) {
42372
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
42373
+ };
42374
+
42375
+ var __importDefault = this && this.__importDefault || function (mod) {
42376
+ return mod && mod.__esModule ? mod : {
42377
+ "default": mod
42378
+ };
42379
+ };
42380
+
41623
42381
  exports.__esModule = true;
41624
42382
  exports.KUBERNETES_DEPLOY_TYPE = void 0;
41625
42383
 
42384
+ var slugify_1 = __importDefault(__nccwpck_require__(4035));
42385
+
42386
+ var __1 = __nccwpck_require__(223);
42387
+
41626
42388
  var additionalSecretKeys_1 = __nccwpck_require__(5775);
41627
42389
 
41628
42390
  var deployJob_1 = __nccwpck_require__(9792);
41629
42391
 
42392
+ __exportStar(__nccwpck_require__(1925), exports);
42393
+
41630
42394
  exports.KUBERNETES_DEPLOY_TYPE = {
41631
42395
  jobs: deployJob_1.createKubernetesDeployJobs,
41632
42396
  defaults: function () {
41633
42397
  return {};
41634
42398
  },
41635
- additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys
42399
+ additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys,
42400
+ getAdditionalEnvVars: function (_a) {
42401
+ var _b;
42402
+
42403
+ var componentName = _a.componentName,
42404
+ fullConfig = _a.fullConfig,
42405
+ deployConfigRaw = _a.deployConfigRaw,
42406
+ env = _a.env,
42407
+ envType = _a.envType,
42408
+ commitInfo = _a.commitInfo;
42409
+ var KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
42410
+ var KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
42411
+ var KUBE_NAMESPACE = (0, __1.getKubernetesNamespace)(fullConfig, env);
42412
+ var componentSlug = (0, slugify_1["default"])(componentName);
42413
+ var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
42414
+ var domainCanonical = deployConfigRaw && ((_b = deployConfigRaw.cluster) === null || _b === void 0 ? void 0 : _b.domainCanonical) || // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
42415
+ fullConfig.domainCanonical || "panter.cloud";
42416
+ var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
42417
+
42418
+ return {
42419
+ KUBE_NAMESPACE: KUBE_NAMESPACE,
42420
+ KUBE_APP_NAME: KUBE_APP_NAME,
42421
+ KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
42422
+ HOST_CANONICAL: HOST_CANONICAL
42423
+ };
42424
+ }
41636
42425
  };
41637
42426
 
41638
42427
  /***/ }),
@@ -41758,11 +42547,9 @@ var lodash_1 = __nccwpck_require__(3255);
41758
42547
 
41759
42548
  var utils_1 = __nccwpck_require__(7461);
41760
42549
 
41761
- var cloudSql_1 = __nccwpck_require__(3539);
41762
-
41763
42550
  var types_1 = __nccwpck_require__(3109);
41764
42551
 
41765
- var cloudsql_1 = __nccwpck_require__(395);
42552
+ var cloudSql_1 = __nccwpck_require__(1925);
41766
42553
 
41767
42554
  var kubeEnv_1 = __nccwpck_require__(9449);
41768
42555
 
@@ -41828,7 +42615,7 @@ var createKubeValues = function (context) {
41828
42615
  var defaultKubeValues = (0, lodash_1.merge)({
41829
42616
  env: env,
41830
42617
  application: createAppConfig(context, application)
41831
- }, (0, cloudSql_1.hasCloudSQL)(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) : {});
42618
+ }, (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) : {});
41832
42619
  var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, rest));
41833
42620
  return kubeValues;
41834
42621
  };
@@ -42201,57 +42988,6 @@ __exportStar(__nccwpck_require__(223), exports);
42201
42988
 
42202
42989
  /***/ }),
42203
42990
 
42204
- /***/ 9572:
42205
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
42206
-
42207
- "use strict";
42208
-
42209
-
42210
- exports.__esModule = true;
42211
- exports.createInventoryReporitngJob = exports.INVENTORY_ARTIFACTS_DIR_DEPENDENCIES = exports.INVENTORY_ARTIFACTS_DIR = void 0;
42212
-
42213
- var lodash_1 = __nccwpck_require__(3255);
42214
-
42215
- var path_1 = __nccwpck_require__(1017);
42216
-
42217
- exports.INVENTORY_ARTIFACTS_DIR = "__cl__reporting";
42218
- exports.INVENTORY_ARTIFACTS_DIR_DEPENDENCIES = (0, path_1.join)(exports.INVENTORY_ARTIFACTS_DIR, "dependencies");
42219
-
42220
- var createInventoryReporitngJob = function (context) {
42221
- var inventoryTemplate = {
42222
- repository: {
42223
- projectId: process.env.CI_PROJECT_ID,
42224
- url: process.env.CI_PROJECT_URL
42225
- },
42226
- appName: context.fullConfig.appName,
42227
- customerName: context.fullConfig.customerName,
42228
- componentName: context.componentName,
42229
- environment: (0, lodash_1.pick)(context.environment, ["shortName", "fullName", "host", "url"]),
42230
- build: context.componentConfig.build,
42231
- deploy: context.componentConfig.deploy,
42232
- packageManager: context.packageManagerInfo
42233
- };
42234
- var printReportComand = "echo '".concat(JSON.stringify(inventoryTemplate), "' | jq --argjson dependencies \"$(cat ").concat(exports.INVENTORY_ARTIFACTS_DIR_DEPENDENCIES, "/* | jq -n '. |= [inputs]')\" '. + {dependencies: $dependencies}'");
42235
- return {
42236
- envMode: "jobPerEnv",
42237
- name: "inventory:reporting",
42238
- stage: "reporting",
42239
- variables: {},
42240
- script: ["cd ".concat(context.componentConfig.dir), printReportComand],
42241
- needsStages: [{
42242
- stage: "build",
42243
- artifacts: true
42244
- }, {
42245
- stage: "deploy",
42246
- artifacts: true
42247
- }]
42248
- };
42249
- };
42250
-
42251
- exports.createInventoryReporitngJob = createInventoryReporitngJob;
42252
-
42253
- /***/ }),
42254
-
42255
42991
  /***/ 8974:
42256
42992
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
42257
42993
 
@@ -42754,8 +43490,6 @@ var context_1 = __nccwpck_require__(2041);
42754
43490
 
42755
43491
  var deploy_1 = __nccwpck_require__(223);
42756
43492
 
42757
- var reportingJob_1 = __nccwpck_require__(9572);
42758
-
42759
43493
  var utils_1 = __nccwpck_require__(7461);
42760
43494
 
42761
43495
  var makeGitlabJob_1 = __nccwpck_require__(5715);
@@ -42792,8 +43526,7 @@ var createRawJobs = function (context) {
42792
43526
  var buildJobs = build_1.BUILD_TYPES[context.componentConfig.build.type].jobs(context);
42793
43527
  var deployJobs = deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context);
42794
43528
  var customJobs = getCustomJobs(context);
42795
- var reportInventoryJob = (0, reportingJob_1.createInventoryReporitngJob)(context);
42796
- return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false), [reportInventoryJob], false);
43529
+ return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
42797
43530
  };
42798
43531
 
42799
43532
  var getFullJobName = function (name, componentName, env) {
@@ -43616,7 +44349,7 @@ __exportStar(__nccwpck_require__(3146), exports);
43616
44349
 
43617
44350
  exports.__esModule = true;
43618
44351
  exports.BASE_STAGES = void 0;
43619
- exports.BASE_STAGES = ["setup", "test", "build", "deploy", "verify", "rollback", "stop", "reporting"];
44352
+ exports.BASE_STAGES = ["setup", "test", "build", "deploy", "verify", "rollback", "stop"];
43620
44353
 
43621
44354
  /***/ }),
43622
44355
 
@@ -43630,6 +44363,71 @@ exports.__esModule = true;
43630
44363
 
43631
44364
  /***/ }),
43632
44365
 
44366
+ /***/ 4997:
44367
+ /***/ (function(__unused_webpack_module, exports) {
44368
+
44369
+ "use strict";
44370
+
44371
+
44372
+ var __read = this && this.__read || function (o, n) {
44373
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
44374
+ if (!m) return o;
44375
+ var i = m.call(o),
44376
+ r,
44377
+ ar = [],
44378
+ e;
44379
+
44380
+ try {
44381
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44382
+ } catch (error) {
44383
+ e = {
44384
+ error: error
44385
+ };
44386
+ } finally {
44387
+ try {
44388
+ if (r && !r.done && (m = i["return"])) m.call(i);
44389
+ } finally {
44390
+ if (e) throw e.error;
44391
+ }
44392
+ }
44393
+
44394
+ return ar;
44395
+ };
44396
+
44397
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
44398
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
44399
+ if (ar || !(i in from)) {
44400
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
44401
+ ar[i] = from[i];
44402
+ }
44403
+ }
44404
+ return to.concat(ar || Array.prototype.slice.call(from));
44405
+ };
44406
+
44407
+ exports.__esModule = true;
44408
+ exports.repeatOnFailure = exports.sanitizeForBashVariable = exports.allowFailureInScripts = void 0;
44409
+
44410
+ var allowFailureInScripts = function (script) {
44411
+ return __spreadArray(__spreadArray(["set +e"], __read(script), false), ["set -e" // reenable
44412
+ ], false);
44413
+ };
44414
+
44415
+ exports.allowFailureInScripts = allowFailureInScripts;
44416
+
44417
+ var sanitizeForBashVariable = function (name) {
44418
+ return name.replace(/-/g, "_");
44419
+ };
44420
+
44421
+ exports.sanitizeForBashVariable = sanitizeForBashVariable;
44422
+
44423
+ var repeatOnFailure = function (command, options) {
44424
+ return "\n until ".concat(command, " &> /dev/null\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
44425
+ };
44426
+
44427
+ exports.repeatOnFailure = repeatOnFailure;
44428
+
44429
+ /***/ }),
44430
+
43633
44431
  /***/ 7461:
43634
44432
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43635
44433