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

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-0009a81d" || 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,7 +351978,9 @@ 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) {
351982
+ var _a, _b;
351983
+
351989
351984
  var deployConfig = context.componentConfig.deploy;
351990
351985
 
351991
351986
  if (deployConfig === false) {
@@ -351994,7 +351989,7 @@ var createDeployJob = function (context) {
351994
351989
 
351995
351990
  if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
351996
351991
  // should not happen
351997
- throw new Error("deploy config is not custom");
351992
+ throw new Error("deploy config is wrong");
351998
351993
  }
351999
351994
 
352000
351995
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
@@ -352005,7 +352000,6 @@ var createDeployJob = function (context) {
352005
352000
  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
352001
 
352007
352002
  var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, _1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
352008
- var serviceName = context.environment.fullName.toLowerCase();
352009
352003
  var labelsString = Object.entries((0, getLabels_1.getLabels)(context)).map(function (_a) {
352010
352004
  var _b = __read(_a, 2),
352011
352005
  key = _b[0],
@@ -352013,15 +352007,77 @@ var createDeployJob = function (context) {
352013
352007
 
352014
352008
  return "".concat(key, "=").concat(value);
352015
352009
  }).join(",");
352016
- var command = context.componentConfig.build.startCommand ? "--command=\"".concat(context.componentConfig.build.startCommand.split(" ").join(","), "\"") : ""; // TODO: split secrets out
352010
+ var commonArgs = "--project ".concat(deployConfig.projectId, " --region=").concat(deployConfig.region);
352011
+ var commonDeployArgs = "--image ".concat(gcloudImageName, " ").concat(commonArgs, " --labels ").concat(labelsString);
352012
+ var serviceName = context.environment.fullName.toLowerCase();
352013
+
352014
+ var getServiceDeployScript = function (service) {
352015
+ var _a;
352016
+
352017
+ var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
352018
+ var commandArg = command ? "--command=\"".concat(command.split(" ").join(","), "\"") : "";
352019
+ return "gcloud run deploy ".concat(serviceName, " ").concat(commandArg, " ").concat(commonDeployArgs, " --env-vars-file=____envvars.yaml --allow-unauthenticated");
352020
+ };
352021
+
352022
+ var getJobDeployScripts = function (jobName, job) {
352023
+ // due to some oversight from google, jobs create does not accept `--env-vars-file` 🤦
352024
+ // lucky, update on the other hand accepts it... so let's just imediatly update it
352025
+ // also we cannot upsert a job, so we have to create it and catch the error and then update
352026
+ var args = "".concat(jobName, " --command=\"").concat(job.command.split(" ").join(","), "\" ").concat(commonDeployArgs);
352027
+ return ["set +e", "gcloud beta run jobs create ".concat(args), "set -e", "gcloud beta run jobs update ".concat(args, " --env-vars-file=____envvars.yaml")];
352028
+ };
352029
+
352030
+ var getJobRunScript = function (jobName) {
352031
+ return "gcloud beta run jobs execute ".concat(jobName, " ").concat(commonArgs);
352032
+ };
352033
+
352034
+ var getFullJobName = function (name) {
352035
+ return context.environment.fullName.toLowerCase() + "-" + name;
352036
+ };
352037
+
352038
+ var jobsWithNames = Object.entries((_a = deployConfig.jobs) !== null && _a !== void 0 ? _a : {}).map(function (_a) {
352039
+ var _b = __read(_a, 2),
352040
+ name = _b[0],
352041
+ job = _b[1];
352042
+
352043
+ return [getFullJobName(name), job];
352044
+ });
352045
+
352046
+ var cloudRunDeployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(["echo \"$ENV_VARS\" > ____envvars.yaml"], __read(jobsWithNames.map(function (_a) {
352047
+ var _b = __read(_a, 2),
352048
+ name = _b[0],
352049
+ job = _b[1];
352050
+
352051
+ return getJobDeployScripts(name, job);
352052
+ }).flat()), false), __read(deployConfig.service !== false ? [getServiceDeployScript(deployConfig.service)] : []), false), __read(jobsWithNames.filter(function (_a) {
352053
+ var _b = __read(_a, 2),
352054
+ name = _b[0],
352055
+ job = _b[1];
352056
+
352057
+ return job.when === "postDeploy";
352058
+ }).map(function (_a) {
352059
+ var _b = __read(_a, 2),
352060
+ name = _b[0],
352061
+ job = _b[1];
352062
+
352063
+ return getJobRunScript(name);
352064
+ })), false), ["docker image rm ".concat(gcloudImageName)], false);
352065
+
352066
+ var cloudRunStopScripts = __spreadArray(__spreadArray([], __read(deployConfig.service !== false ? ["gcloud run services delete ".concat(serviceName)] : []), false), __read(Object.entries((_b = deployConfig.jobs) !== null && _b !== void 0 ? _b : {}).map(function (_a) {
352067
+ var _b = __read(_a, 2),
352068
+ jobName = _b[0],
352069
+ job = _b[1];
352070
+
352071
+ return "gcloud beta run jobs delete ".concat(jobName);
352072
+ })), false);
352017
352073
 
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)];
352019
352074
  var baseStopJob = (0, base_1.getBaseDeploymentStopJob)(context);
