@catladder/cli 0.0.0-fix-command-710f75f1 → 0.0.0-fix-error-sql-db-delete-b3878c2e

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.
@@ -1453,20 +1453,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
1453
1453
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1454
1454
  }
1455
1455
  };
1456
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
1457
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1458
- if (ar || !(i in from)) {
1459
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1460
- ar[i] = from[i];
1461
- }
1462
- }
1463
- return to.concat(ar || Array.prototype.slice.call(from));
1464
- };
1465
1456
  exports.__esModule = true;
1466
1457
  var pipeline_1 = __nccwpck_require__(25355);
1467
1458
  var child_process_promise_1 = __nccwpck_require__(75763);
1468
- var fs_extra_1 = __nccwpck_require__(85501);
1469
- var tmp_promise_1 = __nccwpck_require__(68841);
1470
1459
  var getProjectConfig_1 = __nccwpck_require__(24146);
1471
1460
  var autocompletions_1 = __nccwpck_require__(41373);
1472
1461
  exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
@@ -1482,8 +1471,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
1482
1471
  .action(function (_a) {
1483
1472
  var envComponent = _a.envComponent;
1484
1473
  return __awaiter(this, void 0, void 0, function () {
1485
- var _b, env, componentName, context, proxyInfo, DB_PASSWORD, DB_NAME, DB_USER, instanceName, localPort, cloudsqlProxyCredentials;
1486
- var _this = this;
1474
+ var _b, env, componentName, context, proxyInfo, DB_PASSWORD, DB_NAME, DB_USER, instanceName, localPort;
1487
1475
  return __generator(this, function (_c) {
1488
1476
  switch (_c.label) {
1489
1477
  case 0:
@@ -1521,37 +1509,11 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
1521
1509
  this.log("");
1522
1510
  this.log("POSTGRESQL_URL=postgresql://".concat(DB_USER, ":").concat(DB_PASSWORD, "@localhost:").concat(localPort, "/").concat(DB_NAME, "?schema=public"));
1523
1511
  this.log("");
1524
- return [4 /*yield*/, (0, getProjectConfig_1.getGitlabVar)(this, env, componentName, "cloudsqlProxyCredentials")];
1525
- case 8:
1526
- cloudsqlProxyCredentials = _c.sent();
1527
- return [4 /*yield*/, (0, tmp_promise_1.withFile)(function (_a) {
1528
- var tmpFilePath = _a.path;
1529
- return __awaiter(_this, void 0, void 0, function () {
1530
- return __generator(this, function (_b) {
1531
- switch (_b.label) {
1532
- case 0:
1533
- if (!cloudsqlProxyCredentials) return [3 /*break*/, 2];
1534
- return [4 /*yield*/, (0, fs_extra_1.writeFile)(tmpFilePath, cloudsqlProxyCredentials)];
1535
- case 1:
1536
- _b.sent();
1537
- _b.label = 2;
1538
- case 2: return [4 /*yield*/, (0, child_process_promise_1.spawn)("cloud_sql_proxy", __spreadArray([
1539
- "-instances",
1540
- "".concat(instanceName, "=tcp:").concat(localPort)
1541
- ], (cloudsqlProxyCredentials
1542
- ? ["-credential_file", tmpFilePath]
1543
- : []), true), {
1544
- stdio: "inherit",
1545
- shell: true
1546
- })];
1547
- case 3:
1548
- _b.sent();
1549
- return [2 /*return*/];
1550
- }
1551
- });
1552
- });
1512
+ return [4 /*yield*/, (0, child_process_promise_1.spawn)("cloud_sql_proxy", ["-instances", "".concat(instanceName, "=tcp:").concat(localPort)], {
1513
+ stdio: "inherit",
1514
+ shell: true
1553
1515
  })];
1554
- case 9:
1516
+ case 8:
1555
1517
  _c.sent();
1556
1518
  return [2 /*return*/];
1557
1519
  }
@@ -1700,13 +1662,24 @@ var resolveJson = function (v) {
1700
1662
  ];
1701
1663
  }));
1702
1664
  };
1703
- var getEnvVarsToEdit = function (instance, env, componentName) { return __awaiter(void 0, void 0, void 0, function () {
1704
- var secretEnvVarKeys, allEnvVars;
1665
+ var getNonHiddenSecretEnvVarKeys = function (env, componentName) { return __awaiter(void 0, void 0, void 0, function () {
1666
+ var secretEnvVarKeys;
1705
1667
  return __generator(this, function (_a) {
1706
1668
  switch (_a.label) {
1707
1669
  case 0: return [4 /*yield*/, (0, getProjectConfig_1.getEnvironment)(env, componentName)];
1708
1670
  case 1:
1709
1671
  secretEnvVarKeys = (_a.sent()).secretEnvVarKeys;
1672
+ return [2 /*return*/, secretEnvVarKeys.filter(function (k) { return !k.hidden; }).map(function (k) { return k.key; })];
1673
+ }
1674
+ });
1675
+ }); };
1676
+ var getEnvVarsToEdit = function (instance, env, componentName) { return __awaiter(void 0, void 0, void 0, function () {
1677
+ var secretEnvVarKeys, allEnvVars;
1678
+ return __generator(this, function (_a) {
1679
+ switch (_a.label) {
1680
+ case 0: return [4 /*yield*/, getNonHiddenSecretEnvVarKeys(env, componentName)];
1681
+ case 1:
1682
+ secretEnvVarKeys = _a.sent();
1710
1683
  return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(instance, env, componentName)];
1711
1684
  case 2:
1712
1685
  allEnvVars = _a.sent();
@@ -1783,9 +1756,9 @@ var doItFor = function (instance, envAndComponents) { return __awaiter(void 0, v
1783
1756
  usedKeys = valuesToEdit[componentName][env]
1784
1757
  ? Object.keys(valuesToEdit[componentName][env])
1785
1758
  : [];
1786
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvironment)(env, componentName)];
1759
+ return [4 /*yield*/, getNonHiddenSecretEnvVarKeys(env, componentName)];
1787
1760
  case 6:
1788
- secretEnvVarKeys = (_k.sent()).secretEnvVarKeys;
1761
+ secretEnvVarKeys = _k.sent();
1789
1762
  extranous = (0, lodash_1.difference)(usedKeys, secretEnvVarKeys);
1790
1763
  missing = (0, lodash_1.difference)(secretEnvVarKeys, usedKeys);
1791
1764
  if (!(extranous.length > 0 || missing.length > 0)) return [3 /*break*/, 9];
@@ -4225,6 +4198,7 @@ var getProjectConfig_1 = __nccwpck_require__(24146);
4225
4198
  var commandConfigSecrets_1 = __nccwpck_require__(80883);
4226
4199
  var setupAccessTokens_1 = __nccwpck_require__(64270);
4227
4200
  var setupContext_1 = __nccwpck_require__(40663);
4201
+ var setupTopic_1 = __nccwpck_require__(21082);
4228
4202
  var setupProject = function (instance) { return __awaiter(void 0, void 0, void 0, function () {
4229
4203
  var allContext, _i, allContext_1, context, configSecrets;
4230
4204
  return __generator(this, function (_a) {
@@ -4246,6 +4220,9 @@ var setupProject = function (instance) { return __awaiter(void 0, void 0, void 0
4246
4220
  return [3 /*break*/, 2];
4247
4221
  case 5: return [4 /*yield*/, (0, setupAccessTokens_1.setupAccessTokens)(instance)];
4248
4222
  case 6:
4223
+ _a.sent();
4224
+ return [4 /*yield*/, (0, setupTopic_1.setupTopic)(instance)];
4225
+ case 7:
4249
4226
  _a.sent();
4250
4227
  instance.log("");
4251
4228
  return [4 /*yield*/, instance.prompt({
@@ -4254,18 +4231,18 @@ var setupProject = function (instance) { return __awaiter(void 0, void 0, void 0
4254
4231
  name: "configSecrets",
4255
4232
  type: "confirm"
4256
4233
  })];
4257
- case 7:
4234
+ case 8:
4258
4235
  configSecrets = (_a.sent()).configSecrets;
4259
4236
  instance.log("");
4260
- if (!configSecrets) return [3 /*break*/, 9];
4237
+ if (!configSecrets) return [3 /*break*/, 10];
4261
4238
  return [4 /*yield*/, (0, commandConfigSecrets_1.projectConfigSecrets)(instance)];
4262
- case 8:
4263
- _a.sent();
4264
- return [3 /*break*/, 10];
4265
4239
  case 9:
4266
- instance.log("👆 don't forget to config secret using `project-config-secrets`");
4267
- _a.label = 10;
4240
+ _a.sent();
4241
+ return [3 /*break*/, 11];
4268
4242
  case 10:
4243
+ instance.log("👆 don't forget to config secret using `project-config-secrets`");
4244
+ _a.label = 11;
4245
+ case 11:
4269
4246
  instance.log("");
4270
4247
  instance.log("gitlab is ready! 🥂");
4271
4248
  instance.log("\n");
@@ -4829,7 +4806,7 @@ exports.setupKubernetes = setupKubernetes;
4829
4806
 
4830
4807
  /***/ }),
4831
4808
 
4832
- /***/ 41373:
4809
+ /***/ 21082:
4833
4810
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
4834
4811
 
4835
4812
  "use strict";
@@ -4880,59 +4857,32 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
4880
4857
  return to.concat(ar || Array.prototype.slice.call(from));
4881
4858
  };
4882
4859
  exports.__esModule = true;
4883
- exports.allEnvsAndAllComponents = exports.envAndComponents = exports.allEnvs = void 0;
4884
- var pipeline_1 = __nccwpck_require__(25355);
4885
- var getProjectConfig_1 = __nccwpck_require__(24146);
4886
- var allEnvs = function () { return __awaiter(void 0, void 0, void 0, function () {
4887
- var config;
4888
- return __generator(this, function (_a) {
4889
- switch (_a.label) {
4890
- case 0: return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
4891
- case 1:
4892
- config = _a.sent();
4893
- if (!config) {
4894
- return [2 /*return*/, []];
4895
- }
4896
- return [2 /*return*/, (0, pipeline_1.getAllEnvsInAllComponents)(config)];
4897
- }
4898
- });
4899
- }); };
4900
- exports.allEnvs = allEnvs;
4901
- var envAndComponents = function () { return __awaiter(void 0, void 0, void 0, function () {
4902
- var allEnvAndcomponents;
4860
+ exports.setupTopic = void 0;
4861
+ var gitlab_1 = __nccwpck_require__(79818);
4862
+ var catladderTopic = "catladder";
4863
+ var setupTopic = function (instance) { return __awaiter(void 0, void 0, void 0, function () {
4864
+ var projectId, topics;
4903
4865
  return __generator(this, function (_a) {
4904
4866
  switch (_a.label) {
4905
- case 0: return [4 /*yield*/, (0, getProjectConfig_1.getAllComponentsWithAllEnvsFlat)()];
4906
- case 1:
4907
- allEnvAndcomponents = _a.sent();
4908
- return [2 /*return*/, allEnvAndcomponents.reduce(function (acc, _a) {
4909
- var env = _a.env, componentName = _a.componentName;
4910
- return __spreadArray(__spreadArray([], acc, true), [env + ":" + componentName], false);
4911
- }, [])];
4912
- }
4913
- });
4914
- }); };
4915
- exports.envAndComponents = envAndComponents;
4916
- var allEnvsAndAllComponents = function () { return __awaiter(void 0, void 0, void 0, function () {
4917
- var _a, _b;
4918
- return __generator(this, function (_c) {
4919
- switch (_c.label) {
4920
- case 0:
4921
- _a = [[]];
4922
- return [4 /*yield*/, (0, exports.allEnvs)()];
4867
+ case 0: return [4 /*yield*/, (0, gitlab_1.getProjectInfo)(instance)];
4923
4868
  case 1:
4924
- _b = [__spreadArray.apply(void 0, _a.concat([(_c.sent()), true]))];
4925
- return [4 /*yield*/, (0, exports.envAndComponents)()];
4926
- case 2: return [2 /*return*/, __spreadArray.apply(void 0, _b.concat([(_c.sent()), true]))];
4869
+ projectId = (_a.sent()).id;
4870
+ return [4 /*yield*/, (0, gitlab_1.doGitlabRequest)(instance, "projects/".concat(projectId))];
4871
+ case 2:
4872
+ topics = (_a.sent()).topics;
4873
+ return [4 /*yield*/, (0, gitlab_1.doGitlabRequest)(instance, "projects/".concat(projectId), { topics: __spreadArray([catladderTopic], topics, true) }, "PUT")];
4874
+ case 3:
4875
+ _a.sent();
4876
+ return [2 /*return*/];
4927
4877
  }
4928
4878
  });
4929
4879
  }); };
4930
- exports.allEnvsAndAllComponents = allEnvsAndAllComponents;
4931
- //# sourceMappingURL=autocompletions.js.map
4880
+ exports.setupTopic = setupTopic;
4881
+ //# sourceMappingURL=setupTopic.js.map
4932
4882
 
4933
4883
  /***/ }),
4934
4884
 
4935
- /***/ 8722:
4885
+ /***/ 41373:
4936
4886
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
4937
4887
 
4938
4888
  "use strict";
@@ -4973,168 +4923,271 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
4973
4923
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
4974
4924
  }
4975
4925
  };
4926
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
4927
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4928
+ if (ar || !(i in from)) {
4929
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
4930
+ ar[i] = from[i];
4931
+ }
4932
+ }
4933
+ return to.concat(ar || Array.prototype.slice.call(from));
4934
+ };
4976
4935
  exports.__esModule = true;
4936
+ exports.allEnvsAndAllComponents = exports.envAndComponents = exports.allEnvs = void 0;
4977
4937
  var pipeline_1 = __nccwpck_require__(25355);
4978
4938
  var getProjectConfig_1 = __nccwpck_require__(24146);
4979
- var cluster_1 = __nccwpck_require__(66894);
4980
- function default_1(envComponent) {
4981
- return __awaiter(this, void 0, void 0, function () {
4982
- var _a, env, componentName, context, cluster, connectedClusterName, shouldContinue;
4983
- return __generator(this, function (_b) {
4984
- switch (_b.label) {
4985
- case 0:
4986
- _a = (0, getProjectConfig_1.parseChoice)(envComponent), env = _a.env, componentName = _a.componentName;
4987
- return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
4988
- case 1:
4989
- context = _b.sent();
4990
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
4991
- throw new Error("can't ensure cluster for non-kubernetes deployments");
4992
- }
4993
- cluster = (0, pipeline_1.getFullKubernetesClusterName)(context.componentConfig.deploy.cluster);
4994
- return [4 /*yield*/, (0, cluster_1.getCurrentConnectedClusterName)()];
4995
- case 2:
4996
- connectedClusterName = _b.sent();
4997
- if (!(cluster !== connectedClusterName)) return [3 /*break*/, 6];
4998
- this.log("you are currently connected to cluster '".concat(connectedClusterName, "'"));
4999
- this.log("but the project requires cluster '".concat(cluster, "'"));
5000
- return [4 /*yield*/, this.prompt({
5001
- type: "confirm",
5002
- name: "shouldContinue",
5003
- "default": true,
5004
- message: "Do you want to connect to '".concat(cluster, "'?")
5005
- })];
5006
- case 3:
5007
- shouldContinue = (_b.sent()).shouldContinue;
5008
- if (!!shouldContinue) return [3 /*break*/, 4];
5009
- this.log("abort");
5010
- return [3 /*break*/, 6];
5011
- case 4: return [4 /*yield*/, (0, cluster_1.connectToCluster)(cluster)];
5012
- case 5:
5013
- _b.sent();
5014
- this.log("connected to cluster '".concat(cluster, "'"));
5015
- _b.label = 6;
5016
- case 6: return [2 /*return*/];
5017
- }
5018
- });
4939
+ var allEnvs = function () { return __awaiter(void 0, void 0, void 0, function () {
4940
+ var config;
4941
+ return __generator(this, function (_a) {
4942
+ switch (_a.label) {
4943
+ case 0: return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
4944
+ case 1:
4945
+ config = _a.sent();
4946
+ if (!config) {
4947
+ return [2 /*return*/, []];
4948
+ }
4949
+ return [2 /*return*/, (0, pipeline_1.getAllEnvsInAllComponents)(config)];
4950
+ }
5019
4951
  });
5020
- }
5021
- exports["default"] = default_1;
5022
- //# sourceMappingURL=ensureCluster.js.map
5023
-
5024
- /***/ }),
5025
-
5026
- /***/ 99489:
5027
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
5028
-
5029
- "use strict";
5030
-
5031
- var __assign = (this && this.__assign) || function () {
5032
- __assign = Object.assign || function(t) {
5033
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5034
- s = arguments[i];
5035
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
5036
- t[p] = s[p];
4952
+ }); };
4953
+ exports.allEnvs = allEnvs;
4954
+ var envAndComponents = function () { return __awaiter(void 0, void 0, void 0, function () {
4955
+ var allEnvAndcomponents;
4956
+ return __generator(this, function (_a) {
4957
+ switch (_a.label) {
4958
+ case 0: return [4 /*yield*/, (0, getProjectConfig_1.getAllComponentsWithAllEnvsFlat)()];
4959
+ case 1:
4960
+ allEnvAndcomponents = _a.sent();
4961
+ return [2 /*return*/, allEnvAndcomponents.reduce(function (acc, _a) {
4962
+ var env = _a.env, componentName = _a.componentName;
4963
+ return __spreadArray(__spreadArray([], acc, true), [env + ":" + componentName], false);
4964
+ }, [])];
5037
4965
  }
5038
- return t;
5039
- };
5040
- return __assign.apply(this, arguments);
5041
- };
5042
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5043
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5044
- return new (P || (P = Promise))(function (resolve, reject) {
5045
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5046
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5047
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5048
- step((generator = generator.apply(thisArg, _arguments || [])).next());
5049
4966
  });
5050
- };
5051
- var __generator = (this && this.__generator) || function (thisArg, body) {
5052
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
5053
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
5054
- function verb(n) { return function (v) { return step([n, v]); }; }
5055
- function step(op) {
5056
- if (f) throw new TypeError("Generator is already executing.");
5057
- while (_) try {
5058
- 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;
5059
- if (y = 0, t) op = [op[0] & 2, t.value];
5060
- switch (op[0]) {
5061
- case 0: case 1: t = op; break;
5062
- case 4: _.label++; return { value: op[1], done: false };
5063
- case 5: _.label++; y = op[1]; op = [0]; continue;
5064
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
5065
- default:
5066
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
5067
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
5068
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
5069
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
5070
- if (t[2]) _.ops.pop();
5071
- _.trys.pop(); continue;
5072
- }
5073
- op = body.call(thisArg, _);
5074
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
5075
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
5076
- }
5077
- };
5078
- exports.__esModule = true;
5079
- var pipeline_1 = __nccwpck_require__(25355);
5080
- var client_node_1 = __nccwpck_require__(15124);
5081
- var k8sApi_1 = __nccwpck_require__(54756);
5082
- function default_1(context) {
5083
- var _a, _b, _c, _d, _e;
5084
- return __awaiter(this, void 0, void 0, function () {
5085
- var namespace, namespaceBody, metadata, k8sApi, e_1;
5086
- return __generator(this, function (_f) {
5087
- switch (_f.label) {
5088
- case 0:
5089
- namespace = (0, pipeline_1.getKubernetesNamespace)(context.fullConfig, context.environment.shortName);
5090
- namespaceBody = new client_node_1.V1Namespace();
5091
- metadata = {
5092
- name: namespace,
5093
- labels: __assign(__assign({ customerName: context.fullConfig.customerName, appName: context.fullConfig.appName, environment: context.environment.shortName, components: Object.keys(context.fullConfig.components).join("_"), buildTypes: Object.values(context.fullConfig.components)
5094
- .map(function (config) { return config.build.type; })
5095
- .join("_") }, Object.fromEntries(Object.entries(context.fullConfig.components).map(function (_a) {
5096
- var componentName = _a[0], config = _a[1];
5097
- return [
5098
- "buildType_" + componentName,
5099
- config.build.type,
5100
- ];
5101
- }))), ((_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {}))
5102
- };
5103
- namespaceBody.metadata = metadata;
5104
- k8sApi = (0, k8sApi_1.getk8sApi)();
5105
- _f.label = 1;
5106
- case 1:
5107
- _f.trys.push([1, 4, , 8]);
5108
- return [4 /*yield*/, k8sApi.readNamespace(namespace)];
5109
- case 2:
5110
- _f.sent();
5111
- return [4 /*yield*/, k8sApi.patchNamespace(namespace, namespaceBody, undefined, undefined, undefined, undefined, { headers: { "content-type": "application/merge-patch+json" } } // see https://github.com/kubernetes-client/javascript/issues/443
5112
- )];
5113
- case 3:
5114
- _f.sent(); // update meta data
5115
- return [3 /*break*/, 8];
5116
- case 4:
5117
- e_1 = _f.sent();
5118
- if (!(((_d = (_c = e_1.response) === null || _c === void 0 ? void 0 : _c.body) === null || _d === void 0 ? void 0 : _d.reason) === "NotFound")) return [3 /*break*/, 6];
5119
- return [4 /*yield*/, k8sApi.createNamespace(namespaceBody)];
5120
- case 5:
5121
- _f.sent();
5122
- return [3 /*break*/, 7];
5123
- case 6:
5124
- console.error((_e = e_1.response) === null || _e === void 0 ? void 0 : _e.body);
5125
- throw e_1;
5126
- case 7: return [3 /*break*/, 8];
5127
- case 8: return [2 /*return*/, namespace];
5128
- }
5129
- });
4967
+ }); };
4968
+ exports.envAndComponents = envAndComponents;
4969
+ var allEnvsAndAllComponents = function () { return __awaiter(void 0, void 0, void 0, function () {
4970
+ var _a, _b;
4971
+ return __generator(this, function (_c) {
4972
+ switch (_c.label) {
4973
+ case 0:
4974
+ _a = [[]];
4975
+ return [4 /*yield*/, (0, exports.allEnvs)()];
4976
+ case 1:
4977
+ _b = [__spreadArray.apply(void 0, _a.concat([(_c.sent()), true]))];
4978
+ return [4 /*yield*/, (0, exports.envAndComponents)()];
4979
+ case 2: return [2 /*return*/, __spreadArray.apply(void 0, _b.concat([(_c.sent()), true]))];
4980
+ }
5130
4981
  });
5131
- }
5132
- exports["default"] = default_1;
5133
- //# sourceMappingURL=ensureNamespace.js.map
4982
+ }); };
4983
+ exports.allEnvsAndAllComponents = allEnvsAndAllComponents;
4984
+ //# sourceMappingURL=autocompletions.js.map
5134
4985
 
5135
4986
  /***/ }),
5136
4987
 
5137
- /***/ 43605:
4988
+ /***/ 8722:
4989
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
4990
+
4991
+ "use strict";
4992
+
4993
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4994
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4995
+ return new (P || (P = Promise))(function (resolve, reject) {
4996
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4997
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
4998
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
4999
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
5000
+ });
5001
+ };
5002
+ var __generator = (this && this.__generator) || function (thisArg, body) {
5003
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
5004
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
5005
+ function verb(n) { return function (v) { return step([n, v]); }; }
5006
+ function step(op) {
5007
+ if (f) throw new TypeError("Generator is already executing.");
5008
+ while (_) try {
5009
+ 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;
5010
+ if (y = 0, t) op = [op[0] & 2, t.value];
5011
+ switch (op[0]) {
5012
+ case 0: case 1: t = op; break;
5013
+ case 4: _.label++; return { value: op[1], done: false };
5014
+ case 5: _.label++; y = op[1]; op = [0]; continue;
5015
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
5016
+ default:
5017
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
5018
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
5019
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
5020
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
5021
+ if (t[2]) _.ops.pop();
5022
+ _.trys.pop(); continue;
5023
+ }
5024
+ op = body.call(thisArg, _);
5025
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
5026
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
5027
+ }
5028
+ };
5029
+ exports.__esModule = true;
5030
+ var pipeline_1 = __nccwpck_require__(25355);
5031
+ var getProjectConfig_1 = __nccwpck_require__(24146);
5032
+ var cluster_1 = __nccwpck_require__(66894);
5033
+ function default_1(envComponent) {
5034
+ return __awaiter(this, void 0, void 0, function () {
5035
+ var _a, env, componentName, context, cluster, connectedClusterName, shouldContinue;
5036
+ return __generator(this, function (_b) {
5037
+ switch (_b.label) {
5038
+ case 0:
5039
+ _a = (0, getProjectConfig_1.parseChoice)(envComponent), env = _a.env, componentName = _a.componentName;
5040
+ return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
5041
+ case 1:
5042
+ context = _b.sent();
5043
+ if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
5044
+ throw new Error("can't ensure cluster for non-kubernetes deployments");
5045
+ }
5046
+ cluster = (0, pipeline_1.getFullKubernetesClusterName)(context.componentConfig.deploy.cluster);
5047
+ return [4 /*yield*/, (0, cluster_1.getCurrentConnectedClusterName)()];
5048
+ case 2:
5049
+ connectedClusterName = _b.sent();
5050
+ if (!(cluster !== connectedClusterName)) return [3 /*break*/, 6];
5051
+ this.log("you are currently connected to cluster '".concat(connectedClusterName, "'"));
5052
+ this.log("but the project requires cluster '".concat(cluster, "'"));
5053
+ return [4 /*yield*/, this.prompt({
5054
+ type: "confirm",
5055
+ name: "shouldContinue",
5056
+ "default": true,
5057
+ message: "Do you want to connect to '".concat(cluster, "'?")
5058
+ })];
5059
+ case 3:
5060
+ shouldContinue = (_b.sent()).shouldContinue;
5061
+ if (!!shouldContinue) return [3 /*break*/, 4];
5062
+ this.log("abort");
5063
+ return [3 /*break*/, 6];
5064
+ case 4: return [4 /*yield*/, (0, cluster_1.connectToCluster)(cluster)];
5065
+ case 5:
5066
+ _b.sent();
5067
+ this.log("connected to cluster '".concat(cluster, "'"));
5068
+ _b.label = 6;
5069
+ case 6: return [2 /*return*/];
5070
+ }
5071
+ });
5072
+ });
5073
+ }
5074
+ exports["default"] = default_1;
5075
+ //# sourceMappingURL=ensureCluster.js.map
5076
+
5077
+ /***/ }),
5078
+
5079
+ /***/ 99489:
5080
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
5081
+
5082
+ "use strict";
5083
+
5084
+ var __assign = (this && this.__assign) || function () {
5085
+ __assign = Object.assign || function(t) {
5086
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5087
+ s = arguments[i];
5088
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
5089
+ t[p] = s[p];
5090
+ }
5091
+ return t;
5092
+ };
5093
+ return __assign.apply(this, arguments);
5094
+ };
5095
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5096
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5097
+ return new (P || (P = Promise))(function (resolve, reject) {
5098
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5099
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5100
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5101
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
5102
+ });
5103
+ };
5104
+ var __generator = (this && this.__generator) || function (thisArg, body) {
5105
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
5106
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
5107
+ function verb(n) { return function (v) { return step([n, v]); }; }
5108
+ function step(op) {
5109
+ if (f) throw new TypeError("Generator is already executing.");
5110
+ while (_) try {
5111
+ 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;
5112
+ if (y = 0, t) op = [op[0] & 2, t.value];
5113
+ switch (op[0]) {
5114
+ case 0: case 1: t = op; break;
5115
+ case 4: _.label++; return { value: op[1], done: false };
5116
+ case 5: _.label++; y = op[1]; op = [0]; continue;
5117
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
5118
+ default:
5119
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
5120
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
5121
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
5122
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
5123
+ if (t[2]) _.ops.pop();
5124
+ _.trys.pop(); continue;
5125
+ }
5126
+ op = body.call(thisArg, _);
5127
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
5128
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
5129
+ }
5130
+ };
5131
+ exports.__esModule = true;
5132
+ var pipeline_1 = __nccwpck_require__(25355);
5133
+ var client_node_1 = __nccwpck_require__(15124);
5134
+ var k8sApi_1 = __nccwpck_require__(54756);
5135
+ function default_1(context) {
5136
+ var _a, _b, _c, _d, _e;
5137
+ return __awaiter(this, void 0, void 0, function () {
5138
+ var namespace, namespaceBody, metadata, k8sApi, e_1;
5139
+ return __generator(this, function (_f) {
5140
+ switch (_f.label) {
5141
+ case 0:
5142
+ namespace = (0, pipeline_1.getKubernetesNamespace)(context.fullConfig, context.environment.shortName);
5143
+ namespaceBody = new client_node_1.V1Namespace();
5144
+ metadata = {
5145
+ name: namespace,
5146
+ labels: __assign(__assign({ customerName: context.fullConfig.customerName, appName: context.fullConfig.appName, environment: context.environment.shortName, components: Object.keys(context.fullConfig.components).join("_"), buildTypes: Object.values(context.fullConfig.components)
5147
+ .map(function (config) { return config.build.type; })
5148
+ .join("_") }, Object.fromEntries(Object.entries(context.fullConfig.components).map(function (_a) {
5149
+ var componentName = _a[0], config = _a[1];
5150
+ return [
5151
+ "buildType_" + componentName,
5152
+ config.build.type,
5153
+ ];
5154
+ }))), ((_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {}))
5155
+ };
5156
+ namespaceBody.metadata = metadata;
5157
+ k8sApi = (0, k8sApi_1.getk8sApi)();
5158
+ _f.label = 1;
5159
+ case 1:
5160
+ _f.trys.push([1, 4, , 8]);
5161
+ return [4 /*yield*/, k8sApi.readNamespace(namespace)];
5162
+ case 2:
5163
+ _f.sent();
5164
+ return [4 /*yield*/, k8sApi.patchNamespace(namespace, namespaceBody, undefined, undefined, undefined, undefined, { headers: { "content-type": "application/merge-patch+json" } } // see https://github.com/kubernetes-client/javascript/issues/443
5165
+ )];
5166
+ case 3:
5167
+ _f.sent(); // update meta data
5168
+ return [3 /*break*/, 8];
5169
+ case 4:
5170
+ e_1 = _f.sent();
5171
+ if (!(((_d = (_c = e_1.response) === null || _c === void 0 ? void 0 : _c.body) === null || _d === void 0 ? void 0 : _d.reason) === "NotFound")) return [3 /*break*/, 6];
5172
+ return [4 /*yield*/, k8sApi.createNamespace(namespaceBody)];
5173
+ case 5:
5174
+ _f.sent();
5175
+ return [3 /*break*/, 7];
5176
+ case 6:
5177
+ console.error((_e = e_1.response) === null || _e === void 0 ? void 0 : _e.body);
5178
+ throw e_1;
5179
+ case 7: return [3 /*break*/, 8];
5180
+ case 8: return [2 /*return*/, namespace];
5181
+ }
5182
+ });
5183
+ });
5184
+ }
5185
+ exports["default"] = default_1;
5186
+ //# sourceMappingURL=ensureNamespace.js.map
5187
+
5188
+ /***/ }),
5189
+
5190
+ /***/ 43605:
5138
5191
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
5139
5192
 
5140
5193
  "use strict";
@@ -6025,7 +6078,9 @@ var migrateSecrets = function (vorpal, newConfig, oldEnv) { return __awaiter(voi
6025
6078
  case 0: return [4 /*yield*/, (0, pipeline_1.getEnvironment)(newConfig, componentName, newEnv)];
6026
6079
  case 1:
6027
6080
  environment = _a.sent();
6028
- return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(vorpal, (0, lodash_1.pick)(secrets_1, environment.secretEnvVarKeys), newEnv, componentName)];
6081
+ return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(vorpal, (0, lodash_1.pick)(secrets_1, environment.secretEnvVarKeys
6082
+ .filter(function (k) { return !k.hidden; })
6083
+ .map(function (k) { return k.key; })), newEnv, componentName)];
6029
6084
  case 2:
6030
6085
  _a.sent();
6031
6086
  return [2 /*return*/];
@@ -130122,7 +130177,7 @@ module.exports = (stack, options) => {
130122
130177
 
130123
130178
  "use strict";
130124
130179
 
130125
- var restoreCursor = __nccwpck_require__(74390);
130180
+ var restoreCursor = __nccwpck_require__(17301);
130126
130181
  var hidden = false;
130127
130182
 
130128
130183
  exports.show = function () {
@@ -130149,6 +130204,62 @@ exports.toggle = function (force) {
130149
130204
  };
130150
130205
 
130151
130206
 
130207
+ /***/ }),
130208
+
130209
+ /***/ 17677:
130210
+ /***/ ((module) => {
130211
+
130212
+ "use strict";
130213
+
130214
+ module.exports = function (fn, errMsg) {
130215
+ if (typeof fn !== 'function') {
130216
+ throw new TypeError('Expected a function');
130217
+ }
130218
+
130219
+ var ret;
130220
+ var called = false;
130221
+ var fnName = fn.displayName || fn.name || (/function ([^\(]+)/.exec(fn.toString()) || [])[1];
130222
+
130223
+ var onetime = function () {
130224
+ if (called) {
130225
+ if (errMsg === true) {
130226
+ fnName = fnName ? fnName + '()' : 'Function';
130227
+ throw new Error(fnName + ' can only be called once.');
130228
+ }
130229
+
130230
+ return ret;
130231
+ }
130232
+
130233
+ called = true;
130234
+ ret = fn.apply(this, arguments);
130235
+ fn = null;
130236
+
130237
+ return ret;
130238
+ };
130239
+
130240
+ onetime.displayName = fnName;
130241
+
130242
+ return onetime;
130243
+ };
130244
+
130245
+
130246
+ /***/ }),
130247
+
130248
+ /***/ 17301:
130249
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
130250
+
130251
+ "use strict";
130252
+
130253
+ var onetime = __nccwpck_require__(17677);
130254
+ var exitHook = __nccwpck_require__(24793);
130255
+
130256
+ module.exports = onetime(function () {
130257
+ exitHook(function () {
130258
+ process.stdout.write('\u001b[?25h');
130259
+ });
130260
+ });
130261
+
130262
+
130152
130263
  /***/ }),
130153
130264
 
130154
130265
  /***/ 89992:
@@ -178742,60 +178853,6 @@ module.exports = () => {
178742
178853
  };
178743
178854
 
178744
178855
 
178745
- /***/ }),
178746
-
178747
- /***/ 48504:
178748
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
178749
-
178750
- "use strict";
178751
-
178752
- var numberIsNan = __nccwpck_require__(68955);
178753
-
178754
- module.exports = function (x) {
178755
- if (numberIsNan(x)) {
178756
- return false;
178757
- }
178758
-
178759
- // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369
178760
-
178761
- // code points are derived from:
178762
- // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
178763
- if (x >= 0x1100 && (
178764
- x <= 0x115f || // Hangul Jamo
178765
- 0x2329 === x || // LEFT-POINTING ANGLE BRACKET
178766
- 0x232a === x || // RIGHT-POINTING ANGLE BRACKET
178767
- // CJK Radicals Supplement .. Enclosed CJK Letters and Months
178768
- (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
178769
- // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
178770
- 0x3250 <= x && x <= 0x4dbf ||
178771
- // CJK Unified Ideographs .. Yi Radicals
178772
- 0x4e00 <= x && x <= 0xa4c6 ||
178773
- // Hangul Jamo Extended-A
178774
- 0xa960 <= x && x <= 0xa97c ||
178775
- // Hangul Syllables
178776
- 0xac00 <= x && x <= 0xd7a3 ||
178777
- // CJK Compatibility Ideographs
178778
- 0xf900 <= x && x <= 0xfaff ||
178779
- // Vertical Forms
178780
- 0xfe10 <= x && x <= 0xfe19 ||
178781
- // CJK Compatibility Forms .. Small Form Variants
178782
- 0xfe30 <= x && x <= 0xfe6b ||
178783
- // Halfwidth and Fullwidth Forms
178784
- 0xff01 <= x && x <= 0xff60 ||
178785
- 0xffe0 <= x && x <= 0xffe6 ||
178786
- // Kana Supplement
178787
- 0x1b000 <= x && x <= 0x1b001 ||
178788
- // Enclosed Ideographic Supplement
178789
- 0x1f200 <= x && x <= 0x1f251 ||
178790
- // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
178791
- 0x20000 <= x && x <= 0x3fffd)) {
178792
- return true;
178793
- }
178794
-
178795
- return false;
178796
- }
178797
-
178798
-
178799
178856
  /***/ }),
178800
178857
 
178801
178858
  /***/ 86878:
@@ -210081,158 +210138,6 @@ module.exports = Keyv;
210081
210138
  }.call(this));
210082
210139
 
210083
210140
 
210084
- /***/ }),
210085
-
210086
- /***/ 12860:
210087
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
210088
-
210089
- "use strict";
210090
-
210091
- var ansiEscapes = __nccwpck_require__(11598);
210092
- var cliCursor = __nccwpck_require__(22701);
210093
-
210094
- function main(stream) {
210095
- var prevLineCount = 0;
210096
-
210097
- var render = function () {
210098
- cliCursor.hide();
210099
- var out = [].join.call(arguments, ' ') + '\n';
210100
- stream.write(ansiEscapes.eraseLines(prevLineCount) + out);
210101
- prevLineCount = out.split('\n').length;
210102
- };
210103
-
210104
- render.clear = function () {
210105
- stream.write(ansiEscapes.eraseLines(prevLineCount));
210106
- prevLineCount = 0;
210107
- };
210108
-
210109
- render.done = function () {
210110
- prevLineCount = 0;
210111
- cliCursor.show();
210112
- };
210113
-
210114
- return render;
210115
- }
210116
-
210117
- module.exports = main(process.stdout);
210118
- module.exports.stderr = main(process.stderr);
210119
- module.exports.create = main;
210120
-
210121
-
210122
- /***/ }),
210123
-
210124
- /***/ 11598:
210125
- /***/ ((module) => {
210126
-
210127
- "use strict";
210128
-
210129
- var ESC = '\u001b[';
210130
- var x = module.exports;
210131
-
210132
- x.cursorTo = function (x, y) {
210133
- if (arguments.length === 0) {
210134
- return ESC + 'H';
210135
- }
210136
-
210137
- if (arguments.length === 1) {
210138
- return ESC + (x + 1) + 'G';
210139
- }
210140
-
210141
- return ESC + (y + 1) + ';' + (x + 1) + 'H';
210142
- };
210143
-
210144
- x.cursorMove = function (x, y) {
210145
- var ret = '';
210146
-
210147
- if (x < 0) {
210148
- ret += ESC + (-x) + 'D';
210149
- } else if (x > 0) {
210150
- ret += ESC + x + 'C';
210151
- }
210152
-
210153
- if (y < 0) {
210154
- ret += ESC + (-y) + 'A';
210155
- } else if (y > 0) {
210156
- ret += ESC + y + 'B';
210157
- }
210158
-
210159
- return ret;
210160
- };
210161
-
210162
- x.cursorUp = function (count) {
210163
- return ESC + (typeof count === 'number' ? count : 1) + 'A';
210164
- };
210165
-
210166
- x.cursorDown = function (count) {
210167
- return ESC + (typeof count === 'number' ? count : 1) + 'B';
210168
- };
210169
-
210170
- x.cursorForward = function (count) {
210171
- return ESC + (typeof count === 'number' ? count : 1) + 'C';
210172
- };
210173
-
210174
- x.cursorBackward = function (count) {
210175
- return ESC + (typeof count === 'number' ? count : 1) + 'D';
210176
- };
210177
-
210178
- x.cursorLeft = ESC + '1000D';
210179
- x.cursorSavePosition = ESC + 's';
210180
- x.cursorRestorePosition = ESC + 'u';
210181
- x.cursorGetPosition = ESC + '6n';
210182
- x.cursorNextLine = ESC + 'E';
210183
- x.cursorPrevLine = ESC + 'F';
210184
- x.cursorHide = ESC + '?25l';
210185
- x.cursorShow = ESC + '?25h';
210186
-
210187
- x.eraseLines = function (count) {
210188
- var clear = '';
210189
-
210190
- for (var i = 0; i < count; i++) {
210191
- clear += x.cursorLeft + x.eraseEndLine + (i < count - 1 ? x.cursorUp() : '');
210192
- }
210193
-
210194
- return clear;
210195
- };
210196
-
210197
- x.eraseEndLine = ESC + 'K';
210198
- x.eraseStartLine = ESC + '1K';
210199
- x.eraseLine = ESC + '2K';
210200
- x.eraseDown = ESC + 'J';
210201
- x.eraseUp = ESC + '1J';
210202
- x.eraseScreen = ESC + '2J';
210203
- x.scrollUp = ESC + 'S';
210204
- x.scrollDown = ESC + 'T';
210205
-
210206
- x.clearScreen = '\u001bc';
210207
- x.beep = '\u0007';
210208
-
210209
- x.image = function (buf, opts) {
210210
- opts = opts || {};
210211
-
210212
- var ret = '\u001b]1337;File=inline=1';
210213
-
210214
- if (opts.width) {
210215
- ret += ';width=' + opts.width;
210216
- }
210217
-
210218
- if (opts.height) {
210219
- ret += ';height=' + opts.height;
210220
- }
210221
-
210222
- if (opts.preserveAspectRatio === false) {
210223
- ret += ';preserveAspectRatio=0';
210224
- }
210225
-
210226
- return ret + ':' + buf.toString('base64') + '\u0007';
210227
- };
210228
-
210229
- x.iTerm = {};
210230
-
210231
- x.iTerm.setCwd = function (cwd) {
210232
- return '\u001b]50;CurrentDir=' + (cwd || process.cwd()) + '\u0007';
210233
- };
210234
-
210235
-
210236
210141
  /***/ }),
210237
210142
 
210238
210143
  /***/ 64633:
@@ -212236,27 +212141,6 @@ function populateMaps (extensions, types) {
212236
212141
  }
212237
212142
 
212238
212143
 
212239
- /***/ }),
212240
-
212241
- /***/ 43471:
212242
- /***/ ((module) => {
212243
-
212244
- "use strict";
212245
-
212246
-
212247
- const mimicFn = (to, from) => {
212248
- for (const prop of Reflect.ownKeys(from)) {
212249
- Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
212250
- }
212251
-
212252
- return to;
212253
- };
212254
-
212255
- module.exports = mimicFn;
212256
- // TODO: Remove this for the next major release
212257
- module.exports["default"] = mimicFn;
212258
-
212259
-
212260
212144
  /***/ }),
212261
212145
 
212262
212146
  /***/ 21963:
@@ -220390,7 +220274,7 @@ function onceStrict (fn) {
220390
220274
 
220391
220275
  "use strict";
220392
220276
 
220393
- const mimicFn = __nccwpck_require__(43471);
220277
+ const mimicFn = __nccwpck_require__(60283);
220394
220278
 
220395
220279
  const calledFunctions = new WeakMap();
220396
220280
 
@@ -220435,6 +220319,27 @@ module.exports.callCount = function_ => {
220435
220319
  };
220436
220320
 
220437
220321
 
220322
+ /***/ }),
220323
+
220324
+ /***/ 60283:
220325
+ /***/ ((module) => {
220326
+
220327
+ "use strict";
220328
+
220329
+
220330
+ const mimicFn = (to, from) => {
220331
+ for (const prop of Reflect.ownKeys(from)) {
220332
+ Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
220333
+ }
220334
+
220335
+ return to;
220336
+ };
220337
+
220338
+ module.exports = mimicFn;
220339
+ // TODO: Remove this for the next major release
220340
+ module.exports["default"] = mimicFn;
220341
+
220342
+
220438
220343
  /***/ }),
