@catladder/cli 0.0.0-main-414c8270 → 0.0.0-main-0acdca98

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.
@@ -1201,7 +1201,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
1201
1201
  case 7:
1202
1202
  localPort = (_c.sent()).localPort;
1203
1203
  _b = (0, getProjectConfig_1.parseChoice)(envComponent), env = _b.env, componentName = _b.componentName;
1204
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(this, env, componentName)];
1204
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, env, componentName)];
1205
1205
  case 8:
1206
1206
  envVars = _c.sent();
1207
1207
  MONGODB_ROOT_PASSWORD = envVars === null || envVars === void 0 ? void 0 : envVars.MONGODB_ROOT_PASSWORD;
@@ -1455,7 +1455,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
1455
1455
  };
1456
1456
  exports.__esModule = true;
1457
1457
  var pipeline_1 = __nccwpck_require__(25355);
1458
- var pipeline_2 = __nccwpck_require__(25355);
1459
1458
  var child_process_promise_1 = __nccwpck_require__(75763);
1460
1459
  var getProjectConfig_1 = __nccwpck_require__(24146);
1461
1460
  var autocompletions_1 = __nccwpck_require__(41373);
@@ -1477,20 +1476,24 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
1477
1476
  switch (_c.label) {
1478
1477
  case 0:
1479
1478
  _b = (0, getProjectConfig_1.parseChoice)(envComponent), env = _b.env, componentName = _b.componentName;
1479
+ if (!componentName) {
1480
+ this.log("need componentName");
1481
+ return [2 /*return*/];
1482
+ }
1480
1483
  return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
1481
1484
  case 1:
1482
1485
  context = _c.sent();
1483
1486
  if (env === "review") {
1484
1487
  vorpal.log("⚠️ connection string does not include mr information on review environments");
1485
1488
  }
1486
- if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) return [3 /*break*/, 3];
1487
- return [4 /*yield*/, getProxyInfoForKubernetes(context)];
1489
+ if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) return [3 /*break*/, 3];
1490
+ return [4 /*yield*/, getProxyInfoForKubernetes(this, context)];
1488
1491
  case 2:
1489
1492
  proxyInfo = _c.sent();
1490
1493
  return [3 /*break*/, 6];
1491
1494
  case 3:
1492
- if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) return [3 /*break*/, 5];
1493
- return [4 /*yield*/, getProxyInfoForCloudRun(context)];
1495
+ if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) return [3 /*break*/, 5];
1496
+ return [4 /*yield*/, getProxyInfoForCloudRun(this, context)];
1494
1497
  case 4:
1495
1498
  proxyInfo = _c.sent();
1496
1499
  return [3 /*break*/, 6];
@@ -1528,15 +1531,15 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
1528
1531
  }
1529
1532
  });
1530
1533
  }); });
1531
- var getProxyInfoForKubernetes = function (context) { return __awaiter(void 0, void 0, void 0, function () {
1534
+ var getProxyInfoForKubernetes = function (vorpal, context) { return __awaiter(void 0, void 0, void 0, function () {
1532
1535
  var envVars, cloudSqlValues, DB_PASSWORD, DB_NAME, instanceName;
1533
1536
  return __generator(this, function (_a) {
1534
1537
  switch (_a.label) {
1535
1538
  case 0:
1536
- if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
1539
+ if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
1537
1540
  throw new Error("unsupported");
1538
1541
  }
1539
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(this, context.environment.shortName, context.componentName)];
1542
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.environment.shortName, context.componentName)];
1540
1543
  case 1:
1541
1544
  envVars = _a.sent();
1542
1545
  cloudSqlValues = (0, pipeline_1.createKubernetesCloudsqlBaseValues)(context);
@@ -1552,16 +1555,16 @@ var getProxyInfoForKubernetes = function (context) { return __awaiter(void 0, vo
1552
1555
  }
1553
1556
  });
1554
1557
  }); };
1555
- var getProxyInfoForCloudRun = function (context) { return __awaiter(void 0, void 0, void 0, function () {
1558
+ var getProxyInfoForCloudRun = function (vorpal, context) { return __awaiter(void 0, void 0, void 0, function () {
1556
1559
  var envVars, DB_PASSWORD, DB_USER, DB_NAME;
1557
1560
  return __generator(this, function (_a) {
1558
1561
  switch (_a.label) {
1559
1562
  case 0:
1560
- if (!(0, pipeline_2.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ||
1563
+ if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ||
1561
1564
  !context.componentConfig.deploy.cloudSql) {
1562
1565
  throw new Error("unsupported");
1563
1566
  }
1564
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(this, context.environment.shortName, context.componentName)];
1567
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.environment.shortName, context.componentName)];
1565
1568
  case 1:
1566
1569
  envVars = _a.sent();
1567
1570
  DB_PASSWORD = envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD;
@@ -1589,6 +1592,17 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
1589
1592
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
1590
1593
  return cooked;
1591
1594
  };
1595
+ var __assign = (this && this.__assign) || function () {
1596
+ __assign = Object.assign || function(t) {
1597
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
1598
+ s = arguments[i];
1599
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
1600
+ t[p] = s[p];
1601
+ }
1602
+ return t;
1603
+ };
1604
+ return __assign.apply(this, arguments);
1605
+ };
1592
1606
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1593
1607
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1594
1608
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -1625,6 +1639,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
1625
1639
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1626
1640
  }
1627
1641
  };
1642
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
1643
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1644
+ if (ar || !(i in from)) {
1645
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1646
+ ar[i] = from[i];
1647
+ }
1648
+ }
1649
+ return to.concat(ar || Array.prototype.slice.call(from));
1650
+ };
1628
1651
  exports.__esModule = true;
1629
1652
  exports.projectConfigSecrets = void 0;
1630
1653
  /* eslint-disable no-constant-condition */
@@ -1660,27 +1683,32 @@ var resolveJson = function (v) {
1660
1683
  ];
1661
1684
  }));
