@catladder/cli 0.0.0-main-e651ab49 → 0.0.0-main-5bc1bdb9

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.
@@ -39882,7 +39882,7 @@ exports.readConfigSync = readConfigSync;
39882
39882
 
39883
39883
  exports.__esModule = true;
39884
39884
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
39885
- exports.PIPELINE_IMAGE_TAG = "main-e651ab49" || 0;
39885
+ exports.PIPELINE_IMAGE_TAG = "main-5bc1bdb9" || 0;
39886
39886
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
39887
39887
 
39888
39888
  /***/ }),
@@ -40083,52 +40083,19 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
40083
40083
  return to.concat(ar || Array.prototype.slice.call(from));
40084
40084
  };
40085
40085
 
40086
- var __importDefault = this && this.__importDefault || function (mod) {
40087
- return mod && mod.__esModule ? mod : {
40088
- "default": mod
40089
- };
40090
- };
40091
-
40092
40086
  exports.__esModule = true;
40093
- exports.getEnvironment = exports.getSecretVarNameForContext = exports.getSecretVarName = void 0;
40087
+ exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironment = void 0;
40094
40088
 
40095
40089
  var lodash_1 = __nccwpck_require__(3255);
40096
40090
 
40097
- var slugify_1 = __importDefault(__nccwpck_require__(4035));
40098
-
40099
40091
  var deploy_1 = __nccwpck_require__(223);
40100
40092
 
40101
- var types_1 = __nccwpck_require__(3109);
40102
-
40103
40093
  var config_1 = __nccwpck_require__(9997);
40104
40094
 
40105
40095
  var utils_1 = __nccwpck_require__(7461);
40106
40096
 
40107
40097
  var resolveReferences_1 = __nccwpck_require__(928);
40108
40098
 
40109
- var sanitizeForEnVar = function (s) {
40110
- return s.replace(/-/g, "_");
40111
- };
40112
-
40113
- var getSecretVarName = function (env, componentName, key) {
40114
- return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
40115
- }; // remove dash from component name
40116
-
40117
-
40118
- exports.getSecretVarName = getSecretVarName;
40119
-
40120
- var addIndexVar = function (vars) {
40121
- return __assign(__assign({}, vars), {
40122
- _ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars))
40123
- });
40124
- };
40125
-
40126
- var getSecretVarNameForContext = function (context, key) {
40127
- return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
40128
- };
40129
-
40130
- exports.getSecretVarNameForContext = getSecretVarNameForContext;
40131
-
40132
40099
  var getEnvironment = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
