@catladder/cli 0.0.0-inventory-2f61feef → 0.0.0-jdbc-064ed4e2

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 +1141 -346
  17. package/dist/bundles/cli/index.js +1468 -499
  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-064ed4e2" || 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,393 @@ 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
+ var hostAndDb = "localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME";
41749
+ return {
41750
+ CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
41751
+ DB_NAME: DB_NAME,
41752
+ DB_USER: "postgres",
41753
+ DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
41754
+ DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@".concat(hostAndDb),
41755
+ 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"
41756
+ };
41757
+ }
41758
+
41759
+ return {};
41760
+ };
41761
+
41762
+ exports.GCLOUD_RUN_DEPLOY_TYPE = {
41763
+ jobs: deployJob_1.createGoogleCloudRunDeployJobs,
41764
+ defaults: function (_a) {
41765
+ var deployConfigRaw = _a.deployConfigRaw,
41766
+ envType = _a.envType;
41767
+
41768
+ if (deployConfigRaw && deployConfigRaw.cloudSql) {
41769
+ return {
41770
+ cloudSql: {
41771
+ deleteDatabaseOnStop: envType === "review"
41772
+ }
41773
+ };
41774
+ }
41775
+
41776
+ return {};
41777
+ },
41778
+ additionalSecretKeys: function (ctx) {
41779
+ return __spreadArray([exports.GCLOUD_DEPLOY_CREDENTIALS_KEY], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? ["DB_PASSWORD"] : []), false);
41780
+ },
41781
+ getAdditionalEnvVars: function (ctx) {
41782
+ var fullName = ctx.fullName,
41783
+ env = ctx.env,
41784
+ componentName = ctx.componentName,
41785
+ deployConfigRaw = ctx.deployConfigRaw;
41786
+ var HOST_CANONICAL = fullName.toLowerCase() + "-" + process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)];
41787
+ var jobTriggers = deployConfigRaw && deployConfigRaw.jobs ? Object.fromEntries(Object.entries(deployConfigRaw.jobs).map(function (_a) {
41788
+ var _b = __read(_a, 2),
41789
+ name = _b[0],
41790
+ job = _b[1];
41791
+
41792
+ 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")];
41793
+ })) : {};
41794
+ return __assign(__assign({
41795
+ HOST_CANONICAL: HOST_CANONICAL
41796
+ }, getCloudSqlVariables(ctx)), jobTriggers);
41797
+ }
41798
+ };
41799
+
41800
+ /***/ }),
41801
+
41802
+ /***/ 1384:
41803
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
41804
+
41805
+ "use strict";
41806
+
41807
+
41808
+ var __read = this && this.__read || function (o, n) {
41809
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
41810
+ if (!m) return o;
41811
+ var i = m.call(o),
41812
+ r,
41813
+ ar = [],
41814
+ e;
41815
+
41816
+ try {
41817
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
41818
+ } catch (error) {
41819
+ e = {
41820
+ error: error
41821
+ };
41822
+ } finally {
41823
+ try {
41824
+ if (r && !r.done && (m = i["return"])) m.call(i);
41825
+ } finally {
41826
+ if (e) throw e.error;
41827
+ }
41828
+ }
41829
+
41830
+ return ar;
41831
+ };
41832
+
41053
41833
  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);
41834
+ exports.getDatabaseCreateScript = exports.getDatabaseDeleteScript = void 0;
41061
41835
 
41062
- var docker_1 = __nccwpck_require__(3219);
41836
+ var gitlab_1 = __nccwpck_require__(4997);
41063
41837
 
41064
- var getLabels_1 = __nccwpck_require__(486);
41065
-
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;
41838
+ var getDatabaseDeleteScript = function (context, deployConfig) {
41839
+ var _a;
41076
41840
 
41077
- if (deployConfig === false) {
41078
- return [];
41841
+ if (!deployConfig.cloudSql || !deployConfig.cloudSql.deleteDatabaseOnStop) {
41842
+ throw new Error("not possible");
41079
41843
  }
41080
41844
 
41081
- if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
41082
- // should not happen
41083
- throw new Error("deploy config is not custom");
41084
- }
41085
-
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");
41845
+ var DB_NAME = ((_a = context.environment.envVars) !== null && _a !== void 0 ? _a : {}).DB_NAME;
41090
41846
 
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);
41847
+ if (!DB_NAME) {
41848
+ throw new Error("error: env vars did not specify DB_NAME");
41849
+ }
41092
41850
 
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];
41851
+ var _b = __read(deployConfig.cloudSql.instanceConnectionName.split(":"), 3),
41852
+ projectId = _b[0],
41853
+ region = _b[1],
41854
+ instanceId = _b[2]; // unfortunatly the database cannot be deleted right after the service has stopped, as it might still have connections
41855
+ // we have to repeate this process
41099
41856
 
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
41857
 
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)
41858
+ 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), {
41859
+ pauseInSeconds: 10
41122
41860
  })];
