@catladder/cli 0.0.0-main-0009a81d → 0.0.0-main-abe8c6c7

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.
@@ -39223,14 +39223,21 @@ exports.getNextCache = exports.getNodeCache = exports.getNodeModulesCache = expo
39223
39223
  var path_1 = __nccwpck_require__(1017);
39224
39224
 
39225
39225
  var getYarnCache = function (context, policy) {
39226
+ var _a;
39227
+
39226
39228
  if (policy === void 0) {
39227
39229
  policy = "pull-push";
39228
39230
  }
39229
39231
 
39230
- return [{
39232
+ var componentIsInWorkspace = (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace;
39233
+ return [componentIsInWorkspace ? {
39231
39234
  key: "yarn",
39232
39235
  policy: policy,
39233
39236
  paths: [".yarn"]
39237
+ } : {
39238
+ key: context.componentConfig.dir + "-yarn",
39239
+ policy: policy,
39240
+ paths: [(0, path_1.join)(context.componentConfig.dir, ".yarn")]
39234
39241
  }];
39235
39242
  };
39236
39243
 
@@ -39638,7 +39645,7 @@ var getYarnInstallCommand = function (context, options) {
39638
39645
 
39639
39646
  return (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.version.startsWith(v);
39640
39647
  });
39641
- return (options === null || options === void 0 ? void 0 : options.prodOnly) ? "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "").concat(doesNotShipWithBuiltInPlugins ? "yarn plugin import workspace-tools && " : " ", "yarn workspaces focus --production") // needs yarn plugin import workspace-tools
39648
+ return (options === null || options === void 0 ? void 0 : options.prodOnly) ? "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "").concat(doesNotShipWithBuiltInPlugins ? "yarn plugin import workspace-tools && " : " ", "yarn workspaces focus --production && yarn rebuild") // needs yarn plugin import workspace-tools
39642
39649
  : "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "", "yarn install --immutable");
39643
39650
  };
39644
39651
 
@@ -39882,17 +39889,312 @@ exports.readConfigSync = readConfigSync;
39882
39889
 
39883
39890
  exports.__esModule = true;
39884
39891
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
39885
- exports.PIPELINE_IMAGE_TAG = "main-0009a81d" || 0;
39892
+ exports.PIPELINE_IMAGE_TAG = "main-abe8c6c7" || 0;
39886
39893
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
39887
39894
 
39888
39895
  /***/ }),
39889
39896
 
39897
+ /***/ 5706:
39898
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
39899
+
39900
+ "use strict";
39901
+
39902
+
39903
+ exports.__esModule = true;
39904
+ exports.getEnvConfig = void 0;
39905
+
39906
+ var utils_1 = __nccwpck_require__(7461);
39907
+
39908
+ var getEnvConfig = function (config, componentName, env) {
39909
+ var _a, _b;
39910
+
39911
+ var defaultConfig = config.components[componentName];
39912
+
39913
+ if (!defaultConfig) {
39914
+ throw new Error("unknown component " + componentName);
39915
+ }
39916
+
39917
+ var envCustomizations = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
39918
+
39919
+ if (envCustomizations === false) {
39920
+ throw new Error("env is disabled: " + env);
39921
+ }
39922
+
39923
+ return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
39924
+ };
39925
+
39926
+ exports.getEnvConfig = getEnvConfig;
39927
+
39928
+ /***/ }),
39929
+
39930
+ /***/ 4811:
39931
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
39932
+
39933
+ "use strict";
39934
+
39935
+
39936
+ exports.__esModule = true;
39937
+ exports.getEnvType = void 0;
39938
+
39939
+ var types_1 = __nccwpck_require__(1753);
39940
+
39941
+ var getEnvType = function (env, envConfig) {
39942
+ if (envConfig.type) return envConfig.type;
39943
+
39944
+ if ((0, types_1.isKnowEnvType)(env)) {
39945
+ return env;
39946
+ }
39947
+
39948
+ throw new Error("unknown env type: " + env);
39949
+ };
39950
+
39951
+ exports.getEnvType = getEnvType;
39952
+
39953
+ /***/ }),
39954
+
39890
39955
  /***/ 740:
39891
39956
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
39892
39957
 
39893
39958
  "use strict";
39894
39959
 
39895
39960
 