220439
220344
 
220440
220345
  /***/ 14247:
@@ -304117,7 +304022,7 @@ module.exports = QuickLRU;
304117
304022
  var readline = __nccwpck_require__(14521);
304118
304023
  var MuteStream = __nccwpck_require__(84778);
304119
304024
  var codePointAt = __nccwpck_require__(62257);
304120
- var isFullwidthCodePoint = __nccwpck_require__(48504);
304025
+ var isFullwidthCodePoint = __nccwpck_require__(29535);
304121
304026
 
304122
304027
  var Interface = module.exports = {};
304123
304028
 
@@ -304236,6 +304141,60 @@ function stripVTControlCharacters (str) {
304236
304141
  }
304237
304142
 
304238
304143
 
304144
+ /***/ }),
304145
+
304146
+ /***/ 29535:
304147
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
304148
+
304149
+ "use strict";
304150
+
304151
+ var numberIsNan = __nccwpck_require__(68955);
304152
+
304153
+ module.exports = function (x) {
304154
+ if (numberIsNan(x)) {
304155
+ return false;
304156
+ }
304157
+
304158
+ // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369
304159
+
304160
+ // code points are derived from:
304161
+ // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
304162
+ if (x >= 0x1100 && (
304163
+ x <= 0x115f || // Hangul Jamo
304164
+ 0x2329 === x || // LEFT-POINTING ANGLE BRACKET
304165
+ 0x232a === x || // RIGHT-POINTING ANGLE BRACKET
304166
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
304167
+ (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
304168
+ // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
304169
+ 0x3250 <= x && x <= 0x4dbf ||
304170
+ // CJK Unified Ideographs .. Yi Radicals
304171
+ 0x4e00 <= x && x <= 0xa4c6 ||
304172
+ // Hangul Jamo Extended-A
304173
+ 0xa960 <= x && x <= 0xa97c ||
304174
+ // Hangul Syllables
304175
+ 0xac00 <= x && x <= 0xd7a3 ||
304176
+ // CJK Compatibility Ideographs
304177
+ 0xf900 <= x && x <= 0xfaff ||
304178
+ // Vertical Forms
304179
+ 0xfe10 <= x && x <= 0xfe19 ||
304180
+ // CJK Compatibility Forms .. Small Form Variants
304181
+ 0xfe30 <= x && x <= 0xfe6b ||
304182
+ // Halfwidth and Fullwidth Forms
304183
+ 0xff01 <= x && x <= 0xff60 ||
304184
+ 0xffe0 <= x && x <= 0xffe6 ||
304185
+ // Kana Supplement
304186
+ 0x1b000 <= x && x <= 0x1b001 ||
304187
+ // Enclosed Ideographic Supplement
304188
+ 0x1f200 <= x && x <= 0x1f251 ||
304189
+ // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
304190
+ 0x20000 <= x && x <= 0x3fffd)) {
304191
+ return true;
304192
+ }
304193
+
304194
+ return false;
304195
+ }
304196
+
304197
+
304239
304198
  /***/ }),