41123
41861
  };
41124
41862
 
41125
- exports.createDeployJob = createDeployJob;
41863
+ exports.getDatabaseDeleteScript = getDatabaseDeleteScript;
41126
41864
 
41127
- /***/ }),
41865
+ var getDatabaseCreateScript = function (context, deployConfig) {
41866
+ var _a;
41128
41867
 
41129
- /***/ 1344:
41130
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
41868
+ if (!deployConfig.cloudSql) {
41869
+ throw new Error("not possible");
41870
+ }
41131
41871
 
41132
- "use strict";
41872
+ var DB_NAME = ((_a = context.environment.envVars) !== null && _a !== void 0 ? _a : {}).DB_NAME;
41133
41873
 
41874
+ if (!DB_NAME) {
41875
+ throw new Error("error: env vars did not specify DB_NAME");
41876
+ }
41134
41877
 
41135
- exports.__esModule = true;
41136
- exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
41878
+ var _b = __read(deployConfig.cloudSql.instanceConnectionName.split(":"), 3),
41879
+ projectId = _b[0],
41880
+ region = _b[1],
41881
+ instanceId = _b[2]; // may fail if it already exists
41137
41882
 
41138
- var deployJob_1 = __nccwpck_require__(2256);
41139
41883
 
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
- }
41884
+ return (0, gitlab_1.allowFailureInScripts)(["echo \"ensuring Database...\"", "gcloud sql databases create ".concat(DB_NAME, " --instance=").concat(instanceId, " --project ").concat(projectId)]);
41150
41885
  };
41151
41886
 
41887
+ exports.getDatabaseCreateScript = getDatabaseCreateScript;
41888
+
41152
41889
  /***/ }),
41153
41890
 
41154
41891
  /***/ 2607:
@@ -41172,43 +41909,6 @@ exports.gcloudServiceAccountLoginCommands = gcloudServiceAccountLoginCommands;
41172
41909
 
41173
41910
  /***/ }),
41174
41911
 
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
41912
  /***/ 6531:
41213
41913
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
41214
41914
 
@@ -41302,6 +42002,9 @@ exports.CUSTOM_DEPLOY_TYPE = {
41302
42002
  },
41303
42003
  additionalSecretKeys: function () {
41304
42004
  return [];
42005
+ },
42006
+ getAdditionalEnvVars: function () {
42007
+ return {};
41305
42008
  }
41306
42009
  };
41307
42010
 
@@ -41365,6 +42068,9 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
41365
42068
  },
41366
42069
  additionalSecretKeys: function () {
41367
42070
  return [];
42071
+ },
42072
+ getAdditionalEnvVars: function () {
42073
+ return {};
41368
42074
  }
41369
42075
  };
41370
42076
 
@@ -41404,21 +42110,21 @@ var dockerTag_1 = __nccwpck_require__(8990);
41404
42110
 
41405
42111
  var kubernetes_1 = __nccwpck_require__(5682);
41406
42112
 
42113
+ __exportStar(__nccwpck_require__(1344), exports);
42114
+
42115
+ __exportStar(__nccwpck_require__(1925), exports);
42116
+
41407
42117
  __exportStar(__nccwpck_require__(5682), exports);
41408
42118
 
41409
42119
  __exportStar(__nccwpck_require__(3109), exports);
41410
42120
 
41411
42121
  __exportStar(__nccwpck_require__(2757), exports);
41412
42122
 
41413
- __exportStar(__nccwpck_require__(3539), exports);
41414
-
41415
- __exportStar(__nccwpck_require__(1344), exports);
41416
-
41417
42123
  exports.DEPLOY_TYPES = {
41418
42124
  kubernetes: kubernetes_1.KUBERNETES_DEPLOY_TYPE,
41419
42125
  custom: custom_1.CUSTOM_DEPLOY_TYPE,
41420
- "google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE,
41421
- dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE
42126
+ dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE,
42127
+ "google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE
41422
42128
  };
41423
42129
 
41424
42130
  /***/ }),