352020
352075
  return [(0, lodash_1.merge)({}, baseDeploymentJob, (0, docker_1.getDockerJobBaseProps)(context), {
352021
352076
  artifacts: {
352022
352077
  paths: ["____envvars.yaml"]
352023
352078
  },
352024
352079
  variables: {
352080
+ CLOUDSDK_CORE_DISABLE_PROMPTS: "1",
352025
352081
  ENV_VARS: (0, js_yaml_1.dump)(allEnvVars, {
352026
352082
  lineWidth: -1,
352027
352083
  quotingType: "'",
@@ -352029,37 +352085,98 @@ var createDeployJob = function (context) {
352029
352085
  })
352030
352086
  },
352031
352087
  image: (0, runner_1.getRunnerImage)("gcloud"),
352032
- script: __spreadArray(__spreadArray([], __read(pushImageToArtifactsRegistry), false), __read(cloudRunDeploy), false)
352088
+ script: __spreadArray(__spreadArray([], __read(pushImageToArtifactsRegistry), false), __read(cloudRunDeployScripts), false)
352033
352089
  }), (0, lodash_1.merge)({}, baseStopJob, {
352034
352090
  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)
352091
+ variables: {
352092
+ CLOUDSDK_CORE_DISABLE_PROMPTS: "1"
352093
+ },
352094
+ script: __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(cloudRunStopScripts), false)
352036
352095
  })];
352037
352096
  };
352038
352097
 
352039
- exports.createDeployJob = createDeployJob;
352098
+ exports.createGoogleCloudRunDeployJobs = createGoogleCloudRunDeployJobs;
352040
352099
 
352041
352100
  /***/ }),
352042
352101
 
352043
352102
  /***/ 81344:
352044
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
352103
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
352045
352104
 
352046
352105
  "use strict";
352047
352106
 
352048
352107
 
352108
+ var __assign = this && this.__assign || function () {
352109
+ __assign = Object.assign || function (t) {
352110
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
352111
+ s = arguments[i];
352112
+
352113
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
352114
+ }
352115
+
352116
+ return t;
352117
+ };
352118
+
352119
+ return __assign.apply(this, arguments);
352120
+ };
352121
+
352122
+ var __read = this && this.__read || function (o, n) {
352123
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
352124
+ if (!m) return o;
352125
+ var i = m.call(o),
352126
+ r,
352127
+ ar = [],
352128
+ e;
352129
+
352130
+ try {
352131
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
352132
+ } catch (error) {
352133
+ e = {
352134
+ error: error
352135
+ };
352136
+ } finally {
352137
+ try {
352138
+ if (r && !r.done && (m = i["return"])) m.call(i);
352139
+ } finally {
352140
+ if (e) throw e.error;
352141
+ }
352142
+ }
352143
+
352144
+ return ar;
352145
+ };
352146
+
352049
352147
  exports.__esModule = true;
352050
352148
  exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
352051
352149
 
352150
+ var context_1 = __nccwpck_require__(22041);
352151
+
352052
352152
  var deployJob_1 = __nccwpck_require__(82256);
352053
352153
 
352054
352154
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
352055
352155
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
352056
352156
  exports.GCLOUD_RUN_DEPLOY_TYPE = {
352057
- jobs: deployJob_1.createDeployJob,
352157
+ jobs: deployJob_1.createGoogleCloudRunDeployJobs,
352058
352158
  defaults: function () {
352059
352159
  return {};
352060
352160
  },
352061
352161
  additionalSecretKeys: function () {
352062
352162
  return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
352163
+ },
352164
+ getAdditionalEnvVars: function (_a) {
352165
+ var fullName = _a.fullName,
352166
+ env = _a.env,
352167
+ componentName = _a.componentName,
352168
+ deployConfig = _a.deployConfig;
352169
+ var HOST_CANONICAL = fullName.toLowerCase() + "-" + process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)];
352170
+ var jobTriggers = deployConfig && deployConfig.jobs ? Object.fromEntries(Object.entries(deployConfig.jobs).map(function (_a) {
352171
+ var _b = __read(_a, 2),
352172
+ name = _b[0],
352173
+ job = _b[1];
352174
+
352175
+ 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")];
352176
+ })) : {};
352177
+ return __assign({
352178
+ HOST_CANONICAL: HOST_CANONICAL
352179
+ }, jobTriggers);
352063
352180
  }
352064
352181
  };
352065
352182
 
@@ -352216,6 +352333,9 @@ exports.CUSTOM_DEPLOY_TYPE = {
352216
352333
  },
352217
352334
  additionalSecretKeys: function () {
352218
352335
  return [];
352336
+ },
352337
+ getAdditionalEnvVars: function () {
352338
+ return {};
352219
352339
  }