304240
304199
 
304241
304200
  /***/ 12757:
@@ -307905,62 +307864,6 @@ class Response extends Readable {
307905
307864
  module.exports = Response;
307906
307865
 
307907
307866
 
307908
- /***/ }),
307909
-
307910
- /***/ 74390:
307911
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
307912
-
307913
- "use strict";
307914
-
307915
- var onetime = __nccwpck_require__(38197);
307916
- var exitHook = __nccwpck_require__(24793);
307917
-
307918
- module.exports = onetime(function () {
307919
- exitHook(function () {
307920
- process.stdout.write('\u001b[?25h');
307921
- });
307922
- });
307923
-
307924
-
307925
- /***/ }),
307926
-
307927
- /***/ 38197:
307928
- /***/ ((module) => {
307929
-
307930
- "use strict";
307931
-
307932
- module.exports = function (fn, errMsg) {
307933
- if (typeof fn !== 'function') {
307934
- throw new TypeError('Expected a function');
307935
- }
307936
-
307937
- var ret;
307938
- var called = false;
307939
- var fnName = fn.displayName || fn.name || (/function ([^\(]+)/.exec(fn.toString()) || [])[1];
307940
-
307941
- var onetime = function () {
307942
- if (called) {
307943
- if (errMsg === true) {
307944
- fnName = fnName ? fnName + '()' : 'Function';
307945
- throw new Error(fnName + ' can only be called once.');
307946
- }
307947
-
307948
- return ret;
307949
- }
307950
-
307951
- called = true;
307952
- ret = fn.apply(this, arguments);
307953
- fn = null;
307954
-
307955
- return ret;
307956
- };
307957
-
307958
- onetime.displayName = fnName;
307959
-
307960
- return onetime;
307961
- };
307962
-
307963
-
307964
307867
  /***/ }),
307965
307868
 
307966
307869
  /***/ 6716:
@@ -342300,7 +342203,7 @@ var inquirer = __nccwpck_require__(8622);
342300
342203
  var EventEmitter = (__nccwpck_require__(82361).EventEmitter);
342301
342204
  var chalk = __nccwpck_require__(48173);
342302
342205
  var util = __nccwpck_require__(29821);
342303
- var logUpdate = __nccwpck_require__(12860);
342206
+ var logUpdate = __nccwpck_require__(75758);
342304
342207
 
342305
342208
  var UI = function (_EventEmitter) {
342306
342209
  _inherits(UI, _EventEmitter);
@@ -344706,6 +344609,120 @@ Object.defineProperty(vorpal, 'activeCommand', {
344706
344609
  }
344707
344610
  });
344708
344611
 
344612
+ /***/ }),
344613
+
344614
+ /***/ 37374:
344615
+ /***/ ((module) => {
344616
+
344617
+ "use strict";
344618
+
344619
+ var ESC = '\u001b[';
344620
+ var x = module.exports;
344621
+
344622
+ x.cursorTo = function (x, y) {
344623
+ if (arguments.length === 0) {
344624
+ return ESC + 'H';
344625
+ }
344626
+
344627
+ if (arguments.length === 1) {
344628
+ return ESC + (x + 1) + 'G';
344629
+ }
344630
+
344631
+ return ESC + (y + 1) + ';' + (x + 1) + 'H';
344632
+ };
344633
+
344634
+ x.cursorMove = function (x, y) {
344635
+ var ret = '';
344636
+
344637
+ if (x < 0) {
344638
+ ret += ESC + (-x) + 'D';
344639
+ } else if (x > 0) {
344640
+ ret += ESC + x + 'C';
344641
+ }
344642
+
344643
+ if (y < 0) {
344644
+ ret += ESC + (-y) + 'A';
344645
+ } else if (y > 0) {
344646
+ ret += ESC + y + 'B';
344647
+ }
344648
+
344649
+ return ret;
344650
+ };
344651
+
344652
+ x.cursorUp = function (count) {
344653
+ return ESC + (typeof count === 'number' ? count : 1) + 'A';
344654
+ };
344655
+
344656
+ x.cursorDown = function (count) {
344657
+ return ESC + (typeof count === 'number' ? count : 1) + 'B';
344658
+ };
344659
+
344660
+ x.cursorForward = function (count) {
344661
+ return ESC + (typeof count === 'number' ? count : 1) + 'C';
344662
+ };
344663
+
344664
+ x.cursorBackward = function (count) {
344665
+ return ESC + (typeof count === 'number' ? count : 1) + 'D';
344666
+ };
344667
+
344668
+ x.cursorLeft = ESC + '1000D';
344669
+ x.cursorSavePosition = ESC + 's';
344670
+ x.cursorRestorePosition = ESC + 'u';
344671
+ x.cursorGetPosition = ESC + '6n';
344672
+ x.cursorNextLine = ESC + 'E';
344673
+ x.cursorPrevLine = ESC + 'F';
344674
+ x.cursorHide = ESC + '?25l';
344675
+ x.cursorShow = ESC + '?25h';
344676
+
344677
+ x.eraseLines = function (count) {
344678
+ var clear = '';
344679
+
344680
+ for (var i = 0; i < count; i++) {
344681
+ clear += x.cursorLeft + x.eraseEndLine + (i < count - 1 ? x.cursorUp() : '');
344682
+ }
344683
+
344684
+ return clear;
344685
+ };
344686
+
344687
+ x.eraseEndLine = ESC + 'K';
344688
+ x.eraseStartLine = ESC + '1K';
344689
+ x.eraseLine = ESC + '2K';
344690
+ x.eraseDown = ESC + 'J';
344691
+ x.eraseUp = ESC + '1J';
344692
+ x.eraseScreen = ESC + '2J';
344693
+ x.scrollUp = ESC + 'S';
344694
+ x.scrollDown = ESC + 'T';
344695
+
344696
+ x.clearScreen = '\u001bc';
344697
+ x.beep = '\u0007';
344698
+
344699
+ x.image = function (buf, opts) {
344700
+ opts = opts || {};
344701
+
344702
+ var ret = '\u001b]1337;File=inline=1';
344703
+
344704
+ if (opts.width) {
344705
+ ret += ';width=' + opts.width;
344706
+ }
344707
+
344708
+ if (opts.height) {
344709
+ ret += ';height=' + opts.height;
344710
+ }
344711
+
344712
+ if (opts.preserveAspectRatio === false) {
344713
+ ret += ';preserveAspectRatio=0';
344714
+ }
344715
+
344716
+ return ret + ':' + buf.toString('base64') + '\u0007';
344717
+ };
344718
+
344719
+ x.iTerm = {};
344720
+
344721
+ x.iTerm.setCwd = function (cwd) {
344722
+ return '\u001b]50;CurrentDir=' + (cwd || process.cwd()) + '\u0007';
344723
+ };
344724
+
344725
+
344709
344726
  /***/ }),