39961
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
39962
+ function adopt(value) {
39963
+ return value instanceof P ? value : new P(function (resolve) {
39964
+ resolve(value);
39965
+ });
39966
+ }
39967
+
39968
+ return new (P || (P = Promise))(function (resolve, reject) {
39969
+ function fulfilled(value) {
39970
+ try {
39971
+ step(generator.next(value));
39972
+ } catch (e) {
39973
+ reject(e);
39974
+ }
39975
+ }
39976
+
39977
+ function rejected(value) {
39978
+ try {
39979
+ step(generator["throw"](value));
39980
+ } catch (e) {
39981
+ reject(e);
39982
+ }
39983
+ }
39984
+
39985
+ function step(result) {
39986
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
39987
+ }
39988
+
39989
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
39990
+ });
39991
+ };
39992
+
39993
+ var __generator = this && this.__generator || function (thisArg, body) {
39994
+ var _ = {
39995
+ label: 0,
39996
+ sent: function () {
39997
+ if (t[0] & 1) throw t[1];
39998
+ return t[1];
39999
+ },
40000
+ trys: [],
40001
+ ops: []
40002
+ },
40003
+ f,
40004
+ y,
40005
+ t,
40006
+ g;
40007
+ return g = {
40008
+ next: verb(0),
40009
+ "throw": verb(1),
40010
+ "return": verb(2)
40011
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
40012
+ return this;
40013
+ }), g;
40014
+
40015
+ function verb(n) {
40016
+ return function (v) {
40017
+ return step([n, v]);
40018
+ };
40019
+ }
40020
+
40021
+ function step(op) {
40022
+ if (f) throw new TypeError("Generator is already executing.");
40023
+
40024
+ while (_) try {
40025
+ 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;
40026
+ if (y = 0, t) op = [op[0] & 2, t.value];
40027
+
40028
+ switch (op[0]) {
40029
+ case 0:
40030
+ case 1:
40031
+ t = op;
40032
+ break;
40033
+
40034
+ case 4:
40035
+ _.label++;
40036
+ return {
40037
+ value: op[1],
40038
+ done: false
40039
+ };
40040
+
40041
+ case 5:
40042
+ _.label++;
40043
+ y = op[1];
40044
+ op = [0];
40045
+ continue;
40046
+
40047
+ case 7:
40048
+ op = _.ops.pop();
40049
+
40050
+ _.trys.pop();
40051
+
40052
+ continue;
40053
+
40054
+ default:
40055
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
40056
+ _ = 0;
40057
+ continue;
40058
+ }
40059
+
40060
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
40061
+ _.label = op[1];
40062
+ break;
40063
+ }
40064
+
40065
+ if (op[0] === 6 && _.label < t[1]) {
40066
+ _.label = t[1];
40067
+ t = op;
40068
+ break;
40069
+ }
40070
+
40071
+ if (t && _.label < t[2]) {
40072
+ _.label = t[2];
40073
+
40074
+ _.ops.push(op);
40075
+
40076
+ break;
40077
+ }
40078
+
40079
+ if (t[2]) _.ops.pop();
40080
+
40081
+ _.trys.pop();
40082
+
40083
+ continue;
40084
+ }
40085
+
40086
+ op = body.call(thisArg, _);
40087
+ } catch (e) {
40088
+ op = [6, e];
40089
+ y = 0;
40090
+ } finally {
40091
+ f = t = 0;
40092
+ }
40093
+
40094
+ if (op[0] & 5) throw op[1];
40095
+ return {
40096
+ value: op[0] ? op[1] : void 0,
40097
+ done: true
40098
+ };
40099
+ }
40100
+ };
40101
+
40102
+ exports.__esModule = true;
40103
+ exports.getEnvironment = void 0;
40104
+
40105
+ var getEnvironmentContext_1 = __nccwpck_require__(4650);
40106
+
40107
+ var getEnvironmentVariables_1 = __nccwpck_require__(6602);
40108
+
40109
+ var getEnvironment = function (config, componentName, env, commitInfo) {
40110
+ return __awaiter(void 0, void 0, void 0, function () {
40111
+ var _a, envVars, secretEnvVarKeys, host, url, envContext, envType;
40112
+
40113
+ return __generator(this, function (_b) {
40114
+ switch (_b.label) {
40115
+ case 0:
40116
+ return [4
40117
+ /*yield*/
40118
+ , (0, getEnvironmentVariables_1.getEnvironmentVariables)(config, componentName, env, commitInfo)];
40119
+
40120
+ case 1:
40121
+ _a = _b.sent(), envVars = _a.envVars, secretEnvVarKeys = _a.secretEnvVarKeys, host = _a.host, url = _a.url;
40122
+ envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
40123
+ envType = envContext.envType;
40124
+ return [2
40125
+ /*return*/
40126
+ , {
40127
+ envType: envType,
40128
+ host: host,
40129
+ url: url,
40130
+ gitlabEnvironment: {
40131
+ name: envContext.gitlabEnvironmentName,
40132
+ url: url
40133
+ },
40134
+ fullName: envContext.fullName,
40135
+ slug: envContext.environmentSlug,
40136
+ shortName: env,
40137
+ envVars: envVars,
40138
+ secretEnvVarKeys: secretEnvVarKeys
40139
+ }];
40140
+ }
40141
+ });
40142
+ });
40143
+ };
40144
+
40145
+ exports.getEnvironment = getEnvironment;
40146
+
40147
+ /***/ }),
40148
+
40149
+ /***/ 4650:
40150
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
40151
+
40152
+ "use strict";
40153
+
40154
+
40155
+ exports.__esModule = true;
40156
+ exports.getEnvironmentContext = void 0;
40157
+
40158
+ var getEnvConfig_1 = __nccwpck_require__(5706);
40159
+
40160
+ var getEnvType_1 = __nccwpck_require__(4811);
40161
+
40162
+ var getEnvironmentSlug = function (envConfig, env, componentName, commitInfo) {
40163
+ var envType = (0, getEnvType_1.getEnvType)(env, envConfig);
40164
+ return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
40165
+ };
40166
+
40167
+ var getEnvironmentContext = function (config, env, componentName, commitInfo) {
40168
+ var envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env);
40169
+ var envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw);
40170
+ var environmentSlug = getEnvironmentSlug(envConfigRaw, env, componentName, commitInfo);
40171
+ var gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
40172
+ var fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
40173
+ return {
40174
+ envConfigRaw: envConfigRaw,
40175
+ deployConfigRaw: envConfigRaw.deploy,
40176
+ buildConfigRaw: envConfigRaw.build,
40177
+ environmentSlug: environmentSlug,
40178
+ gitlabEnvironmentName: gitlabEnvironmentName,
40179
+ fullName: fullName,
40180
+ envType: envType,
40181
+ commitInfo: commitInfo,
40182
+ componentName: componentName,
40183
+ env: env,
40184
+ fullConfig: config
40185
+ };
40186
+ };
40187
+
40188
+ exports.getEnvironmentContext = getEnvironmentContext;
40189
+
40190
+ /***/ }),
40191
+
40192
+ /***/ 6602:
40193
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
40194
+
40195
+ "use strict";
40196
+
40197
+
39896
40198
  var __assign = this && this.__assign || function () {
39897
40199
  __assign = Object.assign || function (t) {
39898
40200
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -40084,60 +40386,41 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
40084
40386
  };
40085
40387
 
40086
40388
  exports.__esModule = true;
40087
- exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironment = void 0;
40389
+ exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironmentVariables = void 0;
40088
40390
 
40089
40391
  var lodash_1 = __nccwpck_require__(3255);
40090
40392
 
40091
40393
  var deploy_1 = __nccwpck_require__(223);
40092
40394
 
40093
- var config_1 = __nccwpck_require__(9997);
40094
-
40095
- var utils_1 = __nccwpck_require__(7461);
40395
+ var getEnvironmentContext_1 = __nccwpck_require__(4650);
40096
40396
 
40097
40397
  var resolveReferences_1 = __nccwpck_require__(928);
40098
40398
 
40099
- var getEnvironment = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
40399
+ var getEnvironmentVariables = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
40100
40400
  ) {
40101
40401
  if (alreadyVisited === void 0) {
40102
40402
  alreadyVisited = {};
40103
40403
  }
40104
40404
 
40105
40405
  return __awaiter(void 0, void 0, void 0, function () {
40106
- var envConfig, envType, basePredefinedVariables, gitlabEnvironmentName, environmentSlug, predefinedVariables, host, url, fullName, envVarContext, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
40406
+ var environmentContext, envConfigRaw, deployConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
40107
40407
 
40108
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
40408
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
40109
40409
 
40110
- return __generator(this, function (_l) {
40111
- switch (_l.label) {
40410
+ return __generator(this, function (_k) {
40411
+ switch (_k.label) {
40112
40412
  case 0:
40113
- envConfig = getEnvConfig(config, componentName, env);
40114
- envType = (_a = envConfig === null || envConfig === void 0 ? void 0 : envConfig.type) !== null && _a !== void 0 ? _a : (0, config_1.isKnowEnvType)(env) ? env : null;
40115
-
40116
- if (!envType) {
40117
- throw new Error("Missing type in environment " + env + " in component " + componentName);
40118
- }
40119
-
40413
+ environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
40414
+ envConfigRaw = environmentContext.envConfigRaw, deployConfigRaw = environmentContext.deployConfigRaw, envType = environmentContext.envType;
40120
40415
  basePredefinedVariables = {
40121
40416
  ENV_SHORT: env,
40122
- APP_DIR: envConfig.dir,
40417
+ APP_DIR: envConfigRaw.dir,
40123
40418
  ENV_TYPE: envType
40124
40419
  };
40125
- gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
40126
- environmentSlug = envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
40127
- fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
40128
- envVarContext = {
40129
- deployConfig: envConfig.deploy,
40130
- fullName: fullName,
40131
- envType: envType,
40132
- commitInfo: commitInfo,
40133
- componentName: componentName,
40134
- env: env,
40135
- fullConfig: config
40136
- };
40137
40420
 
40138
40421
  if (envType === "local") {
40139
- devLocalConfig = envConfig;
40140
- port = (_b = devLocalConfig.port) !== null && _b !== void 0 ? _b : 3000;
40422
+ devLocalConfig = envConfigRaw;
40423
+ port = (_a = devLocalConfig.port) !== null && _a !== void 0 ? _a : 3000;
40141
40424
  host = "localhost:" + port;
40142
40425
  url = "http://" + host;
40143
40426
  predefinedVariables = {
@@ -40146,8 +40429,8 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
40146
40429
  PORT: port.toString()
40147
40430
  };
40148
40431
  } else {
40149
- additionalEnvVars = envConfig.deploy ? deploy_1.DEPLOY_TYPES[envConfig.deploy.type].getAdditionalEnvVars(envVarContext) : {};
40150
- host = (_d = (_c = envConfig === null || envConfig === void 0 ? void 0 : envConfig.host) !== null && _c !== void 0 ? _c : additionalEnvVars.HOST_CANONICAL) !== null && _d !== void 0 ? _d : "unknown-host.example.com";
40432
+ additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
40433
+ 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";
40151
40434
  url = "https://".concat(host);
40152
40435
  predefinedVariables = __assign(__assign(__assign({}, basePredefinedVariables), {
40153
40436
  HOST: host,
@@ -40155,13 +40438,13 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
40155
40438
  }), additionalEnvVars);
40156
40439
  }
40157
40440
 
40158
- publicEnvVarsRaw = (_f = (_e = envConfig.vars) === null || _e === void 0 ? void 0 : _e.public) !== null && _f !== void 0 ? _f : {};
40159
- additionalSecretKeys = envConfig.deploy ? deploy_1.DEPLOY_TYPES[envConfig.deploy.type].additionalSecretKeys(envVarContext) : [];
40160
- secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_h = (_g = envConfig.vars) === null || _g === void 0 ? void 0 : _g.secret) !== null && _h !== void 0 ? _h : []), false), __read(additionalSecretKeys), false);
40441
+ publicEnvVarsRaw = (_e = (_d = envConfigRaw.vars) === null || _d === void 0 ? void 0 : _d.public) !== null && _e !== void 0 ? _e : {};
40442
+ additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
40443
+ 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);
40161
40444
  secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
40162
40445
  return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
40163
40446
  }));
40164
- legacyFromComponents = (_k = (_j = envConfig.vars) === null || _j === void 0 ? void 0 : _j.fromComponents) !== null && _k !== void 0 ? _k : {};
40447
+ legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
40165
40448
  publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
40166
40449
  publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
40167
40450
  var _b = __read(_a, 2),
@@ -40173,50 +40456,42 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
40173
40456
  envVarsRaw = addIndexVar(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized));