40133
40100
  ) {
40134
40101
  if (alreadyVisited === void 0) {
@@ -40136,27 +40103,15 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
40136
40103
  }
40137
40104
 
40138
40105
  return __awaiter(void 0, void 0, void 0, function () {
40139
- var defaultConfig, envConfig, mergedConfig, envType, basePredefinedVariables, gitlabEnvironmentName, environmentSlug, predefinedVariables, host, url, fullName, devLocalConfig, port, componentSlug, envInUrl, domainCanonical, HOST_CANONICAL, KUBE_APP_NAME_PREFIX, KUBE_APP_NAME, KUBE_NAMESPACE, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
40106
+ var envConfig, envType, basePredefinedVariables, gitlabEnvironmentName, environmentSlug, predefinedVariables, host, url, fullName, envVarContext, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
40140
40107
 
40141
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
40108
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
40142
40109
 
40143
- return __generator(this, function (_o) {
40144
- switch (_o.label) {
40110
+ return __generator(this, function (_l) {
40111
+ switch (_l.label) {
40145
40112
  case 0:
40146
- defaultConfig = config.components[componentName];
40147
-
40148
- if (!defaultConfig) {
40149
- throw new Error("unknown component " + componentName);
40150
- }
40151
-
40152
- envConfig = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
40153
-
40154
- if (envConfig === false) {
40155
- throw new Error("env is disabled: " + env);
40156
- }
40157
-
40158
- mergedConfig = (0, utils_1.mergeWithMergingArrays)(defaultConfig, envConfig);
40159
- envType = (_c = envConfig === null || envConfig === void 0 ? void 0 : envConfig.type) !== null && _c !== void 0 ? _c : (0, config_1.isKnowEnvType)(env) ? env : null;
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;
40160
40115
 
40161
40116
  if (!envType) {
40162
40117
  throw new Error("Missing type in environment " + env + " in component " + componentName);
@@ -40164,16 +40119,25 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
40164
40119
 
40165
40120
  basePredefinedVariables = {
40166
40121
  ENV_SHORT: env,
40167
- APP_DIR: mergedConfig.dir,
40122
+ APP_DIR: envConfig.dir,
40168
40123
  ENV_TYPE: envType
40169
40124
  };
40170
40125
  gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
40171
40126
  environmentSlug = envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
40172
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
+ };
40173
40137
 
40174
40138
  if (envType === "local") {
40175
- devLocalConfig = mergedConfig;
40176
- port = (_d = devLocalConfig.port) !== null && _d !== void 0 ? _d : 3000;
40139
+ devLocalConfig = envConfig;
40140
+ port = (_b = devLocalConfig.port) !== null && _b !== void 0 ? _b : 3000;
40177
40141
  host = "localhost:" + port;
40178
40142
  url = "http://" + host;
40179
40143
  predefinedVariables = {
@@ -40182,34 +40146,22 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
40182
40146
  PORT: port.toString()
40183
40147
  };
40184
40148
  } else {
40185
- componentSlug = (0, slugify_1["default"])(componentName);
40186
- envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
40187
- domainCanonical = (mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.deploy) && (mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.deploy.type) === "kubernetes" && ((_e = mergedConfig.deploy.cluster) === null || _e === void 0 ? void 0 : _e.domainCanonical) || // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
40188
- config.domainCanonical || "panter.cloud";
40189
- HOST_CANONICAL = (0, types_1.isOfDeployType)(mergedConfig.deploy, "google-cloudrun") ? fullName.toLowerCase() + "-" + process.env[(0, exports.getSecretVarName)(env, componentName, deploy_1.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)] : "".concat(componentSlug, ".").concat(envInUrl, ".").concat(config.appName, ".").concat(config.customerName, ".").concat(domainCanonical);
40190
- host = (_f = mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.host) !== null && _f !== void 0 ? _f : HOST_CANONICAL;
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";
40191
40151
  url = "https://".concat(host);
40192
- KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
40193
- KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
40194
- KUBE_NAMESPACE = (0, deploy_1.getKubernetesNamespace)(config, env);
40195
- predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
40196
- HOST_CANONICAL: HOST_CANONICAL,
40152
+ predefinedVariables = __assign(__assign(__assign({}, basePredefinedVariables), {
40197
40153
  HOST: host,
40198
- ROOT_URL: url,
40199
- KUBE_NAMESPACE: KUBE_NAMESPACE,
40200
- KUBE_APP_NAME: KUBE_APP_NAME,
40201
- KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX
40202
- });
40154
+ ROOT_URL: url
40155
+ }), additionalEnvVars);
40203
40156
  }
40204
40157
 
40205
- publicEnvVarsRaw = (_h = (_g = mergedConfig.vars) === null || _g === void 0 ? void 0 : _g.public) !== null && _h !== void 0 ? _h : {};
40206
- additionalSecretKeys = mergedConfig.deploy ? deploy_1.DEPLOY_TYPES[mergedConfig.deploy.type].additionalSecretKeys( // eslint-disable-next-line @typescript-eslint/no-explicit-any
40207
- mergedConfig.deploy) : [];
40208
- secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_k = (_j = mergedConfig.vars) === null || _j === void 0 ? void 0 : _j.secret) !== null && _k !== void 0 ? _k : []), false), __read(additionalSecretKeys), false);
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);
40209
40161
  secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
40210
40162
  return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
40211
40163
  }));
40212
- legacyFromComponents = (_m = (_l = mergedConfig.vars) === null || _l === void 0 ? void 0 : _l.fromComponents) !== null && _m !== void 0 ? _m : {};
40164
+ legacyFromComponents = (_k = (_j = envConfig.vars) === null || _j === void 0 ? void 0 : _j.fromComponents) !== null && _k !== void 0 ? _k : {};
40213
40165
  publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