344710
344727
 
344711
344728
  /***/ 96901:
@@ -344916,6 +344933,98 @@ module.exports.stripColor = stripAnsi;
344916
344933
  module.exports.supportsColor = supportsColor;
344917
344934
 
344918
344935
 
344936
+ /***/ }),
344937
+
344938
+ /***/ 26666:
344939
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
344940
+
344941
+ "use strict";
344942
+
344943
+ var numberIsNan = __nccwpck_require__(68955);
344944
+
344945
+ module.exports = function (x) {
344946
+ if (numberIsNan(x)) {
344947
+ return false;
344948
+ }
344949
+
344950
+ // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369
344951
+
344952
+ // code points are derived from:
344953
+ // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
344954
+ if (x >= 0x1100 && (
344955
+ x <= 0x115f || // Hangul Jamo
344956
+ 0x2329 === x || // LEFT-POINTING ANGLE BRACKET
344957
+ 0x232a === x || // RIGHT-POINTING ANGLE BRACKET
344958
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
344959
+ (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
344960
+ // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
344961
+ 0x3250 <= x && x <= 0x4dbf ||
344962
+ // CJK Unified Ideographs .. Yi Radicals
344963
+ 0x4e00 <= x && x <= 0xa4c6 ||
344964
+ // Hangul Jamo Extended-A
344965
+ 0xa960 <= x && x <= 0xa97c ||
344966
+ // Hangul Syllables
344967
+ 0xac00 <= x && x <= 0xd7a3 ||
344968
+ // CJK Compatibility Ideographs
344969
+ 0xf900 <= x && x <= 0xfaff ||
344970
+ // Vertical Forms
344971
+ 0xfe10 <= x && x <= 0xfe19 ||
344972
+ // CJK Compatibility Forms .. Small Form Variants
344973
+ 0xfe30 <= x && x <= 0xfe6b ||
344974
+ // Halfwidth and Fullwidth Forms
344975
+ 0xff01 <= x && x <= 0xff60 ||
344976
+ 0xffe0 <= x && x <= 0xffe6 ||
344977
+ // Kana Supplement
344978
+ 0x1b000 <= x && x <= 0x1b001 ||
344979
+ // Enclosed Ideographic Supplement
344980
+ 0x1f200 <= x && x <= 0x1f251 ||
344981
+ // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
344982
+ 0x20000 <= x && x <= 0x3fffd)) {
344983
+ return true;
344984
+ }
344985
+
344986
+ return false;
344987
+ }
344988
+
344989
+
344990
+ /***/ }),
344991
+
344992
+ /***/ 75758:
344993
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
344994
+
344995
+ "use strict";
344996
+
344997
+ var ansiEscapes = __nccwpck_require__(37374);
344998
+ var cliCursor = __nccwpck_require__(22701);
344999
+
345000
+ function main(stream) {
345001
+ var prevLineCount = 0;
345002
+
345003
+ var render = function () {
345004
+ cliCursor.hide();
345005
+ var out = [].join.call(arguments, ' ') + '\n';
345006
+ stream.write(ansiEscapes.eraseLines(prevLineCount) + out);
345007
+ prevLineCount = out.split('\n').length;
345008
+ };
345009
+
345010
+ render.clear = function () {
345011
+ stream.write(ansiEscapes.eraseLines(prevLineCount));
345012
+ prevLineCount = 0;
345013
+ };
345014
+
345015
+ render.done = function () {
345016
+ prevLineCount = 0;
345017
+ cliCursor.show();
345018
+ };
345019
+
345020
+ return render;
345021
+ }
345022
+
345023
+ module.exports = main(process.stdout);
345024
+ module.exports.stderr = main(process.stderr);
345025
+ module.exports.create = main;
345026
+
345027
+
344919
345028
  /***/ }),