40174
40457
  return [4
40175
40458
  /*yield*/
40176
- , (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (componentName, variableName, alreadyVisited) {
40459
+ , (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (otherComponentName, variableName, alreadyVisited) {
40177
40460
  return __awaiter(void 0, void 0, void 0, function () {
40178
- var envVars;
40461
+ var otherEnvVars;
40179
40462
  return __generator(this, function (_a) {
40180
40463
  switch (_a.label) {
40181
40464
  case 0:
40182
40465
  return [4
40183
40466
  /*yield*/
40184
- , (0, exports.getEnvironment)(config, componentName, env, commitInfo, alreadyVisited)];
40467
+ , (0, exports.getEnvironmentVariables)(config, otherComponentName, env, commitInfo, alreadyVisited)];
40185
40468
 
40186
40469
  case 1:
40187
- envVars = _a.sent().envVars;
40470
+ otherEnvVars = _a.sent().envVars;
40188
40471
  return [2
40189
40472
  /*return*/
40190
- , envVars[variableName]];
40473
+ , otherEnvVars[variableName]];
40191
40474
  }
40192
40475
  });
40193
40476
  });
40194
40477
  }, alreadyVisited)];
40195
40478
 
40196
40479
  case 1:
40197
- envVars = _l.sent();
40480
+ envVars = _k.sent();
40198
40481
  return [2
40199
40482
  /*return*/
40200
40483
  , {
40201
- envType: envType,
40202
- host: host,
40203
- url: url,
40204
- gitlabEnvironment: {
40205
- name: gitlabEnvironmentName,
40206
- url: url
40207
- },
40208
- fullName: fullName,
40209
- slug: environmentSlug,
40210
- shortName: env,
40211
40484
  envVars: envVars,
40212
- secretEnvVarKeys: secretEnvVarKeys
40485
+ secretEnvVarKeys: secretEnvVarKeys,
40486
+ host: host,
40487
+ url: url
40213
40488
  }];