40214
40166
  publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
40215
40167
  var _b = __read(_a, 2),
@@ -40242,7 +40194,7 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
40242
40194
  }, alreadyVisited)];
40243
40195
 
40244
40196
  case 1:
40245
- envVars = _o.sent();
40197
+ envVars = _l.sent();
40246
40198
  return [2
40247
40199
  /*return*/
40248
40200
  , {
@@ -40266,6 +40218,47 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
40266
40218
 
40267
40219
  exports.getEnvironment = getEnvironment;
40268
40220
 
40221
+ var sanitizeForEnVar = function (s) {
40222
+ return s.replace(/-/g, "_");
40223
+ };
40224
+
40225
+ var getSecretVarName = function (env, componentName, key) {
40226
+ return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
40227
+ }; // remove dash from component name
40228
+
40229
+
40230
+ exports.getSecretVarName = getSecretVarName;
40231
+
40232
+ var addIndexVar = function (vars) {
40233
+ return __assign(__assign({}, vars), {
40234
+ _ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars))
40235
+ });
40236
+ };
40237
+
40238
+ var getSecretVarNameForContext = function (context, key) {
40239
+ return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
40240
+ };
40241
+
40242
+ exports.getSecretVarNameForContext = getSecretVarNameForContext;
40243
+
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
+
40269
40262
  /***/ }),
40270
40263
 
40271
40264
  /***/ 486:
@@ -41094,7 +41087,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
41094
41087
  };
41095
41088
 
41096
41089
  exports.__esModule = true;
41097
- exports.createDeployJob = void 0;
41090
+ exports.createGoogleCloudRunDeployJobs = void 0;
41098
41091
 
41099
41092
  var js_yaml_1 = __nccwpck_require__(3618);
41100
41093
 
@@ -41114,16 +41107,16 @@ var types_1 = __nccwpck_require__(3109);
41114
41107
 
41115
41108
  var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(2607);
41116
41109
 