344920
345029
 
344921
345030
  /***/ 61389:
@@ -344925,7 +345034,7 @@ module.exports.supportsColor = supportsColor;
344925
345034
 
344926
345035
  var stripAnsi = __nccwpck_require__(87668);
344927
345036
  var codePointAt = __nccwpck_require__(62257);
344928
- var isFullwidthCodePoint = __nccwpck_require__(48504);
345037
+ var isFullwidthCodePoint = __nccwpck_require__(26666);
344929
345038
 
344930
345039
  // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345
344931
345040
  module.exports = function (str) {
@@ -350144,6 +350253,7 @@ var createCustomBuildJobs = function (context) {
350144
350253
  var appBuildJob = buildConfig.buildCommand !== null ? (0, createBuildJob_1.createBuildJob)(context, {
350145
350254
  image: buildConfig.jobImage,
350146
350255
  variables: __assign({}, RUNNER_BUILD_VARIABLES),
350256
+ cache: buildConfig.jobCache,
350147
350257
  services: buildConfig.jobServices,
350148
350258
  script: __spreadArray([], __read((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : []), false),
350149
350259
  artifacts: {
@@ -350304,18 +350414,22 @@ var requiresDockerBuild = function (context) {
350304
350414
  return false;
350305
350415
  };
350306
350416
  exports.requiresDockerBuild = requiresDockerBuild;
350417
+ var getDockerBaseVariables = function () {
350418
+ return {
350419
+ DOCKER_HOST: "tcp://0.0.0.0:2375",
350420
+ DOCKER_TLS_CERTDIR: "",
350421
+ DOCKER_DRIVER: "overlay2",
350422
+ DOCKER_BUILDKIT: "1"
350423
+ };
350424
+ };
350307
350425
  var getDockerBuildVariables = function (context) {
350308
350426
  var _a, _b, _c, _d;
350309
- return __assign(__assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
350310
- DOCKER_BUILDKIT: "1",
350427
+ return __assign(__assign(__assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
350311
350428
  DOCKERFILE_ADDITIONS: (_b = (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"),
350312
350429
  DOCKERFILE_ADDITIONS_END: (_d = (_c = context.componentConfig.build.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"),
350313
350430
  APP_DIR: context.componentConfig.dir,
350314
- DOCKER_HOST: "tcp://0.0.0.0:2375",
350315
- DOCKER_TLS_CERTDIR: "",
350316
- DOCKER_DIR: ".",
350317
- DOCKER_DRIVER: "overlay2"
350318
- }), (0, exports.getDockerImageVariables)(context));
350431
+ DOCKER_DIR: "."
350432
+ }), getDockerBaseVariables()), (0, exports.getDockerImageVariables)(context));
350319
350433
  };
350320
350434
  exports.getDockerBuildVariables = getDockerBuildVariables;
350321
350435
  exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
@@ -350326,7 +350440,7 @@ var getDockerJobBaseProps = function (context) {
350326
350440
  name: "docker:20-dind",
350327
350441
  command: ["--tls=false"]
350328
350442
  }],
350329
- variables: (0, exports.getDockerBuildVariables)(context)
350443
+ variables: getDockerBaseVariables()
350330
350444
  };
350331
350445
  };
350332
350446
  exports.getDockerJobBaseProps = getDockerJobBaseProps;
@@ -350339,7 +350453,9 @@ var createDockerBuildJobBase = function (context, _a) {
350339
350453
  stage: "build"
350340
350454
  }, (0, exports.getDockerJobBaseProps)(context)), {
350341
350455
  script: script || []
350342
- }), def);
350456
+ }), {
350457
+ variables: (0, exports.getDockerBuildVariables)(context)
350458
+ }, def);
350343
350459
  };
350344
350460
  exports.createDockerBuildJobBase = createDockerBuildJobBase;
350345
350461
  exports.gitlabDockerLogin = "docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY";
@@ -350425,7 +350541,13 @@ exports.BUILD_TYPES = {
350425
350541
  rails: {
350426
350542
  jobs: rails_1.createRailsJobs,
350427
350543
  defaults: function () {
350428
- return {};
350544
+ return {
350545
+ startCommand: "/cnb/process/web",
350546
+ cnbBuilder: {
350547
+ image: "heroku/buildpacks:20",
350548
+ packVersion: "0.28.0"
350549
+ }
350550
+ };
350429
350551
  }
350430
350552
  }
350431
350553
  };
@@ -350955,31 +351077,52 @@ exports.getYarnInstall = getYarnInstall;
350955
351077
  "use strict";
350956
351078
 
350957
351079
 
350958
- var __assign = this && this.__assign || function () {
350959
- __assign = Object.assign || function (t) {
350960
- for (var s, i = 1, n = arguments.length; i < n; i++) {
350961
- s = arguments[i];
350962
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
351080
+ var __read = this && this.__read || function (o, n) {
351081
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
351082
+ if (!m) return o;
351083
+ var i = m.call(o),
351084
+ r,
351085
+ ar = [],
351086
+ e;
351087
+ try {
351088
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
351089
+ } catch (error) {
351090
+ e = {
351091
+ error: error
351092
+ };
351093
+ } finally {
351094
+ try {
351095
+ if (r && !r.done && (m = i["return"])) m.call(i);
351096
+ } finally {
351097
+ if (e) throw e.error;
350963
351098
  }
350964
- return t;
350965
- };
350966
- return __assign.apply(this, arguments);
351099
+ }
351100
+ return ar;
350967
351101
  };
350968
351102
  exports.__esModule = true;
350969
351103
  exports.createRailsBuildJobs = void 0;
351104
+ var types_1 = __nccwpck_require__(71197);
350970
351105
  var docker_1 = __nccwpck_require__(33219);
350971
351106
  var createRailsBuildJobs = function (context) {
351107
+ var _a, _b, _c;
351108
+ var buildConfig = context.componentConfig.build;
351109
+ if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
351110
+ // should not happen
351111
+ throw new Error("build type is not rails");
351112
+ }
351113
+ var cnbConf = buildConfig.cnbBuilder;
351114
+ var packEnvArgs = Object.entries((_a = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.buildVars) !== null && _a !== void 0 ? _a : {}).map(function (_a) {
351115
+ var _b = __read(_a, 2),
351116
+ k = _b[0],
351117
+ v = _b[1];
351118
+ return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
351119
+ }).join(" ");
350972
351120
  return [(0, docker_1.createDockerBuildJobBase)(context, {
350973
- variables: __assign({
350974
- CNB_BUILDER: "heroku/buildpacks:18",
350975
- CNB_ENV_VARS: "BUNDLE_GIT__PANTER__CH",
350976
- CNB_EXTRA_ARGS: "",
350977
- CNB_PACK_VERSION: "0.20.0"
350978
- }, context.componentConfig.build.extraVars),
351121
+ variables: context.componentConfig.build.extraVars,
350979
351122
  // custom script
350980
- script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v$CNB_PACK_VERSION/pack-v$CNB_PACK_VERSION-linux.tgz | tar -zx --directory /usr/local/bin pack", "chmod +x /usr/local/bin/pack",
351123
+ script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
350981
351124
  // replace private git ssh gem sources with https to make bundler with credentials via env var work
350982
- "sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "for v in $CNB_ENV_VARS; do env_args=\"$env_args --env $v\"; done", "pack build $DOCKER_IMAGE:$DOCKER_IMAGE_TAG --builder $CNB_BUILDER --publish --cache-image $DOCKER_CACHE_IMAGE $env_args $CNB_EXTRA_ARGS"]
351125
+ "sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")]
350983
351126
  })];
350984
351127
  };
350985
351128
  exports.createRailsBuildJobs = createRailsBuildJobs;
@@ -351103,9 +351246,8 @@ var createRailsTestJobs = function (context) {
351103
351246
  var bundlerCache = {
351104
351247
  key: {
351105
351248
  files: ["Gemfile.lock"],
351106
- prefix: "$CI_JOB_IMAGE" // a changed image might have different OS libraries which no longer work with the cached gems
351249
+ prefix: "$CI_JOB_IMAGE"
351107
351250
  },
351108
-
351109
351251
  paths: [bundlerCacheDir]
351110
351252
  };
351111
351253
  var auditJob = buildConfig.audit !== false ? __assign(__assign({
@@ -351326,7 +351468,7 @@ exports.readConfigSync = readConfigSync;
351326
351468
 
351327
351469
  exports.__esModule = true;
351328
351470
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
351329
- exports.PIPELINE_IMAGE_TAG = "fix-command-710f75f1" || 0;
351471
+ exports.PIPELINE_IMAGE_TAG = "fix-error-sql-db-delete-b3878c2e" || 0;
351330
351472
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
351331
351473
 
351332
351474
  /***/ }),
@@ -351521,6 +351663,7 @@ var getEnvironment = function (config, componentName, env, commitInfo) {
351521
351663
  url: url
351522
351664
  },
351523
351665
  fullName: envContext.fullName,
351666
+ slugPrefix: envContext.environmentSlugPrefix,
351524
351667
  slug: envContext.environmentSlug,
351525
351668
  shortName: env,
351526
351669
  envVars: envVars,
@@ -351544,20 +351687,22 @@ exports.__esModule = true;
351544
351687
  exports.getEnvironmentContext = void 0;
351545
351688
  var getEnvConfig_1 = __nccwpck_require__(25706);
351546
351689
  var getEnvType_1 = __nccwpck_require__(94811);
351547
- var getEnvironmentSlug = function (envConfig, env, componentName, commitInfo) {
351690
+ var getEnvironmentSlugPrefix = function (envConfig, env, commitInfo) {
351548
351691
  var envType = (0, getEnvType_1.getEnvType)(env, envConfig);
351549
- return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
351692
+ return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug) : "".concat(env);
351550
351693
  };
351551
351694
  var getEnvironmentContext = function (config, env, componentName, commitInfo) {
351552
351695
  var envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env);
351553
351696
  var envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw);
351554
- var environmentSlug = getEnvironmentSlug(envConfigRaw, env, componentName, commitInfo);
351697
+ var environmentSlugPrefix = getEnvironmentSlugPrefix(envConfigRaw, env, commitInfo);
351698
+ var environmentSlug = "".concat(environmentSlugPrefix, "-").concat(componentName);
351555
351699
  var gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
351556
351700
  var fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
351557
351701
  return {
351558
351702
  envConfigRaw: envConfigRaw,
351559
351703
  deployConfigRaw: envConfigRaw.deploy,
351560
351704
  buildConfigRaw: envConfigRaw.build,
351705
+ environmentSlugPrefix: environmentSlugPrefix,
351561
351706
  environmentSlug: environmentSlug,
351562
351707
  gitlabEnvironmentName: gitlabEnvironmentName,
351563
351708
  fullName: fullName,
@@ -351780,8 +351925,13 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
351780
351925
  }
351781
351926
  publicEnvVarsRaw = (_e = (_d = envConfigRaw.vars) === null || _d === void 0 ? void 0 : _d.public) !== null && _e !== void 0 ? _e : {};
351782
351927
  additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
351783
- 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);
351784
- secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
351928
+ secretEnvVarKeys = __spreadArray(__spreadArray([], __read(((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []).map(function (key) {
351929
+ return {
351930
+ key: key
351931
+ };
351932
+ })), false), __read(additionalSecretKeys), false);
351933
+ secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (_a) {
351934
+ var key = _a.key;
351785
351935
  return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
351786
351936
  }));
351787
351937
  legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
