@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.
@@ -350753,7 +350753,7 @@ exports.readConfigSync = readConfigSync;
350753
350753
 
350754
350754
  exports.__esModule = true;
350755
350755
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
350756
- exports.PIPELINE_IMAGE_TAG = "main-e651ab49" || 0;
350756
+ exports.PIPELINE_IMAGE_TAG = "main-5bc1bdb9" || 0;
350757
350757
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
350758
350758
 
350759
350759
  /***/ }),
@@ -350954,52 +350954,19 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
350954
350954
  return to.concat(ar || Array.prototype.slice.call(from));
350955
350955
  };
350956
350956
 
350957
- var __importDefault = this && this.__importDefault || function (mod) {
350958
- return mod && mod.__esModule ? mod : {
350959
- "default": mod
350960
- };
350961
- };
350962
-
350963
350957
  exports.__esModule = true;
350964
- exports.getEnvironment = exports.getSecretVarNameForContext = exports.getSecretVarName = void 0;
350958
+ exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironment = void 0;
350965
350959
 
350966
350960
  var lodash_1 = __nccwpck_require__(23255);
350967
350961
 
350968
- var slugify_1 = __importDefault(__nccwpck_require__(44035));
350969
-
350970
350962
  var deploy_1 = __nccwpck_require__(90223);
350971
350963
 
350972
- var types_1 = __nccwpck_require__(63109);
350973
-
350974
350964
  var config_1 = __nccwpck_require__(19997);
350975
350965
 
350976
350966
  var utils_1 = __nccwpck_require__(37461);
350977
350967
 
350978
350968
  var resolveReferences_1 = __nccwpck_require__(80928);
350979
350969
 
350980
- var sanitizeForEnVar = function (s) {
350981
- return s.replace(/-/g, "_");
350982
- };
350983
-
350984
- var getSecretVarName = function (env, componentName, key) {
350985
- return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
350986
- }; // remove dash from component name
350987
-
350988
-
350989
- exports.getSecretVarName = getSecretVarName;
350990
-
350991
- var addIndexVar = function (vars) {
350992
- return __assign(__assign({}, vars), {
350993
- _ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars))
350994
- });
350995
- };
350996
-
350997
- var getSecretVarNameForContext = function (context, key) {
350998
- return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
350999
- };
351000
-
351001
- exports.getSecretVarNameForContext = getSecretVarNameForContext;
351002
-
351003
350970
  var getEnvironment = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