40214
40489
  }
40215
40490
  });
40216
40491
  });
40217
40492
  };
40218
40493
 
40219
- exports.getEnvironment = getEnvironment;
40494
+ exports.getEnvironmentVariables = getEnvironmentVariables;
40220
40495
 
40221
40496
  var sanitizeForEnVar = function (s) {
40222
40497
  return s.replace(/-/g, "_");
@@ -40241,24 +40516,6 @@ var getSecretVarNameForContext = function (context, key) {
40241
40516
 
40242
40517
  exports.getSecretVarNameForContext = getSecretVarNameForContext;
40243
40518
 
40244
- var getEnvConfig = function (config, componentName, env) {
40245
- var _a, _b;
40246
-
40247
- var defaultConfig = config.components[componentName];
40248
-
40249
- if (!defaultConfig) {
40250
- throw new Error("unknown component " + componentName);
40251
- }
40252
-
40253
- var envCustomizations = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
40254
-
40255
- if (envCustomizations === false) {
40256
- throw new Error("env is disabled: " + env);
40257
- }
40258
-
40259
- return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
40260
- };
40261
-
40262
40519
  /***/ }),
40263
40520
 
40264
40521
  /***/ 486:
@@ -40492,34 +40749,30 @@ var utils_1 = __nccwpck_require__(7461);
40492
40749
 