@@ -352385,7 +352535,7 @@ var getBaseDeploymentJob = function (context) {
352385
352535
  return {
352386
352536
  name: exports.DEPLOY_JOB_NAME,
352387
352537
  envMode: "stagePerEnv",
352388
- needsOtherComponent: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
352538
+ needs: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
352389
352539
  return {
352390
352540
  componentName: c,
352391
352541
  job: exports.DEPLOY_JOB_NAME,
@@ -352761,15 +352911,15 @@ var jobName_1 = __nccwpck_require__(77311);
352761
352911
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
352762
352912
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
352763
352913
  var getCloudSqlVariables = function (_a) {
352764
- var _b, _c, _d;
352914
+ var _b, _c, _d, _e;
352765
352915
  var deployConfigRaw = _a.deployConfigRaw,
352766
- environmentSlug = _a.environmentSlug,
352916
+ environmentSlugPrefix = _a.environmentSlugPrefix,
352767
352917
  env = _a.env,
352768
352918
  componentName = _a.componentName,
352769
352919
  fullConfig = _a.fullConfig;
352770
352920
  if (deployConfigRaw && deployConfigRaw.cloudSql) {
352771
- var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlug].filter(Boolean).join("-");
352772
- var additionalQueryParamsString = Object.entries((_c = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _c !== void 0 ? _c : {}).map(function (_a) {
352921
+ var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_c = deployConfigRaw.cloudSql.dbBaseName) !== null && _c !== void 0 ? _c : componentName].filter(Boolean).join("-");
352922
+ var additionalQueryParamsString = Object.entries((_d = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _d !== void 0 ? _d : {}).map(function (_a) {
352773
352923
  var _b = __read(_a, 2),
352774
352924
  key = _b[0],
352775
352925
  value = _b[1];
@@ -352778,7 +352928,7 @@ var getCloudSqlVariables = function (_a) {
352778
352928
  return {
352779
352929
  CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
352780
352930
  DB_NAME: DB_NAME,
352781
- DB_USER: (_d = deployConfigRaw.cloudSql.dbUser) !== null && _d !== void 0 ? _d : "postgres",
352931
+ DB_USER: (_e = deployConfigRaw.cloudSql.dbUser) !== null && _e !== void 0 ? _e : "postgres",
352782
352932
  DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
352783
352933
  DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME".concat(additionalQueryParamsString),
352784
352934
  DATABASE_JDBC_URL: "jdbc:postgresql:///$DB_NAME?cloudSqlInstance=$CLOUD_SQL_INSTANCE_CONNECTION_NAME&socketFactory=com.google.cloud.sql.postgres.SocketFactory&user=$DB_USER&password=$DB_PASSWORD".concat(additionalQueryParamsString)
@@ -352801,7 +352951,15 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
352801
352951
  return {};
352802
352952
  },
352803
352953
  additionalSecretKeys: function (ctx) {
352804
- return __spreadArray([exports.GCLOUD_DEPLOY_CREDENTIALS_KEY], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? ["DB_PASSWORD"] : []), false);
352954
+ return __spreadArray([{
352955
+ key: exports.GCLOUD_DEPLOY_CREDENTIALS_KEY,
352956
+ hidden: true
352957
+ }, {
352958
+ key: exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX,
352959
+ hidden: true
352960
+ }], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? [{
352961
+ key: "DB_PASSWORD"
352962
+ }] : []), false);
352805
352963
  },
352806
352964
  getAdditionalEnvVars: function (ctx) {
352807
352965
  var _a;
@@ -353034,7 +353192,7 @@ var runner_1 = __nccwpck_require__(55071);
353034
353192
  var base_1 = __nccwpck_require__(89177);
353035
353193
  var types_1 = __nccwpck_require__(63109);
353036
353194
  var createCustomDeployJobs = function (context) {
353037
- var _a, _b;
353195
+ var _a, _b, _c;
353038
353196
  var deployConfig = context.componentConfig.deploy;
353039
353197
  if (deployConfig === false) {
353040
353198
  return [];
@@ -353045,11 +353203,14 @@ var createCustomDeployJobs = function (context) {
353045
353203
  }
353046
353204
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
353047
353205
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
353048
- return [(0, lodash_1.merge)({}, baseDeploymentJob, {
353206
+ return __spreadArray([(0, lodash_1.merge)({}, baseDeploymentJob, {
353049
353207
  image: (_a = deployConfig.jobImage) !== null && _a !== void 0 ? _a : (0, runner_1.getRunnerImage)("jobs-default"),
353050
353208
  cache: (_b = deployConfig.jobCache) !== null && _b !== void 0 ? _b : [],
353051
353209
  script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(deployConfig.requiresYarnInstall ? yarnInstall : []), false), __read(deployConfig.script), false)
353052
- })];
353210
+ })], __read(deployConfig.stopScript ? [(0, lodash_1.merge)({}, (0, base_1.getBaseDeploymentStopJob)(context), {
353211
+ image: (_c = deployConfig.jobImage) !== null && _c !== void 0 ? _c : (0, runner_1.getRunnerImage)("jobs-default"),
353212
+ script: deployConfig.stopScript
353213
+ })] : []), false);
353053
353214
  };
353054
353215
  exports.createCustomDeployJobs = createCustomDeployJobs;
353055
353216
 
@@ -353199,7 +353360,11 @@ var additionalKubernetesSecretKeys = function (_a) {
353199
353360
  keys.push("POSTGRESQL_PASSWORD");
353200
353361
  keys.push("cloudsqlProxyCredentials");
353201
353362
  }
353202
- return keys;
353363
+ return keys.map(function (key) {
353364
+ return {
353365
+ key: key
353366
+ };
353367
+ });
353203
353368
  };
353204
353369
  exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
353205
353370
 
@@ -353299,7 +353464,7 @@ var base_1 = __nccwpck_require__(89177);
353299
353464
  var types_1 = __nccwpck_require__(63109);
353300
353465
  var kubeValues_1 = __nccwpck_require__(1061);
353301
353466
  var createKubernetesDeployJobs = function (context) {
353302
- var _a, _b;
353467
+ var _a, _b, _c;
353303
353468
  var deployConfig = context.componentConfig.deploy;
353304
353469
  if (deployConfig === false) {
353305
353470
  return [];
@@ -353323,10 +353488,10 @@ var createKubernetesDeployJobs = function (context) {
353323
353488
  quotingType: "'",
353324
353489
  forceQuotes: true
353325
353490
  }),
353326
- HELM_GITLAB_CHART_NAME: "the-panter-chart",
353327
- HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_a = deployConfig.additionalHelmArgs) !== null && _a !== void 0 ? _a : []), false).join(" "),
353491
+ HELM_GITLAB_CHART_NAME: (_a = deployConfig.chartName) !== null && _a !== void 0 ? _a : "/helm-charts/the-panter-chart",
353492
+ HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_b = deployConfig.additionalHelmArgs) !== null && _b !== void 0 ? _b : []), false).join(" "),
353328
353493
  COMPONENT_NAME: context.componentName,
353329
- BUILD_ID: (_b = context.commitInfo) === null || _b === void 0 ? void 0 : _b.buildId
353494
+ BUILD_ID: (_c = context.commitInfo) === null || _c === void 0 ? void 0 : _c.buildId
353330
353495
  })
353331
353496
  };
353332
353497
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
@@ -353557,33 +353722,36 @@ var kubeEnv_1 = __nccwpck_require__(19449);
353557
353722
  var mongodb_1 = __nccwpck_require__(77601);
353558
353723
  var processSecretsAsFiles_1 = __nccwpck_require__(45187);