1662
1685
  };
1663
- var getNonHiddenSecretEnvVarKeys = function (env, componentName) { return __awaiter(void 0, void 0, void 0, function () {
1664
- var secretEnvVarKeys;
1665
- return __generator(this, function (_a) {
1666
- switch (_a.label) {
1686
+ var getSecretEnvVarKeysToConfigure = function (env, componentName) { return __awaiter(void 0, void 0, void 0, function () {
1687
+ var _a, secretEnvVarKeys, jobOnlyVars;
1688
+ return __generator(this, function (_b) {
1689
+ switch (_b.label) {
1667
1690
  case 0: return [4 /*yield*/, (0, getProjectConfig_1.getEnvironment)(env, componentName)];
1668
1691
  case 1:
1669
- secretEnvVarKeys = (_a.sent()).secretEnvVarKeys;
1670
- return [2 /*return*/, secretEnvVarKeys.filter(function (k) { return !k.hidden; }).map(function (k) { return k.key; })];
1692
+ _a = _b.sent(), secretEnvVarKeys = _a.secretEnvVarKeys, jobOnlyVars = _a.jobOnlyVars;
1693
+ return [2 /*return*/, __spreadArray(__spreadArray(__spreadArray([], jobOnlyVars.build.secretEnvVarKeys, true), jobOnlyVars.deploy.secretEnvVarKeys, true), secretEnvVarKeys, true).filter(function (k) { return !k.hidden; })
1694
+ .map(function (k) { return k.key; })];
1671
1695
  }
1672
1696
  });
1673
1697
  }); };
1674
1698
  var getEnvVarsToEdit = function (instance, env, componentName) { return __awaiter(void 0, void 0, void 0, function () {
1675
- var secretEnvVarKeys, allEnvVars;
1699
+ var secretEnvVarKeys, normalEnvVars, jobOnlyEnvVars, allEnvVars;
1676
1700
  return __generator(this, function (_a) {
1677
1701
  switch (_a.label) {
1678
- case 0: return [4 /*yield*/, getNonHiddenSecretEnvVarKeys(env, componentName)];
1702
+ case 0: return [4 /*yield*/, getSecretEnvVarKeysToConfigure(env, componentName)];
1679
1703
  case 1:
1680
1704
  secretEnvVarKeys = _a.sent();
1681
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(instance, env, componentName)];
1705
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(instance, env, componentName)];
1682
1706
  case 2:
1683
- allEnvVars = _a.sent();
1707
+ normalEnvVars = _a.sent();
1708
+ return [4 /*yield*/, (0, getProjectConfig_1.getJobOnlyEnvVarsResolved)(instance, env, componentName)];
1709
+ case 3:
1710
+ jobOnlyEnvVars = _a.sent();
1711
+ allEnvVars = __assign(__assign({}, normalEnvVars), jobOnlyEnvVars);
1684
1712
  return [2 /*return*/, Object.fromEntries(secretEnvVarKeys.map(function (key) {
1685
1713
  var value = allEnvVars[key];
1686
1714
  // due to some quirky way to resolve these variables, unset variables have the $CL_ prefix, so we remove thouse here
@@ -1754,7 +1782,7 @@ var doItFor = function (instance, envAndComponents) { return __awaiter(void 0, v
1754
1782
  usedKeys = valuesToEdit[componentName][env]
1755
1783
  ? Object.keys(valuesToEdit[componentName][env])
1756
1784
  : [];
1757
- return [4 /*yield*/, getNonHiddenSecretEnvVarKeys(env, componentName)];
1785
+ return [4 /*yield*/, getSecretEnvVarKeysToConfigure(env, componentName)];
1758
1786
  case 6:
1759
1787
  secretEnvVarKeys = _k.sent();
1760
1788
  extranous = (0, lodash_1.difference)(usedKeys, secretEnvVarKeys);
@@ -2191,7 +2219,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
2191
2219
  switch (_c.label) {
2192
2220
  case 0:
2193
2221
  _b = (0, getProjectConfig_1.parseChoice)(envComponent), env = _b.env, componentName = _b.componentName;
2194
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(this, env, componentName)];
2222
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, env, componentName)];
2195
2223
  case 1:
2196
2224
  envvars = _c.sent();
2197
2225
  Object.keys(envvars).forEach(function (key) {
@@ -6116,6 +6144,17 @@ exports.GRAFANA_PROXY_TARGET_PORT = 9090;
6116
6144
 
6117
6145
  "use strict";
6118
6146
 
6147
+ var __assign = (this && this.__assign) || function () {
6148
+ __assign = Object.assign || function(t) {
6149
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6150
+ s = arguments[i];
6151
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6152
+ t[p] = s[p];
6153
+ }
6154
+ return t;
6155
+ };
6156
+ return __assign.apply(this, arguments);
6157
+ };
6119
6158
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6120
6159
  if (k2 === undefined) k2 = k;
6121
6160
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
@@ -6160,7 +6199,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
6160
6199
  }
6161
6200
  };
6162
6201
  exports.__esModule = true;
6163
- exports.getEnvVars = exports.getGitlabVar = exports.getEnvironment = exports.getAllPipelineContexts = exports.getAllComponentsWithAllEnvsHierarchical = exports.getAllComponentsWithAllEnvsFlat = exports.getPipelineContextByChoice = exports.getProjectComponents = exports.getGitlabCi = exports.getGitlabCiFilePath = exports.getProjectConfig = exports.parseChoice = void 0;
6202
+ exports.getJobOnlyEnvVarsResolved = exports.getEnvVarsResolved = exports.getGitlabVar = exports.getEnvironment = exports.getAllPipelineContexts = exports.getAllComponentsWithAllEnvsHierarchical = exports.getAllComponentsWithAllEnvsFlat = exports.getPipelineContextByChoice = exports.getProjectComponents = exports.getGitlabCi = exports.getGitlabCiFilePath = exports.getProjectConfig = exports.parseChoice = void 0;
6164
6203
  var pipeline_1 = __nccwpck_require__(25355);
6165
6204
  var gitlab_1 = __nccwpck_require__(79818);
6166
6205
  var projects_1 = __nccwpck_require__(41619);
@@ -6364,27 +6403,55 @@ var resolveSecrets = function (vorpal, allEnvVars) { return __awaiter(void 0, vo
6364
6403
  }
6365
6404
  });
6366
6405
  }); };
6367
- var getEnvVars = function (vorpal, env, componentName) { return __awaiter(void 0, void 0, void 0, function () {
6406
+ var getEnvVarsResolved = function (vorpal, env, componentName) { return __awaiter(void 0, void 0, void 0, function () {
6368
6407
  var envionment, e_2;
6369
6408
  return __generator(this, function (_a) {
6370
6409
  switch (_a.label) {
6371
6410
  case 0:
6372
- _a.trys.push([0, 2, , 3]);
6373
- return [4 /*yield*/, (0, exports.getEnvironment)(env, componentName)];
6411
+ if (!componentName) {
6412
+ return [2 /*return*/, {}];
6413
+ }
6414
+ _a.label = 1;
6374
6415
  case 1:
6416
+ _a.trys.push([1, 3, , 4]);
6417
+ return [4 /*yield*/, (0, exports.getEnvironment)(env, componentName)];
6418
+ case 2:
6375
6419
  envionment = _a.sent();
6376
6420
  // in the pipeline the secrets alreadyy exists and bash will expand them
6377
6421
  // but here we need to manually load them
6378
6422
  return [2 /*return*/, resolveSecrets(vorpal, envionment.envVars)];
6379
- case 2:
6423
+ case 3:
6380
6424
  e_2 = _a.sent();
6381
6425
  // env is disabled
6382
6426
  return [2 /*return*/, {}];
6427
+ case 4: return [2 /*return*/];
6428
+ }
6429
+ });
6430
+ }); };
6431
+ exports.getEnvVarsResolved = getEnvVarsResolved;
6432
+ /**
6433
+ *
6434
+ * is used to get job only vars that should also be editable locally with catladder.
6435
+ */
6436
+ var getJobOnlyEnvVarsResolved = function (vorpal, env, componentName) { return __awaiter(void 0, void 0, void 0, function () {
6437
+ var envionment, e_3;
6438
+ return __generator(this, function (_a) {
6439
+ switch (_a.label) {
6440
+ case 0:
6441
+ _a.trys.push([0, 2, , 3]);
6442
+ return [4 /*yield*/, (0, exports.getEnvironment)(env, componentName)];
6443
+ case 1:
6444
+ envionment = _a.sent();
6445
+ return [2 /*return*/, resolveSecrets(vorpal, __assign(__assign({}, envionment.jobOnlyVars.build.envVars), envionment.jobOnlyVars.deploy.envVars))];
6446
+ case 2:
6447
+ e_3 = _a.sent();
6448
+ // env is disabled
6449
+ return [2 /*return*/, {}];
6383
6450
  case 3: return [2 /*return*/];
6384
6451
  }
6385
6452
  });
6386
6453
  }); };
6387
- exports.getEnvVars = getEnvVars;
6454
+ exports.getJobOnlyEnvVarsResolved = getJobOnlyEnvVarsResolved;
6388
6455
  //# sourceMappingURL=getProjectConfig.js.map
6389
6456
 
6390
6457
  /***/ }),
@@ -350093,7 +350160,7 @@ var createBuildJob = function (context, _a) {
350093
350160
  image: (0, __1.getRunnerImage)("jobs-default"),
350094
350161
  needs: [],
350095
350162
  cache: [],
350096
- variables: __assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
350163
+ variables: __assign(__assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
350097
350164
  script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
350098
350165
  artifacts: {
350099
350166
  paths: [(0, path_1.join)(context.componentConfig.dir, "__build_info.json")],
@@ -350332,9 +350399,9 @@ var createCustomTestJobs = function (context) {
350332
350399
  throw new Error("deploy config is not custom");
350333
350400
  }
350334
350401
  var base = {
350335
- variables: __assign(__assign({
350402
+ variables: __assign(__assign(__assign({
350336
350403
  APP_PATH: context.componentConfig.dir
350337
- }, RUNNER_CUSTOM_TEST_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
350404
+ }, RUNNER_CUSTOM_TEST_VARIABLES), context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
350338
350405
  services: buildConfig.jobServices,
350339
350406
  cache: buildConfig.jobCache,
350340
350407
  stage: "test",
@@ -351025,9 +351092,9 @@ var createNodeTestJobs = function (context) {
351025
351092
  }
351026
351093
  var buildConfig = context.componentConfig.build;
351027
351094
  var base = {
351028
- variables: __assign(__assign({
351095
+ variables: __assign(__assign(__assign({
351029
351096
  APP_PATH: context.componentConfig.dir
351030
- }, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
351097
+ }, constants_1.NODE_RUNNER_BUILD_VARIABLES), context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
351031
351098
  stage: "test",
351032
351099
  needs: [],
351033
351100
  envMode: "none"
@@ -351144,6 +351211,16 @@ exports.getDockerAppCopyAndBuildScript = getDockerAppCopyAndBuildScript;
351144
351211
  "use strict";
351145
351212
 
351146
351213
 
351214
+ var __assign = this && this.__assign || function () {
351215
+ __assign = Object.assign || function (t) {
351216
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
351217
+ s = arguments[i];
351218
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
351219
+ }
351220
+ return t;
351221
+ };
351222
+ return __assign.apply(this, arguments);
351223
+ };
351147
351224
  var __read = this && this.__read || function (o, n) {
351148
351225
  var m = typeof Symbol === "function" && o[Symbol.iterator];
351149
351226
  if (!m) return o;
@@ -351185,7 +351262,7 @@ var createRailsBuildJobs = function (context) {
351185
351262
  return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
351186
351263
  }).join(" ");
351187
351264
  return [(0, docker_1.createDockerBuildJobBase)(context, {
351188
- variables: context.componentConfig.build.extraVars,
351265
+ variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
351189
351266
  // custom script
351190
351267
  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",
351191
351268
  // replace private git ssh gem sources with https to make bundler with credentials via env var work
@@ -351302,7 +351379,7 @@ var createRailsTestJobs = function (context) {
351302
351379
  }
351303
351380
  var buildConfig = context.componentConfig.build;
351304
351381
  var base = {
351305
- variables: (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {},
351382
+ variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
351306
351383
  stage: "test",
351307
351384
  needs: [],
351308
351385
  envMode: "none"
@@ -351535,7 +351612,7 @@ exports.readConfigSync = readConfigSync;
351535
351612
 
351536
351613
  exports.__esModule = true;
351537
351614
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
351538
- exports.PIPELINE_IMAGE_TAG = "main-414c8270" || 0;
351615
+ exports.PIPELINE_IMAGE_TAG = "main-0acdca98" || 0;
351539
351616
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
351540
351617
 
351541
351618
  /***/ }),
@@ -351591,6 +351668,16 @@ exports.getEnvType = getEnvType;
351591
351668
  "use strict";
351592
351669
 
351593
351670
 
351671
+ var __assign = this && this.__assign || function () {
351672
+ __assign = Object.assign || function (t) {
351673
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
351674
+ s = arguments[i];
351675
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
351676
+ }
351677
+ return t;
351678
+ };
351679
+ return __assign.apply(this, arguments);
351680
+ };
351594
351681
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
351595
351682
  function adopt(value) {
351596
351683
  return value instanceof P ? value : new P(function (resolve) {
@@ -351712,30 +351799,26 @@ var getEnvironmentContext_1 = __nccwpck_require__(95141);
351712
351799
  var getEnvironmentVariables_1 = __nccwpck_require__(76602);
351713
351800
  var getEnvironment = function (config, componentName, env, commitInfo) {
351714
351801
  return __awaiter(void 0, void 0, void 0, function () {
351715
- var _a, envVars, secretEnvVarKeys, host, url, envContext, envType;
351716
- return __generator(this, function (_b) {
351717
- switch (_b.label) {
351802
+ var variables, envContext, envType;
351803
+ return __generator(this, function (_a) {
351804
+ switch (_a.label) {
351718
351805
  case 0:
351719
351806
  return [4 /*yield*/, (0, getEnvironmentVariables_1.getEnvironmentVariables)(config, componentName, env, commitInfo)];
351720
351807
  case 1:
351721
- _a = _b.sent(), envVars = _a.envVars, secretEnvVarKeys = _a.secretEnvVarKeys, host = _a.host, url = _a.url;
351808
+ variables = _a.sent();
351722
351809
  envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
351723
351810
  envType = envContext.envType;
351724
- return [2 /*return*/, {
351811
+ return [2 /*return*/, __assign({
351725
351812
  envType: envType,
351726
- host: host,
351727
- url: url,
351728
351813
  gitlabEnvironment: {
351729
351814
  name: envContext.gitlabEnvironmentName,
351730
- url: url
351815
+ url: variables.url
351731
351816
  },
351732
351817
  fullName: envContext.fullName,
351733
351818
  slugPrefix: envContext.environmentSlugPrefix,
351734
351819
  slug: envContext.environmentSlug,
351735
- shortName: env,
351736
- envVars: envVars,
351737
- secretEnvVarKeys: secretEnvVarKeys
351738
- }];
351820
+ shortName: env
351821
+ }, variables)];
351739
351822
  }
351740
351823
  });
351741
351824
  });
@@ -351952,19 +352035,22 @@ var lodash_1 = __nccwpck_require__(23255);
351952
352035
  var deploy_1 = __nccwpck_require__(90223);
351953
352036
  var getEnvironmentContext_1 = __nccwpck_require__(95141);
351954
352037
  var resolveReferences_1 = __nccwpck_require__(80928);
352038
+ var envVars_1 = __nccwpck_require__(57185);
352039
+ var transformJobOnlyVars_1 = __nccwpck_require__(34674);
351955
352040
  var getEnvironmentVariables = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
351956
352041
  ) {
351957
352042
  if (alreadyVisited === void 0) {
351958
352043
  alreadyVisited = {};
351959
352044
  }
351960
352045
  return __awaiter(void 0, void 0, void 0, function () {
351961
- var environmentContext, envConfigRaw, deployConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
351962
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
351963
- return __generator(this, function (_k) {
351964
- switch (_k.label) {
352046
+ var environmentContext, envConfigRaw, deployConfigRaw, buildConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegacyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
352047
+ var _a, _b;
352048
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l;
352049
+ return __generator(this, function (_m) {
352050
+ switch (_m.label) {
351965
352051
  case 0:
351966
352052
  environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
351967
- envConfigRaw = environmentContext.envConfigRaw, deployConfigRaw = environmentContext.deployConfigRaw, envType = environmentContext.envType;
352053
+ envConfigRaw = environmentContext.envConfigRaw, deployConfigRaw = environmentContext.deployConfigRaw, buildConfigRaw = environmentContext.buildConfigRaw, envType = environmentContext.envType;
351968
352054
  basePredefinedVariables = {
351969
352055
  ENV_SHORT: env,
351970
352056
  APP_DIR: envConfigRaw.dir,
@@ -351975,7 +352061,7 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
351975
352061
  };
351976
352062
  if (envType === "local") {
351977
352063
  devLocalConfig = envConfigRaw;
351978
- port = (_a = devLocalConfig.port) !== null && _a !== void 0 ? _a : 3000;
352064
+ port = (_c = devLocalConfig.port) !== null && _c !== void 0 ? _c : 3000;
351979
352065
  host = "localhost:" + port;
351980
352066
  url = "http://" + host;
351981
352067
  predefinedVariables = {
@@ -351985,7 +352071,7 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
351985
352071
  };
351986
352072
  } else {
351987
352073
  additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
351988
- host = (_c = (_b = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _b !== void 0 ? _b : additionalEnvVars.HOST_CANONICAL) !== null && _c !== void 0 ? _c : "unknown-host.example.com";
352074
+ host = (_e = (_d = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _d !== void 0 ? _d : additionalEnvVars.HOST_CANONICAL) !== null && _e !== void 0 ? _e : "unknown-host.example.com";
351989
352075
  url = "https://".concat(host);
351990
352076
  predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), config.components[componentName].build.type === "rails" ? {} : {
351991
352077
  HOST: host
@@ -351993,25 +352079,13 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
351993
352079
  ROOT_URL: url
351994
352080
  }), additionalEnvVars);
351995
352081
  }
351996
- publicEnvVarsRaw = (_e = (_d = envConfigRaw.vars) === null || _d === void 0 ? void 0 : _d.public) !== null && _e !== void 0 ? _e : {};
352082
+ publicEnvVarsRaw = (_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.public) !== null && _g !== void 0 ? _g : {};
351997
352083
  additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
351998
- secretEnvVarKeys = __spreadArray(__spreadArray([], __read(((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []).map(function (key) {
351999
- return {
352000
- key: key
352001
- };
352002
- })), false), __read(additionalSecretKeys), false);
352003
- secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (_a) {
352004
- var key = _a.key;
352005
- return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
352006
- }));
352007
- legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
352008
- publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
352009
- publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
352010
- var _b = __read(_a, 2),
352011
- key = _b[0],
352012
- value = _b[1];
352013
- return [key, (0, lodash_1.isObject)(value) ? JSON.stringify(value) : "".concat(value)];
352014
- }));
352084
+ secretEnvVarKeys = __spreadArray(__spreadArray([], __read((0, envVars_1.stringListToSecreteEnvVarList)((_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.secret) !== null && _j !== void 0 ? _j : [])), false), __read(additionalSecretKeys), false);
352085
+ secretEnvVars = (0, envVars_1.makeSecretEnvVarMapping)(env, componentName, secretEnvVarKeys);
352086
+ legacyFromComponents = (_l = (_k = envConfigRaw.vars) === null || _k === void 0 ? void 0 : _k.fromComponents) !== null && _l !== void 0 ? _l : {};
352087
+ publicEnvVarsRawWithLegacyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
352088
+ publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRawWithLegacyFromComponents);
352015
352089
  envVarsRaw = addIndexVar(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized));
352016
352090
  return [4 /*yield*/, (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (otherComponentName, alreadyVisited) {
352017
352091
  return __awaiter(void 0, void 0, void 0, function () {
@@ -352028,13 +352102,18 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
352028
352102
  });
352029
352103
  }, alreadyVisited)];
352030
352104
  case 1:
352031
- envVars = _k.sent();
352032
- return [2 /*return*/, {
352105
+ envVars = _m.sent();
352106
+ _a = {
352033
352107
  envVars: envVars,
352034
- secretEnvVarKeys: secretEnvVarKeys,
352035
- host: host,
352036
- url: url
352037
- }];
352108
+ secretEnvVarKeys: secretEnvVarKeys
352109
+ };
352110
+ _b = {};
352111
+ return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, buildConfigRaw && buildConfigRaw.jobVars || null)];
352112
+ case 2:
352113
+ _b.build = _m.sent();
352114
+ return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, deployConfigRaw && deployConfigRaw.jobVars || null)];
352115
+ case 3:
352116
+ return [2 /*return*/, (_a.jobOnlyVars = (_b.deploy = _m.sent(), _b), _a.host = host, _a.url = url, _a)];
352038
352117
  }
352039
352118
  });
352040
352119
  });
@@ -352546,6 +352625,232 @@ exports.translateLegacyFromComponents = translateLegacyFromComponents;
352546
352625
 
352547
352626
  /***/ }),
352548
352627
 
352628
+ /***/ 34674:
352629
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
352630
+
352631
+ "use strict";
352632
+
352633
+
352634
+ var __assign = this && this.__assign || function () {
352635
+ __assign = Object.assign || function (t) {
352636
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
352637
+ s = arguments[i];
352638
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
352639
+ }
352640
+ return t;
352641
+ };
352642
+ return __assign.apply(this, arguments);
352643
+ };
352644
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
352645
+ function adopt(value) {
352646
+ return value instanceof P ? value : new P(function (resolve) {
352647
+ resolve(value);
352648
+ });
352649
+ }
352650
+ return new (P || (P = Promise))(function (resolve, reject) {
352651
+ function fulfilled(value) {
352652
+ try {
352653
+ step(generator.next(value));
352654
+ } catch (e) {
352655
+ reject(e);
352656
+ }
352657
+ }
352658
+ function rejected(value) {
352659
+ try {
352660
+ step(generator["throw"](value));
352661
+ } catch (e) {
352662
+ reject(e);
352663
+ }
352664
+ }
352665
+ function step(result) {
352666
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
352667
+ }
352668
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
352669
+ });
352670
+ };
352671
+ var __generator = this && this.__generator || function (thisArg, body) {
352672
+ var _ = {
352673
+ label: 0,
352674
+ sent: function () {
352675
+ if (t[0] & 1) throw t[1];
352676
+ return t[1];
352677
+ },
352678
+ trys: [],
352679
+ ops: []
352680
+ },
352681
+ f,
352682
+ y,
352683
+ t,
352684
+ g;
352685
+ return g = {
352686
+ next: verb(0),
352687
+ "throw": verb(1),
352688
+ "return": verb(2)
352689
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
352690
+ return this;
352691
+ }), g;
352692
+ function verb(n) {
352693
+ return function (v) {
352694
+ return step([n, v]);
352695
+ };
352696
+ }
352697
+ function step(op) {
352698
+ if (f) throw new TypeError("Generator is already executing.");
352699
+ while (_) try {
352700
+ 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;
352701
+ if (y = 0, t) op = [op[0] & 2, t.value];
352702
+ switch (op[0]) {
352703
+ case 0:
352704
+ case 1:
352705
+ t = op;
352706
+ break;
352707
+ case 4:
352708
+ _.label++;
352709
+ return {
352710
+ value: op[1],
352711
+ done: false
352712
+ };
352713
+ case 5:
352714
+ _.label++;
352715
+ y = op[1];
352716
+ op = [0];
352717
+ continue;
352718
+ case 7:
352719
+ op = _.ops.pop();
352720
+ _.trys.pop();
352721
+ continue;
352722
+ default:
352723
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
352724
+ _ = 0;
352725
+ continue;
352726
+ }
352727
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
352728
+ _.label = op[1];
352729
+ break;
352730
+ }
352731
+ if (op[0] === 6 && _.label < t[1]) {
352732
+ _.label = t[1];
352733
+ t = op;
352734
+ break;
352735
+ }
352736
+ if (t && _.label < t[2]) {
352737
+ _.label = t[2];
352738
+ _.ops.push(op);
352739
+ break;
352740
+ }
352741
+ if (t[2]) _.ops.pop();
352742
+ _.trys.pop();
352743
+ continue;
352744
+ }
352745
+ op = body.call(thisArg, _);
352746
+ } catch (e) {
352747
+ op = [6, e];
352748
+ y = 0;
352749
+ } finally {
352750
+ f = t = 0;
352751
+ }
352752
+ if (op[0] & 5) throw op[1];
352753
+ return {
352754
+ value: op[0] ? op[1] : void 0,
352755
+ done: true
352756
+ };
352757
+ }
352758
+ };
352759
+ exports.__esModule = true;
352760
+ exports.transformJobOnlyVars = void 0;
352761
+ var envVars_1 = __nccwpck_require__(57185);
352762
+ /**
352763
+ * transform EnvVars for environment.
352764
+ *
352765
+ * currently does not resolve references and is only used for additional job-only-vars
352766
+ * @param vars
352767
+ * @returns
352768
+ */
352769
+ var transformJobOnlyVars = function (env, componentName, vars) {
352770
+ return __awaiter(void 0, void 0, void 0, function () {
352771
+ var publicVars, secretEnvVarKeys, deployJobOnlySecretEnvVars, envVars;
352772
+ var _a, _b;
352773
+ return __generator(this, function (_c) {
352774
+ if (!vars) {
352775
+ return [2 /*return*/, {
352776
+ envVars: {},
352777
+ secretEnvVarKeys: []
352778
+ }];
352779
+ }
352780
+ publicVars = (0, envVars_1.stringifyValues)((_a = vars === null || vars === void 0 ? void 0 : vars.public) !== null && _a !== void 0 ? _a : {});
352781
+ secretEnvVarKeys = (0, envVars_1.stringListToSecreteEnvVarList)((_b = vars === null || vars === void 0 ? void 0 : vars.secret) !== null && _b !== void 0 ? _b : []);
352782
+ deployJobOnlySecretEnvVars = (vars === null || vars === void 0 ? void 0 : vars.secret) ? (0, envVars_1.makeSecretEnvVarMapping)(env, componentName, secretEnvVarKeys) : {};
352783
+ envVars = __assign(__assign({}, deployJobOnlySecretEnvVars), publicVars);
352784
+ return [2 /*return*/, {
352785
+ envVars: envVars,
352786
+ secretEnvVarKeys: secretEnvVarKeys
352787
+ }];
352788
+ });
352789
+ });
352790
+ };
352791
+ exports.transformJobOnlyVars = transformJobOnlyVars;
352792
+
352793
+ /***/ }),
352794
+
352795
+ /***/ 57185:
352796
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
352797
+
352798
+ "use strict";
352799
+
352800
+
352801
+ var __read = this && this.__read || function (o, n) {
352802
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
352803
+ if (!m) return o;
352804
+ var i = m.call(o),
352805
+ r,
352806
+ ar = [],
352807
+ e;
352808
+ try {
352809
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
352810
+ } catch (error) {
352811
+ e = {
352812
+ error: error
352813
+ };
352814
+ } finally {
352815
+ try {
352816
+ if (r && !r.done && (m = i["return"])) m.call(i);
352817
+ } finally {
352818
+ if (e) throw e.error;
352819
+ }
352820
+ }
352821
+ return ar;
352822
+ };
352823
+ exports.__esModule = true;
352824
+ exports.makeSecretEnvVarMapping = exports.stringListToSecreteEnvVarList = exports.stringifyValues = void 0;
352825
+ var lodash_1 = __nccwpck_require__(23255);
352826
+ var getEnvironmentVariables_1 = __nccwpck_require__(76602);
352827
+ var stringifyValues = function (obj) {
352828
+ return Object.fromEntries(Object.entries(obj).map(function (_a) {
352829
+ var _b = __read(_a, 2),
352830
+ key = _b[0],
352831
+ value = _b[1];
352832
+ return [key, (0, lodash_1.isObject)(value) ? JSON.stringify(value) : "".concat(value)];
352833
+ }));
352834
+ };
352835
+ exports.stringifyValues = stringifyValues;
352836
+ var stringListToSecreteEnvVarList = function (keys) {
352837
+ return keys.map(function (key) {
352838
+ return {
352839
+ key: key
352840
+ };
352841
+ });
352842
+ };
352843
+ exports.stringListToSecreteEnvVarList = stringListToSecreteEnvVarList;
352844
+ var makeSecretEnvVarMapping = function (env, componentName, secretEnvVars) {
352845
+ return Object.fromEntries(secretEnvVars.map(function (_a) {
352846
+ var key = _a.key;
352847
+ return [key, "$".concat((0, getEnvironmentVariables_1.getSecretVarName)(env, componentName, key))];
352848
+ }));
352849
+ };
352850
+ exports.makeSecretEnvVarMapping = makeSecretEnvVarMapping;
352851
+
352852
+ /***/ }),
352853
+
352549
352854
  /***/ 87383:
352550
352855
  /***/ ((__unused_webpack_module, exports) => {
352551
352856
 
@@ -352627,7 +352932,7 @@ var getBaseDeploymentJob = function (context) {
352627
352932
  }],
352628
352933
  allow_failure: whenDeploy === "manual" ? true : false,
352629
352934
  stage: "deploy",
352630
- variables: __assign(__assign(__assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.envVars), hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {}), context.componentConfig.deploy ? (_d = context.componentConfig.deploy.extraVars) !== null && _d !== void 0 ? _d : {} : {}),
352935
+ variables: __assign(__assign(__assign(__assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.envVars), hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {}), context.environment.jobOnlyVars.deploy.envVars), context.componentConfig.deploy ? (_d = context.componentConfig.deploy.extraVars) !== null && _d !== void 0 ? _d : {} : {}),
352631
352936
  environment: __assign(__assign({}, context.environment.gitlabEnvironment), isStoppable ? {
352632
352937
  on_stop: exports.STOP_JOB_NAME,
352633
352938
  auto_stop_in: autoStop
@@ -352649,7 +352954,7 @@ var getBaseDeploymentStopJob = function (context) {
352649
352954
  when: "manual",
352650
352955
  allow_failure: true
352651
352956
  }],
352652
- variables: __assign(__assign({}, DEPLOY_RUNNER_VARIABLES), {
352957
+ variables: __assign(__assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.jobOnlyVars.deploy.envVars), {
352653
352958
  GIT_STRATEGY: "none"
352654
352959
  }),
352655
352960
  stage: "stop",
@@ -352668,7 +352973,7 @@ var getBaseRollbackJob = function (context) {
352668
352973
  when: "manual",
352669
352974
  allow_failure: true
352670
352975
  }],
352671
- variables: __assign(__assign({}, DEPLOY_RUNNER_VARIABLES), {
352976
+ variables: __assign(__assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.jobOnlyVars.deploy.envVars), {
352672
352977
  GIT_STRATEGY: "none"
352673
352978
  }),
352674
352979
  stage: "rollback",