351004
350971
  ) {
351005
350972
  if (alreadyVisited === void 0) {
@@ -351007,27 +350974,15 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
351007
350974
  }
351008
350975
 
351009
350976
  return __awaiter(void 0, void 0, void 0, function () {
351010
- 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;
350977
+ var envConfig, envType, basePredefinedVariables, gitlabEnvironmentName, environmentSlug, predefinedVariables, host, url, fullName, envVarContext, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
351011
350978
 
351012
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
350979
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
351013
350980
 
351014
- return __generator(this, function (_o) {
351015
- switch (_o.label) {
350981
+ return __generator(this, function (_l) {
350982
+ switch (_l.label) {
351016
350983
  case 0:
351017
- defaultConfig = config.components[componentName];
351018
-
351019
- if (!defaultConfig) {
351020
- throw new Error("unknown component " + componentName);
351021
- }
351022
-
351023
- envConfig = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
351024
-
351025
- if (envConfig === false) {
351026
- throw new Error("env is disabled: " + env);
351027
- }
351028
-
351029
- mergedConfig = (0, utils_1.mergeWithMergingArrays)(defaultConfig, envConfig);
351030
- envType = (_c = envConfig === null || envConfig === void 0 ? void 0 : envConfig.type) !== null && _c !== void 0 ? _c : (0, config_1.isKnowEnvType)(env) ? env : null;
350984
+ envConfig = getEnvConfig(config, componentName, env);
350985
+ envType = (_a = envConfig === null || envConfig === void 0 ? void 0 : envConfig.type) !== null && _a !== void 0 ? _a : (0, config_1.isKnowEnvType)(env) ? env : null;
351031
350986
 
351032
350987
  if (!envType) {
351033
350988
  throw new Error("Missing type in environment " + env + " in component " + componentName);
@@ -351035,16 +350990,25 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
351035
350990
 
351036
350991
  basePredefinedVariables = {
351037
350992
  ENV_SHORT: env,
351038
- APP_DIR: mergedConfig.dir,
350993
+ APP_DIR: envConfig.dir,
351039
350994
  ENV_TYPE: envType
351040
350995
  };
351041
350996
  gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
351042
350997
  environmentSlug = envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
351043
350998
  fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
350999
+ envVarContext = {
351000
+ deployConfig: envConfig.deploy,
351001
+ fullName: fullName,
351002
+ envType: envType,
351003
+ commitInfo: commitInfo,
351004
+ componentName: componentName,
351005
+ env: env,
351006
+ fullConfig: config
351007
+ };
351044
351008
 
351045
351009
  if (envType === "local") {
351046
- devLocalConfig = mergedConfig;
351047
- port = (_d = devLocalConfig.port) !== null && _d !== void 0 ? _d : 3000;
351010
+ devLocalConfig = envConfig;
351011
+ port = (_b = devLocalConfig.port) !== null && _b !== void 0 ? _b : 3000;
351048
351012
  host = "localhost:" + port;
351049
351013
  url = "http://" + host;
351050
351014
  predefinedVariables = {
@@ -351053,34 +351017,22 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
351053
351017
  PORT: port.toString()
351054
351018
  };
351055
351019
  } else {
351056
- componentSlug = (0, slugify_1["default"])(componentName);
351057
- envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
351058
- 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
351059
- config.domainCanonical || "panter.cloud";
351060
- 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);
351061
- host = (_f = mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.host) !== null && _f !== void 0 ? _f : HOST_CANONICAL;
351020
+ additionalEnvVars = envConfig.deploy ? deploy_1.DEPLOY_TYPES[envConfig.deploy.type].getAdditionalEnvVars(envVarContext) : {};
351021
+ 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";
351062
351022
  url = "https://".concat(host);
351063
- KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
351064
- KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
351065
- KUBE_NAMESPACE = (0, deploy_1.getKubernetesNamespace)(config, env);
351066
- predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
351067
- HOST_CANONICAL: HOST_CANONICAL,
351023
+ predefinedVariables = __assign(__assign(__assign({}, basePredefinedVariables), {
351068
351024
  HOST: host,
351069
- ROOT_URL: url,
351070
- KUBE_NAMESPACE: KUBE_NAMESPACE,
351071
- KUBE_APP_NAME: KUBE_APP_NAME,
351072
- KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX
351073
- });
351025
+ ROOT_URL: url
351026
+ }), additionalEnvVars);
351074
351027
  }
351075
351028
 
351076
- publicEnvVarsRaw = (_h = (_g = mergedConfig.vars) === null || _g === void 0 ? void 0 : _g.public) !== null && _h !== void 0 ? _h : {};
351077
- additionalSecretKeys = mergedConfig.deploy ? deploy_1.DEPLOY_TYPES[mergedConfig.deploy.type].additionalSecretKeys( // eslint-disable-next-line @typescript-eslint/no-explicit-any
351078
- mergedConfig.deploy) : [];
351079
- 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);
351029
+ publicEnvVarsRaw = (_f = (_e = envConfig.vars) === null || _e === void 0 ? void 0 : _e.public) !== null && _f !== void 0 ? _f : {};
351030
+ additionalSecretKeys = envConfig.deploy ? deploy_1.DEPLOY_TYPES[envConfig.deploy.type].additionalSecretKeys(envVarContext) : [];
351031
+ 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);
351080
351032
  secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
351081
351033
  return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
351082
351034
  }));
351083
- legacyFromComponents = (_m = (_l = mergedConfig.vars) === null || _l === void 0 ? void 0 : _l.fromComponents) !== null && _m !== void 0 ? _m : {};
351035
+ legacyFromComponents = (_k = (_j = envConfig.vars) === null || _j === void 0 ? void 0 : _j.fromComponents) !== null && _k !== void 0 ? _k : {};
351084
351036
  publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
351085
351037
  publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
351086
351038
  var _b = __read(_a, 2),
@@ -351113,7 +351065,7 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
351113
351065
  }, alreadyVisited)];