@@ -41432,20 +42138,26 @@ exports.DEPLOY_TYPES = {
41432
42138
  exports.__esModule = true;
41433
42139
  exports.additionalKubernetesSecretKeys = void 0;
41434
42140
 
41435
- var additionalKubernetesSecretKeys = function (config) {
41436
- var _a, _b, _c, _d;
42141
+ var additionalKubernetesSecretKeys = function (_a) {
42142
+ var _b, _c, _d, _e;
42143
+
42144
+ var deployConfigRaw = _a.deployConfigRaw;
42145
+
42146
+ if (!deployConfigRaw) {
42147
+ return [];
42148
+ }
41437
42149
 
41438
42150
  var keys = [];
41439
42151
 
41440
- if ((_b = (_a = config.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) {
42152
+ if ((_c = (_b = deployConfigRaw.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) {
41441
42153
  keys.push("MONGODB_ROOT_PASSWORD");
41442
42154
 
41443
- if (config.values.mongodb.architecture === "replicaset") {
42155
+ if (deployConfigRaw.values.mongodb.architecture === "replicaset") {
41444
42156
  keys.push("MONGODB_REPLICASET_KEY");
41445
42157
  }
41446
42158
  }
41447
42159
 
41448
- if ((_d = (_c = config.values) === null || _c === void 0 ? void 0 : _c.cloudsql) === null || _d === void 0 ? void 0 : _d.enabled) {
42160
+ if ((_e = (_d = deployConfigRaw.values) === null || _d === void 0 ? void 0 : _d.cloudsql) === null || _e === void 0 ? void 0 : _e.enabled) {
41449
42161
  keys.push("POSTGRESQL_PASSWORD");
41450
42162
  keys.push("cloudsqlProxyCredentials");
41451
42163
  }
@@ -41457,6 +42169,43 @@ exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
41457
42169
 
41458
42170
  /***/ }),
41459
42171
 
42172
+ /***/ 1925:
42173
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
42174
+
42175
+ "use strict";
42176
+
42177
+
42178
+ exports.__esModule = true;
42179
+ exports.getKubernetesCloudSQLConfig = exports.hasKubernetesCloudSQL = void 0;
42180
+
42181
+ var types_1 = __nccwpck_require__(3109);
42182
+
42183
+ var hasKubernetesCloudSQL = function (context) {
42184
+ var _a, _b;
42185
+
42186
+ if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
42187
+ return (_b = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql) === null || _b === void 0 ? void 0 : _b.enabled;
42188
+ }
42189
+
42190
+ return false;
42191
+ };
42192
+
42193
+ exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
42194
+
42195
+ var getKubernetesCloudSQLConfig = function (context) {
42196
+ var _a;
42197
+
42198
+ if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
42199
+ return (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
42200
+ }
42201
+
42202
+ throw new Error("cannot get cloud sql config");
42203
+ };
42204
+
42205
+ exports.getKubernetesCloudSQLConfig = getKubernetesCloudSQLConfig;
42206
+
42207
+ /***/ }),
42208
+
41460
42209
  /***/ 395:
41461
42210
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
41462
42211
 
@@ -41615,14 +42364,24 @@ exports.createKubernetesDeployJobs = createKubernetesDeployJobs;
41615
42364
  /***/ }),
41616
42365
 
41617
42366
  /***/ 5682:
41618
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
42367
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
41619
42368
 
41620
42369
  "use strict";
41621
42370
 
41622
42371
 
42372
+ var __importDefault = this && this.__importDefault || function (mod) {
42373
+ return mod && mod.__esModule ? mod : {
42374
+ "default": mod
42375
+ };
42376
+ };
42377
+
41623
42378
  exports.__esModule = true;
41624
42379
  exports.KUBERNETES_DEPLOY_TYPE = void 0;
41625
42380
 
42381
+ var slugify_1 = __importDefault(__nccwpck_require__(4035));
42382
+
42383
+ var __1 = __nccwpck_require__(223);
42384
+
41626
42385
  var additionalSecretKeys_1 = __nccwpck_require__(5775);
41627
42386
 
41628
42387
  var deployJob_1 = __nccwpck_require__(9792);
@@ -41632,7 +42391,32 @@ exports.KUBERNETES_DEPLOY_TYPE = {
41632
42391
  defaults: function () {
41633
42392
  return {};
41634
42393
  },
41635
- additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys
42394
+ additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys,
42395
+ getAdditionalEnvVars: function (_a) {
42396
+ var _b;
42397
+
42398
+ var componentName = _a.componentName,
42399
+ fullConfig = _a.fullConfig,
42400
+ deployConfigRaw = _a.deployConfigRaw,
42401
+ env = _a.env,
42402
+ envType = _a.envType,
42403
+ commitInfo = _a.commitInfo;
42404
+ var KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
42405
+ var KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
42406
+ var KUBE_NAMESPACE = (0, __1.getKubernetesNamespace)(fullConfig, env);
42407
+ var componentSlug = (0, slugify_1["default"])(componentName);
42408
+ var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
42409
+ 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
42410
+ fullConfig.domainCanonical || "panter.cloud";
42411
+ var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
42412
+
42413
+ return {
42414
+ KUBE_NAMESPACE: KUBE_NAMESPACE,
42415
+ KUBE_APP_NAME: KUBE_APP_NAME,
42416
+ KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
42417
+ HOST_CANONICAL: HOST_CANONICAL
42418
+ };
42419
+ }
41636
42420
  };
41637
42421
 
41638
42422
  /***/ }),
@@ -41758,7 +42542,7 @@ var lodash_1 = __nccwpck_require__(3255);
41758
42542
 
41759
42543
  var utils_1 = __nccwpck_require__(7461);
41760
42544
 
41761
- var cloudSql_1 = __nccwpck_require__(3539);
42545
+ var cloudSql_1 = __nccwpck_require__(1925);
41762
42546
 
41763
42547
  var types_1 = __nccwpck_require__(3109);
41764
42548
 
@@ -41828,7 +42612,7 @@ var createKubeValues = function (context) {
41828
42612
  var defaultKubeValues = (0, lodash_1.merge)({
41829
42613
  env: env,
41830
42614
  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) : {});
42615
+ }, (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
42616
  var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, rest));