40493
40750
  var getEnvironment_1 = __nccwpck_require__(740);
40494
40751
 
40752
+ var getEnvironmentContext_1 = __nccwpck_require__(4650);
40753
+
40495
40754
  __exportStar(__nccwpck_require__(740), exports);
40496
40755
 
40756
+ __exportStar(__nccwpck_require__(6602), exports);
40757
+
40497
40758
  var createContext = function (config, componentName, env, commitInfo, packageManagerInfo) {
40498
40759
  return __awaiter(void 0, void 0, void 0, function () {
40499
- var rawConfig, envConfig, componentConfigWithoutDefaults, defaults, componentConfig;
40760
+ var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
40500
40761
 
40501
40762
  var _a;
40502
40763
 
40503
- var _b, _c;
40504
-
40505
- return __generator(this, function (_d) {
40506
- switch (_d.label) {
40764
+ return __generator(this, function (_b) {
40765
+ switch (_b.label) {
40507
40766
  case 0:
40508
40767
  if (!/^[a-z0-9-]+$/.test(componentName)) {
40509
40768
  throw new Error("componentName may only contain lower case letters, numbers and -");
40510
40769
  }
40511
40770
 
40512
- rawConfig = config.components[componentName];
40513
-
40514
- if (!rawConfig) {
40515
- throw new Error("unknown component " + componentName);
40516
- }
40517
-
40518
- envConfig = (_c = (_b = rawConfig.env) === null || _b === void 0 ? void 0 : _b[env]) !== null && _c !== void 0 ? _c : {};
40519
- componentConfigWithoutDefaults = (0, utils_1.mergeWithMergingArrays)(rawConfig, envConfig);
40771
+ envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
40772
+ componentConfigWithoutDefaults = envContext.envConfigRaw;
40520
40773
  defaults = componentConfigWithoutDefaults.deploy ? {
40521
- build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(),
40522
- deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults()
40774
+ build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
40775
+ deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext)
40523
40776
  } : {
40524
40777
  build: {},
40525
40778
  deploy: {}
@@ -40537,7 +40790,7 @@ var createContext = function (config, componentName, env, commitInfo, packageMan
40537
40790
  case 1:
40538
40791
  return [2
40539
40792
  /*return*/
40540
- , (_a.environment = _d.sent(), _a.commitInfo = commitInfo, _a.packageManagerInfo = packageManagerInfo, _a)];
40793
+ , (_a.environment = _b.sent(), _a.commitInfo = commitInfo, _a.packageManagerInfo = packageManagerInfo, _a)];
40541
40794
  }
40542
40795
  });
40543
40796
  });
@@ -41107,6 +41360,8 @@ var types_1 = __nccwpck_require__(3109);
41107
41360
 
41108
41361
  var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(2607);
41109
41362
 
41363
+ var gitlab_1 = __nccwpck_require__(4997);
41364
+
41110
41365
  var createGoogleCloudRunDeployJobs = function (context) {
41111
41366
  var _a, _b;
41112
41367
 
@@ -41148,12 +41403,12 @@ var createGoogleCloudRunDeployJobs = function (context) {
41148
41403
  return "gcloud run deploy ".concat(serviceName, " ").concat(commandArg, " ").concat(commonDeployArgs, " --env-vars-file=____envvars.yaml --allow-unauthenticated");
41149
41404
  };
41150
41405
 
41151
- var getJobDeployScripts = function (jobName, job) {
41406
+ var getJobCreateScripts = function (jobName, job) {
41152
41407
  // due to some oversight from google, jobs create does not accept `--env-vars-file` 🤦
41153
41408
  // lucky, update on the other hand accepts it... so let's just imediatly update it
41154
41409
  // also we cannot upsert a job, so we have to create it and catch the error and then update
41155
41410
  var args = "".concat(jobName, " --command=\"").concat(job.command.split(" ").join(","), "\" ").concat(commonDeployArgs);
41156
- return ["set +e", "gcloud beta run jobs create ".concat(args), "set -e", "gcloud beta run jobs update ".concat(args, " --env-vars-file=____envvars.yaml")];
41411
+ return __spreadArray(__spreadArray([], __read((0, gitlab_1.allowFailureInScripts)(["gcloud beta run jobs create ".concat(args)])), false), ["gcloud beta run jobs update ".concat(args, " --env-vars-file=____envvars.yaml")], false);
41157
41412
  };
41158
41413
 
41159
41414
  var getJobRunScript = function (jobName) {
@@ -41172,13 +41427,25 @@ var createGoogleCloudRunDeployJobs = function (context) {
41172
41427
  return [getFullJobName(name), job];
41173
41428
  });
41174
41429
 
41175
- var cloudRunDeployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(["echo \"$ENV_VARS\" > ____envvars.yaml"], __read(jobsWithNames.map(function (_a) {
41430
+ var cloudRunDeployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(["echo \"$ENV_VARS\" > ____envvars.yaml", "cat ____envvars.yaml"], __read(jobsWithNames.map(function (_a) {
41431
+ var _b = __read(_a, 2),
41432
+ name = _b[0],
41433
+ job = _b[1];
41434
+
41435
+ return getJobCreateScripts(name, job);
41436
+ }).flat()), false), __read(jobsWithNames.filter(function (_a) {
41437
+ var _b = __read(_a, 2),
41438
+ name = _b[0],
41439
+ job = _b[1];
41440
+
41441
+ return job.when === "preDeploy";
41442
+ }).map(function (_a) {
41176
41443
  var _b = __read(_a, 2),
41177
41444
  name = _b[0],
41178
41445
  job = _b[1];
41179
41446
 
41180
- return getJobDeployScripts(name, job);
41181
- }).flat()), false), __read(deployConfig.service !== false ? [getServiceDeployScript(deployConfig.service)] : []), false), __read(jobsWithNames.filter(function (_a) {
41447
+ return getJobRunScript(name);
41448
+ })), false), __read(deployConfig.service !== false ? [getServiceDeployScript(deployConfig.service)] : []), false), __read(jobsWithNames.filter(function (_a) {
41182
41449
  var _b = __read(_a, 2),
41183
41450
  name = _b[0],
41184
41451
  job = _b[1];
@@ -41290,18 +41557,18 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
41290
41557
  additionalSecretKeys: function () {
41291
41558
  return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
41292
41559
  },
41293
- getAdditionalEnvVars: function (_a) {
41294
- var fullName = _a.fullName,
41295
- env = _a.env,
41296
- componentName = _a.componentName,
41297
- deployConfig = _a.deployConfig;
41560
+ getAdditionalEnvVars: function (ctx) {
41561
+ var fullName = ctx.fullName,
41562
+ env = ctx.env,
41563
+ componentName = ctx.componentName,
41564
+ deployConfigRaw = ctx.deployConfigRaw;
41298
41565
  var HOST_CANONICAL = fullName.toLowerCase() + "-" + process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)];
41299
- var jobTriggers = deployConfig && deployConfig.jobs ? Object.fromEntries(Object.entries(deployConfig.jobs).map(function (_a) {
41566
+ var jobTriggers = deployConfigRaw && deployConfigRaw.jobs ? Object.fromEntries(Object.entries(deployConfigRaw.jobs).map(function (_a) {
41300
41567
  var _b = __read(_a, 2),
41301
41568
  name = _b[0],
41302
41569
  job = _b[1];
41303
41570
 
41304
- return ["CLOUD_RUN_JOB_TRIGGER_URL_" + name, "https://".concat(deployConfig.region, "-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/").concat(deployConfig.projectId, "/jobs/").concat(name, ":run")];
41571
+ return ["CLOUD_RUN_JOB_TRIGGER_URL_" + name, "https://".concat(deployConfigRaw.region, "-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/").concat(deployConfigRaw.projectId, "/jobs/").concat(name, ":run")];
41305
41572
  })) : {};
41306
41573
  return __assign({
41307
41574
  HOST_CANONICAL: HOST_CANONICAL
@@ -41570,16 +41837,16 @@ var dockerTag_1 = __nccwpck_require__(8990);
41570
41837
 
41571
41838
  var kubernetes_1 = __nccwpck_require__(5682);
41572
41839
 
41840
+ __exportStar(__nccwpck_require__(1344), exports);
41841
+
41842
+ __exportStar(__nccwpck_require__(3539), exports);
41843
+
41573
41844
  __exportStar(__nccwpck_require__(5682), exports);
41574
41845
 
41575
41846
  __exportStar(__nccwpck_require__(3109), exports);
41576
41847
 
41577
41848
  __exportStar(__nccwpck_require__(2757), exports);
41578
41849
 
41579
- __exportStar(__nccwpck_require__(3539), exports);
41580
-
41581
- __exportStar(__nccwpck_require__(1344), exports);
41582
-
41583
41850
  exports.DEPLOY_TYPES = {
41584
41851
  kubernetes: kubernetes_1.KUBERNETES_DEPLOY_TYPE,
41585
41852
  custom: custom_1.CUSTOM_DEPLOY_TYPE,
@@ -41601,23 +41868,23 @@ exports.additionalKubernetesSecretKeys = void 0;
41601
41868
  var additionalKubernetesSecretKeys = function (_a) {
41602
41869
  var _b, _c, _d, _e;
41603
41870
 
41604
- var deployConfig = _a.deployConfig;
41871
+ var deployConfigRaw = _a.deployConfigRaw;
41605
41872
 
41606
- if (!deployConfig) {
41873
+ if (!deployConfigRaw) {
41607
41874
  return [];
41608
41875
  }
41609
41876
 
41610
41877
  var keys = [];
41611
41878
 
41612
- if ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) {
41879
+ if ((_c = (_b = deployConfigRaw.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) {
41613
41880
  keys.push("MONGODB_ROOT_PASSWORD");
41614
41881
 
41615
- if (deployConfig.values.mongodb.architecture === "replicaset") {
41882
+ if (deployConfigRaw.values.mongodb.architecture === "replicaset") {
41616
41883
  keys.push("MONGODB_REPLICASET_KEY");
41617
41884
  }
41618
41885
  }
41619
41886
 
41620
- if ((_e = (_d = deployConfig.values) === null || _d === void 0 ? void 0 : _d.cloudsql) === null || _e === void 0 ? void 0 : _e.enabled) {
41887
+ if ((_e = (_d = deployConfigRaw.values) === null || _d === void 0 ? void 0 : _d.cloudsql) === null || _e === void 0 ? void 0 : _e.enabled) {
41621
41888
  keys.push("POSTGRESQL_PASSWORD");
41622
41889
  keys.push("cloudsqlProxyCredentials");
41623
41890
  }
@@ -41820,7 +42087,7 @@ exports.KUBERNETES_DEPLOY_TYPE = {
41820
42087
 
41821
42088
  var componentName = _a.componentName,
41822
42089
  fullConfig = _a.fullConfig,
41823
- deployConfig = _a.deployConfig,
42090
+ deployConfigRaw = _a.deployConfigRaw,
41824
42091
  env = _a.env,
41825
42092
  envType = _a.envType,
41826
42093
  commitInfo = _a.commitInfo;
@@ -41829,7 +42096,7 @@ exports.KUBERNETES_DEPLOY_TYPE = {
41829
42096
  var KUBE_NAMESPACE = (0, __1.getKubernetesNamespace)(fullConfig, env);
41830
42097
  var componentSlug = (0, slugify_1["default"])(componentName);
41831
42098
  var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
41832
- var domainCanonical = deployConfig && ((_b = deployConfig.cluster) === null || _b === void 0 ? void 0 : _b.domainCanonical) || // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
42099
+ var domainCanonical = deployConfigRaw && ((_b = deployConfigRaw.cluster) === null || _b === void 0 ? void 0 : _b.domainCanonical) || // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
41833
42100
  fullConfig.domainCanonical || "panter.cloud";
41834
42101
  var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
41835
42102
 
@@ -43783,6 +44050,59 @@ exports.__esModule = true;
43783
44050
 
43784
44051
  /***/ }),
43785
44052
 
44053
+ /***/ 4997:
44054
+ /***/ (function(__unused_webpack_module, exports) {
44055
+
44056
+ "use strict";
44057
+
44058
+
44059
+ var __read = this && this.__read || function (o, n) {
44060
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
44061
+ if (!m) return o;
44062
+ var i = m.call(o),
44063
+ r,
44064
+ ar = [],
44065
+ e;
44066
+
44067
+ try {
44068
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44069
+ } catch (error) {
44070
+ e = {
44071
+ error: error
44072
+ };
44073
+ } finally {
44074
+ try {
44075
+ if (r && !r.done && (m = i["return"])) m.call(i);
44076
+ } finally {
44077
+ if (e) throw e.error;
44078
+ }
44079
+ }
44080
+
44081
+ return ar;
44082
+ };
44083
+
44084
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
44085
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
44086
+ if (ar || !(i in from)) {
44087
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
44088
+ ar[i] = from[i];
44089
+ }
44090
+ }
44091
+ return to.concat(ar || Array.prototype.slice.call(from));
44092
+ };
44093
+
44094
+ exports.__esModule = true;
44095
+ exports.allowFailureInScripts = void 0;
44096
+
44097
+ var allowFailureInScripts = function (script) {
44098
+ return __spreadArray(__spreadArray(["set +e"], __read(script), false), ["set -e" // reenable
44099
+ ], false);
44100
+ };
44101
+
44102
+ exports.allowFailureInScripts = allowFailureInScripts;
44103
+
44104
+ /***/ }),
44105
+
43786
44106
  /***/ 7461:
43787
44107
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
43788
44108