351114
351066
 
351115
351067
  case 1:
351116
- envVars = _o.sent();
351068
+ envVars = _l.sent();
351117
351069
  return [2
351118
351070
  /*return*/
351119
351071
  , {
@@ -351137,6 +351089,47 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
351137
351089
 
351138
351090
  exports.getEnvironment = getEnvironment;
351139
351091
 
351092
+ var sanitizeForEnVar = function (s) {
351093
+ return s.replace(/-/g, "_");
351094
+ };
351095
+
351096
+ var getSecretVarName = function (env, componentName, key) {
351097
+ return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
351098
+ }; // remove dash from component name
351099
+
351100
+
351101
+ exports.getSecretVarName = getSecretVarName;
351102
+
351103
+ var addIndexVar = function (vars) {
351104
+ return __assign(__assign({}, vars), {
351105
+ _ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars))
351106
+ });
351107
+ };
351108
+
351109
+ var getSecretVarNameForContext = function (context, key) {
351110
+ return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
351111
+ };
351112
+
351113
+ exports.getSecretVarNameForContext = getSecretVarNameForContext;
351114
+
351115
+ var getEnvConfig = function (config, componentName, env) {
351116
+ var _a, _b;
351117
+
351118
+ var defaultConfig = config.components[componentName];
351119
+
351120
+ if (!defaultConfig) {
351121
+ throw new Error("unknown component " + componentName);
351122
+ }
351123
+
351124
+ var envCustomizations = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
351125
+
351126
+ if (envCustomizations === false) {
351127
+ throw new Error("env is disabled: " + env);
351128
+ }
351129
+
351130
+ return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
351131
+ };
351132
+
351140
351133
  /***/ }),
351141
351134
 
351142
351135
  /***/ 30486:
@@ -351965,7 +351958,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
351965
351958
  };
351966
351959
 
351967
351960
  exports.__esModule = true;
351968
- exports.createDeployJob = void 0;
351961
+ exports.createGoogleCloudRunDeployJobs = void 0;
351969
351962
 
351970
351963
  var js_yaml_1 = __nccwpck_require__(3618);
351971
351964
 
@@ -351985,16 +351978,16 @@ var types_1 = __nccwpck_require__(63109);
351985
351978
 
351986
351979
  var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(22607);
351987
351980
 