352220
352340
  };
352221
352341
 
@@ -352279,6 +352399,9 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
352279
352399
  },
352280
352400
  additionalSecretKeys: function () {
352281
352401
  return [];
352402
+ },
352403
+ getAdditionalEnvVars: function () {
352404
+ return {};
352282
352405
  }
352283
352406
  };
352284
352407
 
@@ -352331,8 +352454,8 @@ __exportStar(__nccwpck_require__(81344), exports);
352331
352454
  exports.DEPLOY_TYPES = {
352332
352455
  kubernetes: kubernetes_1.KUBERNETES_DEPLOY_TYPE,
352333
352456
  custom: custom_1.CUSTOM_DEPLOY_TYPE,
352334
- "google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE,
352335
- dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE
352457
+ dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE,
352458
+ "google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE
352336
352459
  };
352337
352460
 
352338
352461
  /***/ }),
@@ -352346,20 +352469,26 @@ exports.DEPLOY_TYPES = {
352346
352469
  exports.__esModule = true;
352347
352470
  exports.additionalKubernetesSecretKeys = void 0;
352348
352471
 
352349
- var additionalKubernetesSecretKeys = function (config) {
352350
- var _a, _b, _c, _d;
352472
+ var additionalKubernetesSecretKeys = function (_a) {
352473
+ var _b, _c, _d, _e;
352474
+
352475
+ var deployConfig = _a.deployConfig;
352476
+
352477
+ if (!deployConfig) {
352478
+ return [];
352479
+ }
352351
352480
 
352352
352481
  var keys = [];
352353
352482
 
352354
- if ((_b = (_a = config.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) {
352483
+ if ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) {
352355
352484
  keys.push("MONGODB_ROOT_PASSWORD");
352356
352485
 
352357
- if (config.values.mongodb.architecture === "replicaset") {
352486
+ if (deployConfig.values.mongodb.architecture === "replicaset") {
352358
352487
  keys.push("MONGODB_REPLICASET_KEY");
352359
352488
  }
352360
352489
  }
352361
352490
 
352362
- if ((_d = (_c = config.values) === null || _c === void 0 ? void 0 : _c.cloudsql) === null || _d === void 0 ? void 0 : _d.enabled) {
352491
+ if ((_e = (_d = deployConfig.values) === null || _d === void 0 ? void 0 : _d.cloudsql) === null || _e === void 0 ? void 0 : _e.enabled) {
352363
352492
  keys.push("POSTGRESQL_PASSWORD");
352364
352493
  keys.push("cloudsqlProxyCredentials");
352365
352494
  }
@@ -352529,14 +352658,24 @@ exports.createKubernetesDeployJobs = createKubernetesDeployJobs;
352529
352658
  /***/ }),
352530
352659
 
352531
352660
  /***/ 95682:
352532
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
352661
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
352533
352662
 
352534
352663
  "use strict";
352535
352664
 
352536
352665
 
352666
+ var __importDefault = this && this.__importDefault || function (mod) {
352667
+ return mod && mod.__esModule ? mod : {
352668
+ "default": mod
352669
+ };
352670
+ };
352671
+
352537
352672
  exports.__esModule = true;
352538
352673
  exports.KUBERNETES_DEPLOY_TYPE = void 0;
352539
352674
 
352675
+ var slugify_1 = __importDefault(__nccwpck_require__(44035));
352676
+
352677
+ var __1 = __nccwpck_require__(90223);
352678
+
352540
352679
  var additionalSecretKeys_1 = __nccwpck_require__(75775);
352541
352680
 
352542
352681
  var deployJob_1 = __nccwpck_require__(9792);
@@ -352546,7 +352685,32 @@ exports.KUBERNETES_DEPLOY_TYPE = {
352546
352685
  defaults: function () {
352547
352686
  return {};
352548
352687
  },
352549
- additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys
352688
+ additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys,
352689
+ getAdditionalEnvVars: function (_a) {
352690
+ var _b;
352691
+
352692
+ var componentName = _a.componentName,
352693
+ fullConfig = _a.fullConfig,
352694
+ deployConfig = _a.deployConfig,
352695
+ env = _a.env,
352696
+ envType = _a.envType,
352697
+ commitInfo = _a.commitInfo;
352698
+ var KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
352699
+ var KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
352700
+ var KUBE_NAMESPACE = (0, __1.getKubernetesNamespace)(fullConfig, env);
352701
+ var componentSlug = (0, slugify_1["default"])(componentName);
352702
+ var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
352703
+ 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
352704
+ fullConfig.domainCanonical || "panter.cloud";
352705
+ var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
352706
+
352707
+ return {
352708
+ KUBE_NAMESPACE: KUBE_NAMESPACE,
352709
+ KUBE_APP_NAME: KUBE_APP_NAME,
352710
+ KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
352711
+ HOST_CANONICAL: HOST_CANONICAL
352712
+ };
352713
+ }
352550
352714
  };
352551
352715
 
352552
352716
  /***/ }),