353559
353724
  var createAppConfig = function (context, application) {
353560
- var _a, _b, _c;
353561
353725
  if (application === false) {
353562
353726
  return {
353563
353727
  enabled: false
353564
353728
  };
353565
353729
  }
353730
+ var _a = application !== null && application !== void 0 ? application : {},
353731
+ healthRoute = _a.healthRoute,
353732
+ command = _a.command,
353733
+ rest = __rest(_a, ["healthRoute", "command"]);
353566
353734
  return (0, utils_1.mergeWithMergingArrays)({
353567
353735
  host: context.environment.host,
353568
- command: context.componentConfig.build.startCommand,
353736
+ command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
353569
353737
  livenessProbe: {
353570
353738
  httpGet: {
353571
- path: (_a = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _a !== void 0 ? _a : "__health"
353739
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
353572
353740
  }
353573
353741
  },
353574
353742
  readinessProbe: {
353575
353743
  httpGet: {
353576
- path: (_b = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _b !== void 0 ? _b : "__health"
353744
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
353577
353745
  }
353578
353746
  },
353579
353747
  startupProbe: {
353580
353748
  httpGet: {
353581
- path: (_c = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _c !== void 0 ? _c : "__health"
353749
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
353582
353750
  }
353583
353751
  }
353584
353752
  },
353585
353753
  // default
353586
- application // merge rest in
353754
+ rest // merge rest in
353587
353755
  );
353588
353756
  };
353589
353757
 
@@ -354194,32 +354362,404 @@ var __generator = this && this.__generator || function (thisArg, body) {
354194
354362
  }
354195
354363
  };
354196
354364
  exports.__esModule = true;
354197
- exports.getBaseCommitInfo = void 0;
354198
- var getBuildId_1 = __nccwpck_require__(60630);
354199
- var getBaseCommitInfo = function () {
354365
+ exports.getBaseCommitInfo = void 0;
354366
+ var getBuildId_1 = __nccwpck_require__(60630);
354367
+ var getBaseCommitInfo = function () {
354368
+ return __awaiter(void 0, void 0, void 0, function () {
354369
+ var _a;
354370
+ var _b;
354371
+ return __generator(this, function (_c) {
354372
+ switch (_c.label) {
354373
+ case 0:
354374
+ _a = {
354375
+ refName: (_b = process.env.CI_COMMIT_REF_NAME) !== null && _b !== void 0 ? _b : "unknown",
354376
+ reviewSlug: process.env.CI_MERGE_REQUEST_IID ? "mr".concat(process.env.CI_MERGE_REQUEST_IID) : "unknown",
354377
+ buildTime: new Date().toISOString()
354378
+ };
354379
+ return [4 /*yield*/, (0, getBuildId_1.getBuildId)()];
354380
+ case 1:
354381
+ return [2 /*return*/, (_a.buildId = _c.sent(), _a)];
354382
+ }
354383
+ });
354384
+ });
354385
+ };
354386
+ exports.getBaseCommitInfo = getBaseCommitInfo;
354387
+
354388
+ /***/ }),
354389
+
354390
+ /***/ 17052:
354391
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
354392
+
354393
+ "use strict";
354394
+
354395
+
354396
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
354397
+ function adopt(value) {
354398
+ return value instanceof P ? value : new P(function (resolve) {
354399
+ resolve(value);
354400
+ });
354401
+ }
354402
+ return new (P || (P = Promise))(function (resolve, reject) {
354403
+ function fulfilled(value) {
354404
+ try {
354405
+ step(generator.next(value));
354406
+ } catch (e) {
354407
+ reject(e);
354408
+ }
354409
+ }
354410
+ function rejected(value) {
354411
+ try {
354412
+ step(generator["throw"](value));
354413
+ } catch (e) {
354414
+ reject(e);
354415
+ }
354416
+ }
354417
+ function step(result) {
354418
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
354419
+ }
354420
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
354421
+ });
354422
+ };
354423
+ var __generator = this && this.__generator || function (thisArg, body) {
354424
+ var _ = {
354425
+ label: 0,
354426
+ sent: function () {
354427
+ if (t[0] & 1) throw t[1];
354428
+ return t[1];
354429
+ },
354430
+ trys: [],
354431
+ ops: []
354432
+ },
354433
+ f,
354434
+ y,
354435
+ t,
354436
+ g;
354437
+ return g = {
354438
+ next: verb(0),
354439
+ "throw": verb(1),
354440
+ "return": verb(2)
354441
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
354442
+ return this;
354443
+ }), g;
354444
+ function verb(n) {
354445
+ return function (v) {
354446
+ return step([n, v]);
354447
+ };
354448
+ }
354449
+ function step(op) {
354450
+ if (f) throw new TypeError("Generator is already executing.");
354451
+ while (_) try {
354452
+ 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;
354453
+ if (y = 0, t) op = [op[0] & 2, t.value];
354454
+ switch (op[0]) {
354455
+ case 0:
354456
+ case 1:
354457
+ t = op;
354458
+ break;
354459
+ case 4:
354460
+ _.label++;
354461
+ return {
354462
+ value: op[1],
354463
+ done: false
354464
+ };
354465
+ case 5:
354466
+ _.label++;
354467
+ y = op[1];
354468
+ op = [0];
354469
+ continue;
354470
+ case 7:
354471
+ op = _.ops.pop();
354472
+ _.trys.pop();
354473
+ continue;
354474
+ default:
354475
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
354476
+ _ = 0;
354477
+ continue;
354478
+ }
354479
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
354480
+ _.label = op[1];
354481
+ break;
354482
+ }
354483
+ if (op[0] === 6 && _.label < t[1]) {
354484
+ _.label = t[1];
354485
+ t = op;
354486
+ break;
354487
+ }
354488
+ if (t && _.label < t[2]) {
354489
+ _.label = t[2];
354490
+ _.ops.push(op);
354491
+ break;
354492
+ }
354493
+ if (t[2]) _.ops.pop();
354494
+ _.trys.pop();
354495
+ continue;
354496
+ }
354497
+ op = body.call(thisArg, _);
354498
+ } catch (e) {
354499
+ op = [6, e];
354500
+ y = 0;
354501
+ } finally {
354502
+ f = t = 0;
354503
+ }
354504
+ if (op[0] & 5) throw op[1];
354505
+ return {
354506
+ value: op[0] ? op[1] : void 0,
354507
+ done: true
354508
+ };
354509
+ }
354510
+ };
354511
+ exports.__esModule = true;
354512
+ exports.createAllJobs = void 0;
354513
+ var config_1 = __nccwpck_require__(33138);
354514
+ var createJobsForComponent_1 = __nccwpck_require__(80962);
354515
+ var createAllJobs = function (config, trigger) {
354516
+ return __awaiter(void 0, void 0, void 0, function () {
354517
+ var _a, _b;
354518
+ return __generator(this, function (_c) {
354519
+ switch (_c.label) {
354520
+ case 0:
354521
+ _b = (_a = Object).fromEntries;
354522
+ return [4 /*yield*/, Promise.all(Object.keys(config.components).map(function (componentName) {
354523
+ return __awaiter(void 0, void 0, void 0, function () {
354524
+ var envs, _a, _b, _c;
354525
+ return __generator(this, function (_d) {
354526
+ switch (_d.label) {
354527
+ case 0:
354528
+ envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
354529
+ _a = [componentName];
354530
+ _c = (_b = Object).fromEntries;
354531
+ return [4 /*yield*/, Promise.all(envs.map(function (env) {
354532
+ return __awaiter(void 0, void 0, void 0, function () {
354533
+ var _a;
354534
+ return __generator(this, function (_b) {
354535
+ switch (_b.label) {
354536
+ case 0:
354537
+ _a = [env];
354538
+ return [4 /*yield*/, (0, createJobsForComponent_1.createJobsForComponent)(config, componentName, env, trigger)];
354539
+ case 1:
354540
+ return [2 /*return*/, _a.concat([_b.sent()])];
354541
+ }
354542
+ });
354543
+ });
354544
+ }))];
354545
+ case 1:
354546
+ return [2 /*return*/, _a.concat([_c.apply(_b, [_d.sent()])])];
354547
+ }
354548
+ });
354549
+ });
354550
+ }))];
354551
+ case 1:
354552
+ return [2 /*return*/, _b.apply(_a, [_c.sent()])];
354553
+ }
354554
+ });
354555
+ });
354556
+ };
354557
+ exports.createAllJobs = createAllJobs;
354558
+
354559
+ /***/ }),
354560
+
354561
+ /***/ 78974:
354562
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
354563
+
354564
+ "use strict";
354565
+
354566
+
354567
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
354568
+ function adopt(value) {
354569
+ return value instanceof P ? value : new P(function (resolve) {
354570
+ resolve(value);
354571
+ });
354572
+ }
354573
+ return new (P || (P = Promise))(function (resolve, reject) {
354574
+ function fulfilled(value) {
354575
+ try {
354576
+ step(generator.next(value));
354577
+ } catch (e) {
354578
+ reject(e);
354579
+ }
354580
+ }
354581
+ function rejected(value) {
354582
+ try {
354583
+ step(generator["throw"](value));
354584
+ } catch (e) {
354585
+ reject(e);
354586
+ }
354587
+ }
354588
+ function step(result) {
354589
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
354590
+ }
354591
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
354592
+ });
354593
+ };
354594
+ var __generator = this && this.__generator || function (thisArg, body) {
354595
+ var _ = {
354596
+ label: 0,
354597
+ sent: function () {
354598
+ if (t[0] & 1) throw t[1];
354599
+ return t[1];
354600
+ },
354601
+ trys: [],
354602
+ ops: []
354603
+ },
354604
+ f,
354605
+ y,
354606
+ t,
354607
+ g;
354608
+ return g = {
354609
+ next: verb(0),
354610
+ "throw": verb(1),
354611
+ "return": verb(2)
354612
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
354613
+ return this;
354614
+ }), g;
354615
+ function verb(n) {
354616
+ return function (v) {
354617
+ return step([n, v]);
354618
+ };
354619
+ }
354620
+ function step(op) {
354621
+ if (f) throw new TypeError("Generator is already executing.");
354622
+ while (_) try {
354623
+ 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;
354624
+ if (y = 0, t) op = [op[0] & 2, t.value];
354625
+ switch (op[0]) {
354626
+ case 0:
354627
+ case 1:
354628
+ t = op;
354629
+ break;
354630
+ case 4:
354631
+ _.label++;
354632
+ return {
354633
+ value: op[1],
354634
+ done: false
354635
+ };
354636
+ case 5:
354637
+ _.label++;
354638
+ y = op[1];
354639
+ op = [0];
354640
+ continue;
354641
+ case 7:
354642
+ op = _.ops.pop();
354643
+ _.trys.pop();
354644
+ continue;
354645
+ default:
354646
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
354647
+ _ = 0;
354648
+ continue;
354649
+ }
354650
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
354651
+ _.label = op[1];
354652
+ break;
354653
+ }
354654
+ if (op[0] === 6 && _.label < t[1]) {
354655
+ _.label = t[1];
354656
+ t = op;
354657
+ break;
354658
+ }
354659
+ if (t && _.label < t[2]) {
354660
+ _.label = t[2];
354661
+ _.ops.push(op);
354662
+ break;
354663
+ }
354664
+ if (t[2]) _.ops.pop();
354665
+ _.trys.pop();
354666
+ continue;
354667
+ }
354668
+ op = body.call(thisArg, _);
354669
+ } catch (e) {
354670
+ op = [6, e];
354671
+ y = 0;
354672
+ } finally {
354673
+ f = t = 0;
354674
+ }
354675
+ if (op[0] & 5) throw op[1];
354676
+ return {
354677
+ value: op[0] ? op[1] : void 0,
354678
+ done: true
354679
+ };
354680
+ }
354681
+ };
354682
+ var __read = this && this.__read || function (o, n) {
354683
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
354684
+ if (!m) return o;
354685
+ var i = m.call(o),
354686
+ r,
354687
+ ar = [],
354688
+ e;
354689
+ try {
354690
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
354691
+ } catch (error) {
354692
+ e = {
354693
+ error: error
354694
+ };
354695
+ } finally {
354696
+ try {
354697
+ if (r && !r.done && (m = i["return"])) m.call(i);
354698
+ } finally {
354699
+ if (e) throw e.error;
354700
+ }
354701
+ }
354702
+ return ar;
354703
+ };
354704
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
354705
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
354706
+ if (ar || !(i in from)) {
354707
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
354708
+ ar[i] = from[i];
354709
+ }
354710
+ }
354711
+ return to.concat(ar || Array.prototype.slice.call(from));
354712
+ };
354713
+ exports.__esModule = true;
354714
+ exports.createChildPipeline = void 0;
354715
+ var config_1 = __nccwpck_require__(33138);
354716
+ var rules_1 = __nccwpck_require__(42020);
354717
+ var runner_1 = __nccwpck_require__(55071);
354718
+ var jobs_1 = __nccwpck_require__(62339);
354719
+ var createAllJobs_1 = __nccwpck_require__(17052);
354720
+ var createGitlabJobs_1 = __nccwpck_require__(63920);
354721
+ var createChildPipeline = function (type, trigger, config) {
354200
354722
  return __awaiter(void 0, void 0, void 0, function () {
354723
+ var jobs, allEnvs, stages, pipeline;
354201
354724
  var _a;
354202
- var _b;
354203
- return __generator(this, function (_c) {
354204
- switch (_c.label) {
354725
+ return __generator(this, function (_b) {
354726
+ switch (_b.label) {
354205
354727
  case 0:
354728
+ return [4 /*yield*/, (0, createAllJobs_1.createAllJobs)(config, trigger)];
354729
+ case 1:
354730
+ jobs = _b.sent();
354731
+ allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
354732
+ stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
354733
+ return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
354734
+ return "".concat(baseStage, " ").concat(e);
354735
+ })), false);
354736
+ }, []);
354737
+ if (!(type === "gitlab")) return [3 /*break*/, 3];
354206
354738
  _a = {
354207
- refName: (_b = process.env.CI_COMMIT_REF_NAME) !== null && _b !== void 0 ? _b : "unknown",
354208
- reviewSlug: process.env.CI_MERGE_REQUEST_IID ? "mr".concat(process.env.CI_MERGE_REQUEST_IID) : "unknown",
354209
- buildTime: new Date().toISOString()
354739
+ image: (0, runner_1.getRunnerImage)("jobs-default"),
354740
+ variables: {
354741
+ FF_USE_FASTZIP: "true"
354742
+ },
354743
+ workflow: {
354744
+ rules: rules_1.RULES_ALWAYS
354745
+ },
354746
+ stages: stages
354210
354747
  };
354211
- return [4 /*yield*/, (0, getBuildId_1.getBuildId)()];
354212
- case 1:
354213
- return [2 /*return*/, (_a.buildId = _c.sent(), _a)];
354748
+ return [4 /*yield*/, (0, createGitlabJobs_1.createGitlabJobs)(jobs)];
354749
+ case 2:
354750
+ pipeline = (_a.jobs = _b.sent(), _a);
354751
+ return [2 /*return*/, pipeline];
354752
+ case 3:
354753
+ throw new Error("".concat(type, " is not supported"));
354214
354754
  }
354215
354755
  });
354216
354756
  });
354217
354757
  };
354218
- exports.getBaseCommitInfo = getBaseCommitInfo;
354758
+ exports.createChildPipeline = createChildPipeline;
354219
354759
 
354220
354760
  /***/ }),
354221
354761
 
354222
- /***/ 78974:
354762
+ /***/ 80962:
354223
354763
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
354224
354764
 
354225
354765
  "use strict";
@@ -354350,6 +354890,14 @@ var __generator = this && this.__generator || function (thisArg, body) {
354350
354890
  };
354351
354891
  }
354352
354892
  };
354893
+ var __rest = this && this.__rest || function (s, e) {
354894
+ var t = {};
354895
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
354896
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
354897
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
354898
+ }
354899
+ return t;
354900
+ };
354353
354901
  var __read = this && this.__read || function (o, n) {
354354
354902
  var m = typeof Symbol === "function" && o[Symbol.iterator];
354355
354903
  if (!m) return o;
@@ -354382,69 +354930,67 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
354382
354930
  return to.concat(ar || Array.prototype.slice.call(from));
354383
354931
  };
354384
354932
  exports.__esModule = true;
354385
- exports.createChildPipeline = void 0;
354386
- var config_1 = __nccwpck_require__(33138);
354387
- var rules_1 = __nccwpck_require__(42020);
354388
- var runner_1 = __nccwpck_require__(55071);
354389
- var jobs_1 = __nccwpck_require__(62339);
354390
- var createJobs_1 = __nccwpck_require__(57726);
354391
- var createChildPipeline = function (type, trigger, config) {
354933
+ exports.createJobsForComponent = void 0;
354934
+ var lodash_1 = __nccwpck_require__(23255);
354935
+ var build_1 = __nccwpck_require__(73760);
354936
+ var context_1 = __nccwpck_require__(22041);
354937
+ var deploy_1 = __nccwpck_require__(90223);
354938
+ var getCommitInfo_1 = __nccwpck_require__(5923);
354939
+ var packageManager_1 = __nccwpck_require__(69168);
354940
+ var injectDefaultVarsInCustomJobs = function (context, jobs) {
354941
+ return jobs.map(function (_a) {
354942
+ var _b;
354943
+ var variables = _a.variables,
354944
+ job = __rest(_a, ["variables"]);
354945
+ return __assign({
354946
+ variables: __assign(__assign({}, (_b = context.environment.envVars) !== null && _b !== void 0 ? _b : {}), variables !== null && variables !== void 0 ? variables : {})
354947
+ }, job);
354948
+ });
354949
+ };
354950
+ var getCustomJobs = function (context) {
354951
+ if (!context.componentConfig.customJobs) {
354952
+ return [];
354953
+ }
354954
+ var rawJobs = (0, lodash_1.isFunction)(context.componentConfig.customJobs) ? context.componentConfig.customJobs(context) : context.componentConfig.customJobs;
354955
+ return injectDefaultVarsInCustomJobs(context, rawJobs);
354956
+ };
354957
+ var createRawJobs = function (context) {
354958
+ if (context.componentConfig.deploy === false) {
354959
+ return [];
354960
+ }
354961
+ var buildJobs = build_1.BUILD_TYPES[context.componentConfig.build.type].jobs(context);
354962
+ var deployJobs = deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context);
354963
+ var customJobs = getCustomJobs(context);
354964
+ return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
354965
+ };
354966
+ var createJobsForComponent = function (config, componentName, env, trigger) {
354392
354967
  return __awaiter(void 0, void 0, void 0, function () {
354393
- var components, jobs, allEnvs, stages, pipeline;
354394
- return __generator(this, function (_a) {
354395
- switch (_a.label) {
354968
+ var commitInfo, _a, packageManagerInfo, context;
354969
+ return __generator(this, function (_b) {
354970
+ switch (_b.label) {
354396
354971
  case 0:
354397
- components = Object.keys(config.components);
354398
- return [4 /*yield*/, components.reduce(function (acc, componentName) {
354399
- return __awaiter(void 0, void 0, void 0, function () {
354400
- var envs, _a, _b;
354401
- return __generator(this, function (_c) {
354402
- switch (_c.label) {
354403
- case 0:
354404
- envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
354405
- _a = [{}];
354406
- return [4 /*yield*/, acc];
354407
- case 1:
354408
- _b = [__assign.apply(void 0, _a.concat([_c.sent()]))];
354409
- return [4 /*yield*/, (0, createJobs_1.createJobs)(type, envs, config, componentName, trigger)];
354410
- case 2:
354411
- return [2 /*return*/, __assign.apply(void 0, _b.concat([_c.sent()]))];
354412
- }
354413
- });
354414
- });
354415
- }, Promise.resolve({}))];
354972
+ _a = [{}];
354973
+ return [4 /*yield*/, (0, getCommitInfo_1.getBaseCommitInfo)()];
354416
354974
  case 1:
354417
- jobs = _a.sent();
354418
- allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
354419
- stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
354420
- return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
354421
- return "".concat(baseStage, " ").concat(e);
354422
- })), false);
354423
- }, []);
354424
- if (type === "gitlab") {
354425
- pipeline = {
354426
- image: (0, runner_1.getRunnerImage)("jobs-default"),
354427
- variables: {
354428
- FF_USE_FASTZIP: "true"
354429
- },
354430
- workflow: {
354431
- rules: rules_1.RULES_ALWAYS
354432
- },
354433
- stages: stages,
354434
- jobs: jobs
354435
- };
354436
- return [2 /*return*/, pipeline];
354437
- }
354438
- throw new Error("".concat(type, " is not supported"));
354975
+ commitInfo = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([_b.sent()])), {
354976
+ trigger: trigger
354977
+ }]);
354978
+ return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
354979
+ case 2:
354980
+ packageManagerInfo = _b.sent();
354981
+ return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
354982
+ case 3:
354983
+ context = _b.sent();
354984
+ return [2 /*return*/, createRawJobs(context)];
354439
354985
  }
354440
354986
  });
354441
354987
  });
354442
354988
  };
354443
- exports.createChildPipeline = createChildPipeline;
354989
+ exports.createJobsForComponent = createJobsForComponent;
354444
354990
 
354445
354991
  /***/ }),
354446
354992
 
354447
- /***/ 57726:
354993
+ /***/ 63920:
354448
354994
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
354449
354995
 
354450
354996
  "use strict";