351988
- var createDeployJob = function (context) {
351981
+ var createGoogleCloudRunDeployJobs = function (context) {
351989
351982
  var deployConfig = context.componentConfig.deploy;
351990
351983
 
351991
351984
  if (deployConfig === false) {
351992
351985
  return [];
351993
351986
  }
351994
351987
 
351995
- if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
351988
+ if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun", "google-cloudrun-job")) {
351996
351989
  // should not happen
351997
- throw new Error("deploy config is not custom");
351990
+ throw new Error("deploy config is wrong");
351998
351991
  }
351999
351992
 
352000
351993
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
@@ -352005,7 +351998,6 @@ var createDeployJob = function (context) {
352005
351998
  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);
352006
351999
 
352007
352000
  var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, _1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
352008
- var serviceName = context.environment.fullName.toLowerCase();
352009
352001
  var labelsString = Object.entries((0, getLabels_1.getLabels)(context)).map(function (_a) {
352010
352002
  var _b = __read(_a, 2),
352011
352003
  key = _b[0],
@@ -352013,9 +352005,39 @@ var createDeployJob = function (context) {
352013
352005
 
352014
352006
  return "".concat(key, "=").concat(value);
352015
352007
  }).join(",");
352016
- var command = context.componentConfig.build.startCommand ? "--command=\"".concat(context.componentConfig.build.startCommand.split(" ").join(","), "\"") : ""; // TODO: split secrets out
352008
+ var commonArgs = "--project ".concat(deployConfig.projectId, " --region=").concat(deployConfig.region);
352009
+
352010
+ var getDeployCommand = function () {
352011
+ var _a;
352012
+
352013
+ var name = context.environment.fullName.toLowerCase();
352014
+ var command = (_a = deployConfig.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand;
352015
+ var commandArg = command ? "--command=\"".concat(command.split(" ").join(","), "\"") : "";
352016
+ var commonDeployArgs = "".concat(commandArg, " --image ").concat(gcloudImageName, " ").concat(commonArgs, " --env-vars-file=____envvars.yaml --labels ").concat(labelsString);
352017
+
352018
+ if (deployConfig.type === "google-cloudrun") {
352019
+ return "gcloud run deploy ".concat(name, " ").concat(commonDeployArgs, " --allow-unauthenticated");
352020
+ }
352021
+
352022
+ if (deployConfig.type === "google-cloudrun-job") {
352023
+ return "gcloud beta run jobs create ".concat(name, " ").concat(commonDeployArgs);
352024
+ }
352025
+ };
352026
+
352027
+ var getStopCommand = function () {
352028
+ var name = context.environment.fullName.toLowerCase();
352029
+ var commonStopArgs = "".concat(commonArgs, " --quiet");
352030
+
352031
+ if (deployConfig.type === "google-cloudrun") {
352032
+ return "gcloud run services delete ".concat(name, " ").concat(commonStopArgs);
352033
+ }
352034
+
352035
+ if (deployConfig.type === "google-cloudrun-job") {
352036
+ return "gcloud beta run jobs delete ".concat(name, " ").concat(commonStopArgs);
352037
+ }
352038
+ };
352017
352039
 
352018
- 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)];
352040
+ var cloudRunDeploy = ["echo \"$ENV_VARS\" > ____envvars.yaml", getDeployCommand(), "docker image rm ".concat(gcloudImageName)];
352019
352041
  var baseStopJob = (0, base_1.getBaseDeploymentStopJob)(context);
352020
352042
  return [(0, lodash_1.merge)({}, baseDeploymentJob, (0, docker_1.getDockerJobBaseProps)(context), {
352021
352043
  artifacts: {
@@ -352032,11 +352054,11 @@ var createDeployJob = function (context) {
352032
352054
  script: __spreadArray(__spreadArray([], __read(pushImageToArtifactsRegistry), false), __read(cloudRunDeploy), false)
352033
352055
  }), (0, lodash_1.merge)({}, baseStopJob, {
352034
352056
  image: (0, runner_1.getRunnerImage)("gcloud"),
352035
- 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)
352057
+ script: __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [getStopCommand()], false)
352036
352058
  })];
352037
352059
  };
352038
352060
 
352039
- exports.createDeployJob = createDeployJob;
352061
+ exports.createGoogleCloudRunDeployJobs = createGoogleCloudRunDeployJobs;
352040
352062
 
352041
352063
  /***/ }),
352042
352064
 
@@ -352047,21 +352069,59 @@ exports.createDeployJob = createDeployJob;
352047
352069
 
352048
352070
 
352049
352071
  exports.__esModule = true;
352050
- exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
352072
+ 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;
352073
+
352074
+ var context_1 = __nccwpck_require__(22041);
352051
352075
 
352052
352076
  var deployJob_1 = __nccwpck_require__(82256);
352053
352077
 