41117
- var createDeployJob = function (context) {
41110
+ var createGoogleCloudRunDeployJobs = function (context) {
41118
41111
  var deployConfig = context.componentConfig.deploy;
41119
41112
 
41120
41113
  if (deployConfig === false) {
41121
41114
  return [];
41122
41115
  }
41123
41116
 
41124
- if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
41117
+ if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun", "google-cloudrun-job")) {
41125
41118
  // should not happen
41126
- throw new Error("deploy config is not custom");
41119
+ throw new Error("deploy config is wrong");
41127
41120
  }
41128
41121
 
41129
41122
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
@@ -41134,7 +41127,6 @@ var createDeployJob = function (context) {
41134
41127
  var pushImageToArtifactsRegistry = __spreadArray(__spreadArray([docker_1.gitlabDockerLogin], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud auth configure-docker ".concat(deployConfig.region, "-docker.pkg.dev"), "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG ".concat(gcloudImageName), "docker push ".concat(gcloudImageName)], false);
41135
41128
 
41136
41129
  var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, _1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
41137
- var serviceName = context.environment.fullName.toLowerCase();
41138
41130
  var labelsString = Object.entries((0, getLabels_1.getLabels)(context)).map(function (_a) {
41139
41131
  var _b = __read(_a, 2),
41140
41132
  key = _b[0],
@@ -41142,9 +41134,39 @@ var createDeployJob = function (context) {
41142
41134
 
41143
41135
  return "".concat(key, "=").concat(value);
41144
41136
  }).join(",");
41145
- var command = context.componentConfig.build.startCommand ? "--command=\"".concat(context.componentConfig.build.startCommand.split(" ").join(","), "\"") : ""; // TODO: split secrets out
41137
+ var commonArgs = "--project ".concat(deployConfig.projectId, " --region=").concat(deployConfig.region);
41138
+
41139
+ var getDeployCommand = function () {
41140
+ var _a;
41141
+
41142
+ var name = context.environment.fullName.toLowerCase();
41143
+ var command = (_a = deployConfig.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand;
41144
+ var commandArg = command ? "--command=\"".concat(command.split(" ").join(","), "\"") : "";
41145
+ var commonDeployArgs = "".concat(commandArg, " --image ").concat(gcloudImageName, " ").concat(commonArgs, " --env-vars-file=____envvars.yaml --labels ").concat(labelsString);
41146
+
41147
+ if (deployConfig.type === "google-cloudrun") {
41148
+ return "gcloud run deploy ".concat(name, " ").concat(commonDeployArgs, " --allow-unauthenticated");
41149
+ }
41150
+
41151
+ if (deployConfig.type === "google-cloudrun-job") {
41152
+ return "gcloud beta run jobs create ".concat(name, " ").concat(commonDeployArgs);
41153
+ }
41154
+ };
41155
+
41156
+ var getStopCommand = function () {
41157
+ var name = context.environment.fullName.toLowerCase();
41158
+ var commonStopArgs = "".concat(commonArgs, " --quiet");
41159
+
41160
+ if (deployConfig.type === "google-cloudrun") {
41161
+ return "gcloud run services delete ".concat(name, " ").concat(commonStopArgs);
41162
+ }
41163
+
41164
+ if (deployConfig.type === "google-cloudrun-job") {
41165
+ return "gcloud beta run jobs delete ".concat(name, " ").concat(commonStopArgs);
41166
+ }
41167
+ };
41146
41168
 
41147
- var cloudRunDeploy = ["echo \"$ENV_VARS\" > ____envvars.yaml", "gcloud run deploy ".concat(serviceName, " --image ").concat(gcloudImageName, " --region=").concat(deployConfig.region, " --allow-unauthenticated --project ").concat(deployConfig.projectId, " ").concat(command, " --env-vars-file=____envvars.yaml --labels ").concat(labelsString), "docker image rm ".concat(gcloudImageName)];
41169
+ var cloudRunDeploy = ["echo \"$ENV_VARS\" > ____envvars.yaml", getDeployCommand(), "docker image rm ".concat(gcloudImageName)];
41148
41170
  var baseStopJob = (0, base_1.getBaseDeploymentStopJob)(context);
41149
41171
  return [(0, lodash_1.merge)({}, baseDeploymentJob, (0, docker_1.getDockerJobBaseProps)(context), {
41150
41172
  artifacts: {
@@ -41161,11 +41183,11 @@ var createDeployJob = function (context) {
41161
41183
  script: __spreadArray(__spreadArray([], __read(pushImageToArtifactsRegistry), false), __read(cloudRunDeploy), false)
41162
41184
  }), (0, lodash_1.merge)({}, baseStopJob, {
41163
41185
  image: (0, runner_1.getRunnerImage)("gcloud"),
41164
- script: __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud run services delete ".concat(serviceName, " --project ").concat(deployConfig.projectId, " --region=").concat(deployConfig.region, " --quiet")], false)
41186
+ script: __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [getStopCommand()], false)
41165
41187
  })];
41166
41188
  };
41167
41189
 
41168
- exports.createDeployJob = createDeployJob;
41190
+ exports.createGoogleCloudRunDeployJobs = createGoogleCloudRunDeployJobs;
41169
41191
 
41170
41192
  /***/ }),
41171
41193
 
@@ -41176,21 +41198,59 @@ exports.createDeployJob = createDeployJob;
41176
41198
 
41177
41199
 
41178
41200
  exports.__esModule = true;
41179
- exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
41201
+ exports.GCLOUD_RUN_DEPLOY_TYPES = exports.GCLOUD_RUN_JOB_DEPLOY_TYPE = exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
41202
+
41203
+ var context_1 = __nccwpck_require__(2041);
41180
41204
 
41181
41205
  var deployJob_1 = __nccwpck_require__(2256);
41182
41206
 
41183
41207
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
41184
41208
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
41185
41209
  exports.GCLOUD_RUN_DEPLOY_TYPE = {
41186
- jobs: deployJob_1.createDeployJob,
41210
+ jobs: deployJob_1.createGoogleCloudRunDeployJobs,
41187
41211
  defaults: function () {
41188
41212
  return {};
41189
41213
  },
41190
41214
  additionalSecretKeys: function () {
41191
41215
  return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
41216
+ },
41217
+ getAdditionalEnvVars: function (_a) {
41218
+ var fullName = _a.fullName,
41219
+ env = _a.env,
41220
+ componentName = _a.componentName;
41221
+ var HOST_CANONICAL = fullName.toLowerCase() + "-" + process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)];
41222
+ return {
41223
+ HOST_CANONICAL: HOST_CANONICAL
41224
+ };
41192
41225
  }
41193
41226
  };
41227
+ exports.GCLOUD_RUN_JOB_DEPLOY_TYPE = {
41228
+ jobs: deployJob_1.createGoogleCloudRunDeployJobs,
41229
+ defaults: function () {
41230
+ return {};
41231
+ },
41232
+ additionalSecretKeys: function () {
41233
+ return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
41234
+ },
41235
+ getAdditionalEnvVars: function (_a) {
41236
+ var deployConfig = _a.deployConfig,
41237
+ fullName = _a.fullName;
41238
+
41239
+ if (!deployConfig) {
41240
+ return {};
41241
+ }
41242
+
41243
+ var jobName = fullName.toLowerCase();
41244
+ var CLOUD_RUN_JOB_TRIGGER_URL = "https://".concat(deployConfig.region, "-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/").concat(deployConfig.projectId, "/jobs/").concat(jobName, ":run");
41245
+ return {
41246
+ CLOUD_RUN_JOB_TRIGGER_URL: CLOUD_RUN_JOB_TRIGGER_URL
41247
+ };
41248
+ }
41249
+ };
41250
+ exports.GCLOUD_RUN_DEPLOY_TYPES = {
41251
+ "google-cloudrun": exports.GCLOUD_RUN_DEPLOY_TYPE,
41252
+ "google-cloudrun-job": exports.GCLOUD_RUN_JOB_DEPLOY_TYPE
41253
+ };
41194
41254
 
41195
41255
  /***/ }),