@@ -354615,211 +355161,99 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
354615
355161
  return to.concat(ar || Array.prototype.slice.call(from));
354616
355162
  };
354617
355163
  exports.__esModule = true;
354618
- exports.createJobs = void 0;
355164
+ exports.createGitlabJobs = exports.makeGitlabJob = void 0;
354619
355165
  var lodash_1 = __nccwpck_require__(23255);
354620
- var build_1 = __nccwpck_require__(73760);
354621
- var context_1 = __nccwpck_require__(22041);
354622
- var deploy_1 = __nccwpck_require__(90223);
354623
- var utils_1 = __nccwpck_require__(37461);
354624
- var getCommitInfo_1 = __nccwpck_require__(5923);
354625
- var makeGitlabJob_1 = __nccwpck_require__(15715);
354626
- var packageManager_1 = __nccwpck_require__(69168);
354627
- var injectDefaultVarsInCustomJobs = function (context, jobs) {
354628
- return jobs.map(function (_a) {
354629
- var _b;
354630
- var variables = _a.variables,
354631
- job = __rest(_a, ["variables"]);
354632
- return __assign({
354633
- variables: __assign(__assign({}, (_b = context.environment.envVars) !== null && _b !== void 0 ? _b : {}), variables !== null && variables !== void 0 ? variables : {})
354634
- }, job);
354635
- });
354636
- };
354637
- var getCustomJobs = function (context) {
354638
- if (!context.componentConfig.customJobs) {
354639
- return [];
354640
- }
354641
- var rawJobs = (0, lodash_1.isFunction)(context.componentConfig.customJobs) ? context.componentConfig.customJobs(context) : context.componentConfig.customJobs;
354642
- return injectDefaultVarsInCustomJobs(context, rawJobs);
354643
- };
354644
- var createRawJobs = function (context) {
354645
- if (context.componentConfig.deploy === false) {
354646
- return [];
354647
- }
354648
- var buildJobs = build_1.BUILD_TYPES[context.componentConfig.build.type].jobs(context);
354649
- var deployJobs = deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context);
354650
- var customJobs = getCustomJobs(context);
354651
- return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
354652
- };
355166
+ var defaults_1 = __nccwpck_require__(87383);
354653
355167
  var getFullJobName = function (name, componentName, env) {
354654
355168
  if (env) {
354655
355169
  return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
354656
355170
  }
354657
355171
  return "".concat(componentName, " ").concat(name);
354658
355172
  };
354659
- var getFullReferencedJobName = function (referencedJobName, componentName, env, allRawJobs) {
354660
- var referencedJob = allRawJobs.find(function (j) {
355173
+ var getFullReferencedJobName = function (referencedJobName, componentName, env, allJobs) {
355174
+ var _a, _b;
355175
+ var referencedJob = (_b = (_a = allJobs[componentName]) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.find(function (j) {
354661
355176
  return j.name === referencedJobName;
354662
355177
  });
354663
355178
  if (!referencedJob) {
354664
- throw new Error("unknown job referenced: " + referencedJobName);
355179
+ throw new Error("unknown job referenced: '".concat(referencedJobName, "' from '").concat(env, ":").concat(componentName, "'"));
354665
355180
  }
354666
355181
  var envToSet = referencedJob.envMode !== "none" ? env : null;
354667
355182
  return getFullJobName(referencedJobName, componentName, envToSet);
354668
355183
  };
354669
- // replaces references to other jobs with the full name
354670
- // the full name contains the componentname and the env name (if any)
354671
- var replaceReferences = function (job, componentName, env, allRawJobs) {
354672
- var _a, _b, _c;
354673
- var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
354674
- var needsFromNeeds = (_a = job.needs) === null || _a === void 0 ? void 0 : _a.map(function (n) {
354675
- return (0, lodash_1.isObject)(n) ? {
354676
- job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
354677
- artifacts: n.artifacts
354678
- } : getFullReferencedJobName(n, componentName, env, allRawJobs);
354679
- });
354680
- var needsFromOtherComponents = (_b = job.needsOtherComponent) === null || _b === void 0 ? void 0 : _b.map(function (other) {
354681
- return {
354682
- artifacts: other.artifacts,
354683
- job: getFullReferencedJobName(other.job, other.componentName, env, allRawJobs)
354684
- };
354685
- });
354686
- var needs = __spreadArray(__spreadArray([], __read(needsFromNeeds !== null && needsFromNeeds !== void 0 ? needsFromNeeds : []), false), __read(needsFromOtherComponents !== null && needsFromOtherComponents !== void 0 ? needsFromOtherComponents : []), false);
354687
- return __assign(__assign({}, job), {
354688
- stage: stage,
354689
- needs: needs,
354690
- environment: ((_c = job.environment) === null || _c === void 0 ? void 0 : _c.on_stop) ? __assign(__assign({}, job.environment), {
354691
- on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allRawJobs)
354692
- }) : job.environment
354693
- });
354694
- };
354695
- // this can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/220758 is resolved
354696
- var addStageNeeds = function (jobs) {
354697
- // when a job defines needsStages, we add these as needs
354698
- return jobs.map(function (job) {
354699
- var _a;
354700
- if (!job.needsStages || job.needsStages.length === 0) {
354701
- return job;
354702
- }
354703
- var neededJobs = jobs.map(function (j) {
354704
- var _a, _b;
354705
- var neededStage = (_a = job.needsStages) === null || _a === void 0 ? void 0 : _a.find(function (s) {
354706
- return j.stage === s.stage;
354707
- });
354708
- if (neededStage) {
354709
- return {
354710
- job: j.name,
354711
- artifacts: (_b = neededStage.artifacts) !== null && _b !== void 0 ? _b : false
354712
- };
354713
- }
354714
- }).filter(utils_1.notNil);
354715
- return __assign(__assign({}, job), {
354716
- needs: __spreadArray(__spreadArray([], __read((_a = job.needs) !== null && _a !== void 0 ? _a : []), false), __read(neededJobs), false)
354717
- });
354718
- });
354719
- };
354720
- var createJobs = function (type, envs, config, componentName, trigger) {
354721
- return __awaiter(void 0, void 0, void 0, function () {
354722
- var commitInfo, _a, packageManagerInfo;
354723
- return __generator(this, function (_b) {
354724
- switch (_b.label) {
354725
- case 0:
354726
- _a = [{}];
354727
- return [4 /*yield*/, (0, getCommitInfo_1.getBaseCommitInfo)()];
354728
- case 1:
354729
- commitInfo = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([_b.sent()])), {
354730
- trigger: trigger
354731
- }]);
354732
- return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(config, componentName)];
354733
- case 2:
354734
- packageManagerInfo = _b.sent();
354735
- return [2 /*return*/, envs.reduce(function (acc, env) {
354736
- return __awaiter(void 0, void 0, void 0, function () {
354737
- var context, jobs, result, _a, _b, _c, _d, _e;
354738
- return __generator(this, function (_f) {
354739
- switch (_f.label) {
354740
- case 0:
354741
- return [4 /*yield*/, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
354742
- case 1:
354743
- context = _f.sent();
354744
- jobs = addStageNeeds(createRawJobs(context));
354745
- _a = [{}];
354746
- return [4 /*yield*/, acc];
354747
- case 2:
354748
- _b = [__assign.apply(void 0, _a.concat([_f.sent()]))];
354749
- _d = (_c = jobs).reduce;
354750
- _e = [function (acc, job) {
354751
- var _a;
354752
- var jobWithResolvedReferences = replaceReferences(job, componentName, env, jobs);
354753
- var jobName = getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined);
354754
- if (type === "gitlab") {
354755
- return __assign(__assign({}, acc), (_a = {}, _a[jobName] = (0, makeGitlabJob_1.makeGitlabJob)(jobWithResolvedReferences), _a));
354756
- }
354757
- throw new Error("not supported");
354758
- }];
354759
- return [4 /*yield*/, Promise.resolve({})];
354760
- case 3:
354761
- result = __assign.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()]))]));
354762
- return [2 /*return*/, result];
354763
- }
354764
- });
354765
- });
354766
- }, {})];
354767
- }
354768
- });
354769
- });
354770
- };
354771
- exports.createJobs = createJobs;
354772
-
354773
- /***/ }),
354774
-
354775
- /***/ 15715:
354776
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
354777
-
354778
- "use strict";
354779
-
354780
-
354781
- var __assign = this && this.__assign || function () {
354782
- __assign = Object.assign || function (t) {
354783
- for (var s, i = 1, n = arguments.length; i < n; i++) {
354784
- s = arguments[i];
354785
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
354786
- }
354787
- return t;
354788
- };
354789
- return __assign.apply(this, arguments);
354790
- };
354791
- var __rest = this && this.__rest || function (s, e) {
354792
- var t = {};
354793
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
354794
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
354795
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
354796
- }
354797
- return t;
354798
- };
354799
- exports.__esModule = true;
354800
- exports.makeGitlabJob = void 0;
354801
- var lodash_1 = __nccwpck_require__(23255);
354802
- var defaults_1 = __nccwpck_require__(87383);
354803
355184
  var getJobName = function (need) {
354804
355185
  return (0, lodash_1.isObject)(need) ? need.job : need;
354805
355186
  };
354806
- var makeGitlabJob = function (_a) {
355187
+ var makeGitlabJob = function (componentName, env, _a, allJobs) {
355188
+ var _b;
354807
355189
  var envMode = _a.envMode,
354808
355190
  needsStages = _a.needsStages,
354809
355191
  needsOtherComponent = _a.needsOtherComponent,
354810
355192
  name = _a.name,
354811
355193
  needs = _a.needs,
354812
- rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
354813
- return __assign(__assign({}, rest), {
355194
+ job = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
355195
+ var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
355196
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
355197
+ var _a, _b, _c, _d;
355198
+ var referencedComponentName = componentName;
355199
+ var allJobNamesFromThatStage = (_d = (_c = (_b = (_a = allJobs[referencedComponentName]) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.filter(function (j) {
355200
+ return j.stage === n.stage;
355201
+ })) === null || _c === void 0 ? void 0 : _c.map(function (j) {
355202
+ return j.name;
355203
+ })) !== null && _d !== void 0 ? _d : [];
355204
+ return allJobNamesFromThatStage.map(function (job) {
355205
+ var _a;
355206
+ return {
355207
+ job: job,
355208
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
355209
+ componentName: referencedComponentName
355210
+ };
355211
+ });
355212
+ });
355213
+ var cleanedNeeds = __spreadArray(__spreadArray(__spreadArray([], __read(needs !== null && needs !== void 0 ? needs : []), false), __read(needsOtherComponent !== null && needsOtherComponent !== void 0 ? needsOtherComponent : []), false), __read(needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : []), false);
355214
+ var gitlabNeeds = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
355215
+ var _a;
355216
+ return (0, lodash_1.isObject)(n) ? {
355217
+ job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : componentName, env, allJobs),
355218
+ artifacts: n.artifacts
355219
+ } : getFullReferencedJobName(n, componentName, env, allJobs);
355220
+ }).sort(function (a, b) {
355221
+ return getJobName(a).localeCompare(getJobName(b));
355222
+ });
355223
+ var fullJobName = getFullJobName(name, componentName, envMode !== "none" ? env : undefined);
355224
+ var gitlabJob = __assign(__assign({}, job), {
355225
+ stage: stage,
355226
+ environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
355227
+ on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allJobs)
355228
+ }) : job.environment,
354814
355229
  // sort in a predictable manner for snapshot tests
354815
- needs: needs === null || needs === void 0 ? void 0 : needs.sort(function (a, b) {
354816
- return getJobName(a).localeCompare(getJobName(b));
354817
- }),
355230
+ needs: gitlabNeeds,
354818
355231
  retry: defaults_1.BASE_RETRY,
354819
355232
  interruptible: true
354820
355233
  });
355234
+ return [fullJobName, gitlabJob];
354821
355235
  };
354822
355236
  exports.makeGitlabJob = makeGitlabJob;
355237
+ var createGitlabJobs = function (allJobs) {
355238
+ return __awaiter(void 0, void 0, void 0, function () {
355239
+ return __generator(this, function (_a) {
355240
+ return [2 /*return*/, Object.keys(allJobs).reduce(function (accForComponents, componentName) {
355241
+ var componentJobs = allJobs[componentName];
355242
+ return __assign(__assign({}, accForComponents), Object.keys(componentJobs).reduce(function (accForEnvs, env) {
355243
+ var jobs = componentJobs[env];
355244
+ return __assign(__assign({}, accForEnvs), jobs.reduce(function (accForJobs, job) {
355245
+ var _a;
355246
+ var _b = __read((0, exports.makeGitlabJob)(componentName, env, job, allJobs), 2),
355247
+ fullJobName = _b[0],
355248
+ gitlabJob = _b[1];
355249
+ return __assign(__assign({}, accForJobs), (_a = {}, _a[fullJobName] = gitlabJob, _a));
355250
+ }, {}));
355251
+ }, {}));
355252
+ }, {})];
355253
+ });
355254
+ });
355255
+ };
355256
+ exports.createGitlabJobs = createGitlabJobs;
354823
355257
 
354824
355258
  /***/ }),
354825
355259
 
@@ -354846,7 +355280,7 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
354846
355280
  };
354847
355281
  exports.__esModule = true;
354848
355282
  __exportStar(__nccwpck_require__(78974), exports);
354849
- __exportStar(__nccwpck_require__(57726), exports);
355283
+ __exportStar(__nccwpck_require__(80962), exports);
354850
355284
 
354851
355285
  /***/ }),
354852
355286
 
@@ -355509,7 +355943,7 @@ var sanitizeForBashVariable = function (name) {
355509
355943
  };
355510
355944
  exports.sanitizeForBashVariable = sanitizeForBashVariable;
355511
355945
  var repeatOnFailure = function (command, options) {
355512
- return "\n until ".concat(command, " &> /dev/null\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
355946
+ return "\n until ".concat(command, "\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
355513
355947
  };
355514
355948
  exports.repeatOnFailure = repeatOnFailure;
355515
355949