352054
352078
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
352055
352079
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
352056
352080
  exports.GCLOUD_RUN_DEPLOY_TYPE = {
352057
- jobs: deployJob_1.createDeployJob,
352081
+ jobs: deployJob_1.createGoogleCloudRunDeployJobs,
352058
352082
  defaults: function () {
352059
352083
  return {};
352060
352084
  },
352061
352085
  additionalSecretKeys: function () {
352062
352086
  return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
352087
+ },
352088
+ getAdditionalEnvVars: function (_a) {
352089
+ var fullName = _a.fullName,
352090
+ env = _a.env,
352091
+ componentName = _a.componentName;
352092
+ var HOST_CANONICAL = fullName.toLowerCase() + "-" + process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)];
352093
+ return {
352094
+ HOST_CANONICAL: HOST_CANONICAL
352095
+ };
352063
352096
  }
352064
352097
  };
352098
+ exports.GCLOUD_RUN_JOB_DEPLOY_TYPE = {
352099
+ jobs: deployJob_1.createGoogleCloudRunDeployJobs,
352100
+ defaults: function () {
352101
+ return {};
352102
+ },
352103
+ additionalSecretKeys: function () {
352104
+ return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
352105
+ },
352106
+ getAdditionalEnvVars: function (_a) {
352107
+ var deployConfig = _a.deployConfig,
352108
+ fullName = _a.fullName;
352109
+
352110
+ if (!deployConfig) {
352111
+ return {};
352112
+ }
352113
+
352114
+ var jobName = fullName.toLowerCase();
352115
+ 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");
352116
+ return {
352117
+ CLOUD_RUN_JOB_TRIGGER_URL: CLOUD_RUN_JOB_TRIGGER_URL
352118
+ };
352119
+ }
352120
+ };
352121
+ exports.GCLOUD_RUN_DEPLOY_TYPES = {
352122
+ "google-cloudrun": exports.GCLOUD_RUN_DEPLOY_TYPE,
352123
+ "google-cloudrun-job": exports.GCLOUD_RUN_JOB_DEPLOY_TYPE
352124
+ };
352065
352125
 
352066
352126
  /***/ }),
352067
352127
 
@@ -352216,6 +352276,9 @@ exports.CUSTOM_DEPLOY_TYPE = {
352216
352276
  },
352217
352277
  additionalSecretKeys: function () {
352218
352278
  return [];
352279
+ },
352280
+ getAdditionalEnvVars: function () {
352281
+ return {};
352219
352282
  }
352220
352283
  };
352221
352284
 
@@ -352279,6 +352342,9 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
352279
352342
  },
352280
352343
  additionalSecretKeys: function () {
352281
352344
  return [];
352345
+ },
352346
+ getAdditionalEnvVars: function () {
352347
+ return {};
352282
352348
  }
352283
352349
  };
352284
352350
 
@@ -352290,6 +352356,20 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
352290
352356
  "use strict";
352291
352357
 
352292
352358
 
352359
+ var __assign = this && this.__assign || function () {
352360
+ __assign = Object.assign || function (t) {
352361
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
352362
+ s = arguments[i];
352363
+
352364
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
352365
+ }
352366
+
352367
+ return t;
352368
+ };
352369
+
352370
+ return __assign.apply(this, arguments);
352371
+ };
352372
+
352293
352373
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
352294
352374
  if (k2 === undefined) k2 = k;
352295
352375
  Object.defineProperty(o, k2, {
@@ -352328,12 +352408,11 @@ __exportStar(__nccwpck_require__(13539), exports);
352328
352408
 
352329
352409
  __exportStar(__nccwpck_require__(81344), exports);
352330
352410
 
352331
- exports.DEPLOY_TYPES = {
352411
+ exports.DEPLOY_TYPES = __assign({
352332
352412
  kubernetes: kubernetes_1.KUBERNETES_DEPLOY_TYPE,
352333
352413
  custom: custom_1.CUSTOM_DEPLOY_TYPE,
352334
- "google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE,
352335
352414
  dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE
352336
- };
352415
+ }, cloudRun_1.GCLOUD_RUN_DEPLOY_TYPES);
352337
352416
 
352338
352417
  /***/ }),
352339
352418
 