41196
41256
 
@@ -41345,6 +41405,9 @@ exports.CUSTOM_DEPLOY_TYPE = {
41345
41405
  },
41346
41406
  additionalSecretKeys: function () {
41347
41407
  return [];
41408
+ },
41409
+ getAdditionalEnvVars: function () {
41410
+ return {};
41348
41411
  }
41349
41412
  };
41350
41413
 
@@ -41408,6 +41471,9 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
41408
41471
  },
41409
41472
  additionalSecretKeys: function () {
41410
41473
  return [];
41474
+ },
41475
+ getAdditionalEnvVars: function () {
41476
+ return {};
41411
41477
  }
41412
41478
  };
41413
41479
 
@@ -41419,6 +41485,20 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
41419
41485
  "use strict";
41420
41486
 
41421
41487
 
41488
+ var __assign = this && this.__assign || function () {
41489
+ __assign = Object.assign || function (t) {
41490
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
41491
+ s = arguments[i];
41492
+
41493
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41494
+ }
41495
+
41496
+ return t;
41497
+ };
41498
+
41499
+ return __assign.apply(this, arguments);
41500
+ };
41501
+
41422
41502
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
41423
41503
  if (k2 === undefined) k2 = k;
41424
41504
  Object.defineProperty(o, k2, {
@@ -41457,12 +41537,11 @@ __exportStar(__nccwpck_require__(3539), exports);
41457
41537
 
41458
41538
  __exportStar(__nccwpck_require__(1344), exports);
41459
41539
 
41460
- exports.DEPLOY_TYPES = {
41540
+ exports.DEPLOY_TYPES = __assign({
41461
41541
  kubernetes: kubernetes_1.KUBERNETES_DEPLOY_TYPE,
41462
41542
  custom: custom_1.CUSTOM_DEPLOY_TYPE,
41463
- "google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE,
41464
41543
  dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE
41465
- };
41544
+ }, cloudRun_1.GCLOUD_RUN_DEPLOY_TYPES);
41466
41545
 
41467
41546
  /***/ }),
41468
41547
 