41833
42617
  return kubeValues;
41834
42618
  };
@@ -42201,57 +42985,6 @@ __exportStar(__nccwpck_require__(223), exports);
42201
42985
 
42202
42986
  /***/ }),
42203
42987
 
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
42988
  /***/ 8974:
42256
42989
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
42257
42990
 
@@ -42754,8 +43487,6 @@ var context_1 = __nccwpck_require__(2041);
42754
43487
 
42755
43488
  var deploy_1 = __nccwpck_require__(223);
42756
43489
 
42757
- var reportingJob_1 = __nccwpck_require__(9572);
42758
-
42759
43490
  var utils_1 = __nccwpck_require__(7461);
42760
43491
 
42761
43492
  var makeGitlabJob_1 = __nccwpck_require__(5715);
@@ -42792,8 +43523,7 @@ var createRawJobs = function (context) {
42792
43523
  var buildJobs = build_1.BUILD_TYPES[context.componentConfig.build.type].jobs(context);
42793
43524
  var deployJobs = deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context);
42794
43525
  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);
43526
+ return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
42797
43527
  };
42798
43528
 
42799
43529
  var getFullJobName = function (name, componentName, env) {
@@ -43616,7 +44346,7 @@ __exportStar(__nccwpck_require__(3146), exports);
43616
44346
 
43617
44347
  exports.__esModule = true;
43618
44348
  exports.BASE_STAGES = void 0;
43619
- exports.BASE_STAGES = ["setup", "test", "build", "deploy", "verify", "rollback", "stop", "reporting"];
44349
+ exports.BASE_STAGES = ["setup", "test", "build", "deploy", "verify", "rollback", "stop"];
43620
44350
 
43621
44351
  /***/ }),
43622
44352
 
@@ -43630,6 +44360,71 @@ exports.__esModule = true;
43630
44360
 
43631
44361
  /***/ }),
43632
44362
 
44363
+ /***/ 4997:
44364
+ /***/ (function(__unused_webpack_module, exports) {
44365
+
44366
+ "use strict";
44367
+
44368
+
44369
+ var __read = this && this.__read || function (o, n) {
44370
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
44371
+ if (!m) return o;
44372
+ var i = m.call(o),
44373
+ r,
44374
+ ar = [],
44375
+ e;
44376
+
44377
+ try {
44378
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44379
+ } catch (error) {
44380
+ e = {
44381
+ error: error
44382
+ };
44383
+ } finally {
44384
+ try {
44385
+ if (r && !r.done && (m = i["return"])) m.call(i);
44386
+ } finally {
44387
+ if (e) throw e.error;
44388
+ }
44389
+ }
44390
+
44391
+ return ar;
44392
+ };
44393
+
44394
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
44395
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
44396
+ if (ar || !(i in from)) {
44397
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
44398
+ ar[i] = from[i];
44399
+ }
44400
+ }
44401
+ return to.concat(ar || Array.prototype.slice.call(from));
44402
+ };
44403
+
44404
+ exports.__esModule = true;
44405
+ exports.repeatOnFailure = exports.sanitizeForBashVariable = exports.allowFailureInScripts = void 0;
44406
+
44407
+ var allowFailureInScripts = function (script) {
44408
+ return __spreadArray(__spreadArray(["set +e"], __read(script), false), ["set -e" // reenable
44409
+ ], false);
44410
+ };
44411
+
44412
+ exports.allowFailureInScripts = allowFailureInScripts;
44413
+
44414
+ var sanitizeForBashVariable = function (name) {
44415
+ return name.replace(/-/g, "_");
44416
+ };
44417
+
44418
+ exports.sanitizeForBashVariable = sanitizeForBashVariable;
44419
+
44420
+ var repeatOnFailure = function (command, options) {
44421
+ return "\n until ".concat(command, " &> /dev/null\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
44422
+ };
44423
+
44424
+ exports.repeatOnFailure = repeatOnFailure;
44425
+
44426
+ /***/ }),
44427
+
43633
44428
  /***/ 7461:
43634
44429
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43635
44430