@@ -352346,20 +352425,26 @@ exports.DEPLOY_TYPES = {
352346
352425
  exports.__esModule = true;
352347
352426
  exports.additionalKubernetesSecretKeys = void 0;
352348
352427
 
352349
- var additionalKubernetesSecretKeys = function (config) {
352350
- var _a, _b, _c, _d;
352428
+ var additionalKubernetesSecretKeys = function (_a) {
352429
+ var _b, _c, _d, _e;
352430
+
352431
+ var deployConfig = _a.deployConfig;
352432
+
352433
+ if (!deployConfig) {
352434
+ return [];
352435
+ }
352351
352436
 
352352
352437
  var keys = [];
352353
352438
 
352354
- if ((_b = (_a = config.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) {
352439
+ if ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) {
352355
352440
  keys.push("MONGODB_ROOT_PASSWORD");
352356
352441
 
352357
- if (config.values.mongodb.architecture === "replicaset") {
352442
+ if (deployConfig.values.mongodb.architecture === "replicaset") {
352358
352443
  keys.push("MONGODB_REPLICASET_KEY");
352359
352444
  }
352360
352445
  }
352361
352446
 
352362
- if ((_d = (_c = config.values) === null || _c === void 0 ? void 0 : _c.cloudsql) === null || _d === void 0 ? void 0 : _d.enabled) {
352447
+ if ((_e = (_d = deployConfig.values) === null || _d === void 0 ? void 0 : _d.cloudsql) === null || _e === void 0 ? void 0 : _e.enabled) {
352363
352448
  keys.push("POSTGRESQL_PASSWORD");
352364
352449
  keys.push("cloudsqlProxyCredentials");
352365
352450
  }
@@ -352529,14 +352614,24 @@ exports.createKubernetesDeployJobs = createKubernetesDeployJobs;
352529
352614
  /***/ }),
352530
352615
 
352531
352616
  /***/ 95682:
352532
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
352617
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
352533
352618
 
352534
352619
  "use strict";
352535
352620
 
352536
352621
 
352622
+ var __importDefault = this && this.__importDefault || function (mod) {
352623
+ return mod && mod.__esModule ? mod : {
352624
+ "default": mod
352625
+ };
352626
+ };
352627
+
352537
352628
  exports.__esModule = true;
352538
352629
  exports.KUBERNETES_DEPLOY_TYPE = void 0;
352539
352630
 
352631
+ var slugify_1 = __importDefault(__nccwpck_require__(44035));
352632
+
352633
+ var __1 = __nccwpck_require__(90223);
352634
+
352540
352635
  var additionalSecretKeys_1 = __nccwpck_require__(75775);
352541
352636
 
352542
352637
  var deployJob_1 = __nccwpck_require__(9792);
@@ -352546,7 +352641,32 @@ exports.KUBERNETES_DEPLOY_TYPE = {
352546
352641
  defaults: function () {
352547
352642
  return {};
352548
352643
  },
352549
- additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys
352644
+ additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys,
352645
+ getAdditionalEnvVars: function (_a) {
352646
+ var _b;
352647
+
352648
+ var componentName = _a.componentName,
352649
+ fullConfig = _a.fullConfig,
352650
+ deployConfig = _a.deployConfig,
352651
+ env = _a.env,
352652
+ envType = _a.envType,
352653
+ commitInfo = _a.commitInfo;
352654
+ var KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
352655
+ var KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
352656
+ var KUBE_NAMESPACE = (0, __1.getKubernetesNamespace)(fullConfig, env);
352657
+ var componentSlug = (0, slugify_1["default"])(componentName);
352658
+ var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
352659
+ 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
352660
+ fullConfig.domainCanonical || "panter.cloud";
352661
+ var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
352662
+
352663
+ return {
352664
+ KUBE_NAMESPACE: KUBE_NAMESPACE,
352665
+ KUBE_APP_NAME: KUBE_APP_NAME,
352666
+ KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
352667
+ HOST_CANONICAL: HOST_CANONICAL
352668
+ };
352669
+ }
352550
352670
  };
352551
352671
 
352552
352672
  /***/ }),