@@ -41475,20 +41554,26 @@ exports.DEPLOY_TYPES = {
41475
41554
  exports.__esModule = true;
41476
41555
  exports.additionalKubernetesSecretKeys = void 0;
41477
41556
 
41478
- var additionalKubernetesSecretKeys = function (config) {
41479
- var _a, _b, _c, _d;
41557
+ var additionalKubernetesSecretKeys = function (_a) {
41558
+ var _b, _c, _d, _e;
41559
+
41560
+ var deployConfig = _a.deployConfig;
41561
+
41562
+ if (!deployConfig) {
41563
+ return [];
41564
+ }
41480
41565
 
41481
41566
  var keys = [];
41482
41567
 
41483
- if ((_b = (_a = config.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) {
41568
+ if ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) {
41484
41569
  keys.push("MONGODB_ROOT_PASSWORD");
41485
41570
 
41486
- if (config.values.mongodb.architecture === "replicaset") {
41571
+ if (deployConfig.values.mongodb.architecture === "replicaset") {
41487
41572
  keys.push("MONGODB_REPLICASET_KEY");
41488
41573
  }
41489
41574
  }
41490
41575
 
41491
- if ((_d = (_c = config.values) === null || _c === void 0 ? void 0 : _c.cloudsql) === null || _d === void 0 ? void 0 : _d.enabled) {
41576
+ if ((_e = (_d = deployConfig.values) === null || _d === void 0 ? void 0 : _d.cloudsql) === null || _e === void 0 ? void 0 : _e.enabled) {
41492
41577
  keys.push("POSTGRESQL_PASSWORD");
41493
41578
  keys.push("cloudsqlProxyCredentials");
41494
41579
  }
@@ -41658,14 +41743,24 @@ exports.createKubernetesDeployJobs = createKubernetesDeployJobs;
41658
41743
  /***/ }),
41659
41744
 
41660
41745
  /***/ 5682:
41661
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
41746
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
41662
41747
 
41663
41748
  "use strict";
41664
41749
 
41665
41750
 
41751
+ var __importDefault = this && this.__importDefault || function (mod) {
41752
+ return mod && mod.__esModule ? mod : {
41753
+ "default": mod
41754
+ };
41755
+ };
41756
+
41666
41757
  exports.__esModule = true;
41667
41758
  exports.KUBERNETES_DEPLOY_TYPE = void 0;
41668
41759
 
41760
+ var slugify_1 = __importDefault(__nccwpck_require__(4035));
41761
+
41762
+ var __1 = __nccwpck_require__(223);
41763
+
41669
41764
  var additionalSecretKeys_1 = __nccwpck_require__(5775);
41670
41765
 
41671
41766
  var deployJob_1 = __nccwpck_require__(9792);
@@ -41675,7 +41770,32 @@ exports.KUBERNETES_DEPLOY_TYPE = {
41675
41770
  defaults: function () {
41676
41771
  return {};
41677
41772
  },
41678
- additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys
41773
+ additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys,
41774
+ getAdditionalEnvVars: function (_a) {
41775
+ var _b;
41776
+
41777
+ var componentName = _a.componentName,
41778
+ fullConfig = _a.fullConfig,
41779
+ deployConfig = _a.deployConfig,
41780
+ env = _a.env,
41781
+ envType = _a.envType,
41782
+ commitInfo = _a.commitInfo;
41783
+ var KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
41784
+ var KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
41785
+ var KUBE_NAMESPACE = (0, __1.getKubernetesNamespace)(fullConfig, env);
41786
+ var componentSlug = (0, slugify_1["default"])(componentName);
41787
+ var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
41788
+ 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
41789
+ fullConfig.domainCanonical || "panter.cloud";
41790
+ var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
41791
+
41792
+ return {
41793
+ KUBE_NAMESPACE: KUBE_NAMESPACE,
41794
+ KUBE_APP_NAME: KUBE_APP_NAME,
41795
+ KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
41796
+ HOST_CANONICAL: HOST_CANONICAL
41797
+ };
41798
+ }
41679
41799
  };
41680
41800
 
41681
41801
  /***/ }),