@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.
- package/dist/bundles/catenv/index.js +262 -98
- package/dist/bundles/cli/index.js +262 -98
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -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-
|
|
39885
|
+
exports.PIPELINE_IMAGE_TAG = "main-0009a81d" || 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.
|
|
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
|
|
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
|
|
40108
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
40142
40109
|
|
|
40143
|
-
return __generator(this, function (
|
|
40144
|
-
switch (
|
|
40110
|
+
return __generator(this, function (_l) {
|
|
40111
|
+
switch (_l.label) {
|
|
40145
40112
|
case 0:
|
|
40146
|
-
|
|
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:
|
|
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 =
|
|
40176
|
-
port = (
|
|
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
|
-
|
|
40186
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 = (
|
|
40206
|
-
additionalSecretKeys =
|
|
40207
|
-
|
|
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 = (
|
|
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 =
|
|
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.
|
|
41090
|
+
exports.createGoogleCloudRunDeployJobs = void 0;
|
|
41098
41091
|
|
|
41099
41092
|
var js_yaml_1 = __nccwpck_require__(3618);
|
|
41100
41093
|
|
|
@@ -41114,7 +41107,9 @@ var types_1 = __nccwpck_require__(3109);
|
|
|
41114
41107
|
|
|
41115
41108
|
var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(2607);
|
|
41116
41109
|
|
|
41117
|
-
var
|
|
41110
|
+
var createGoogleCloudRunDeployJobs = function (context) {
|
|
41111
|
+
var _a, _b;
|
|
41112
|
+
|
|
41118
41113
|
var deployConfig = context.componentConfig.deploy;
|
|
41119
41114
|
|
|
41120
41115
|
if (deployConfig === false) {
|
|
@@ -41123,7 +41118,7 @@ var createDeployJob = function (context) {
|
|
|
41123
41118
|
|
|
41124
41119
|
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
41125
41120
|
// should not happen
|
|
41126
|
-
throw new Error("deploy config is
|
|
41121
|
+
throw new Error("deploy config is wrong");
|
|
41127
41122
|
}
|
|
41128
41123
|
|
|
41129
41124
|
var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
|
|
@@ -41134,7 +41129,6 @@ var createDeployJob = function (context) {
|
|
|
41134
41129
|
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
41130
|
|
|
41136
41131
|
var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, _1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
|
|
41137
|
-
var serviceName = context.environment.fullName.toLowerCase();
|
|
41138
41132
|
var labelsString = Object.entries((0, getLabels_1.getLabels)(context)).map(function (_a) {
|
|
41139
41133
|
var _b = __read(_a, 2),
|
|
41140
41134
|
key = _b[0],
|
|
@@ -41142,15 +41136,77 @@ var createDeployJob = function (context) {
|
|
|
41142
41136
|
|
|
41143
41137
|
return "".concat(key, "=").concat(value);
|
|
41144
41138
|
}).join(",");
|
|
41145
|
-
var
|
|
41139
|
+
var commonArgs = "--project ".concat(deployConfig.projectId, " --region=").concat(deployConfig.region);
|
|
41140
|
+
var commonDeployArgs = "--image ".concat(gcloudImageName, " ").concat(commonArgs, " --labels ").concat(labelsString);
|
|
41141
|
+
var serviceName = context.environment.fullName.toLowerCase();
|
|
41142
|
+
|
|
41143
|
+
var getServiceDeployScript = function (service) {
|
|
41144
|
+
var _a;
|
|
41145
|
+
|
|
41146
|
+
var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
|
|
41147
|
+
var commandArg = command ? "--command=\"".concat(command.split(" ").join(","), "\"") : "";
|
|
41148
|
+
return "gcloud run deploy ".concat(serviceName, " ").concat(commandArg, " ").concat(commonDeployArgs, " --env-vars-file=____envvars.yaml --allow-unauthenticated");
|
|
41149
|
+
};
|
|
41150
|
+
|
|
41151
|
+
var getJobDeployScripts = function (jobName, job) {
|
|
41152
|
+
// due to some oversight from google, jobs create does not accept `--env-vars-file` 🤦
|
|
41153
|
+
// lucky, update on the other hand accepts it... so let's just imediatly update it
|
|
41154
|
+
// also we cannot upsert a job, so we have to create it and catch the error and then update
|
|
41155
|
+
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")];
|
|
41157
|
+
};
|
|
41158
|
+
|
|
41159
|
+
var getJobRunScript = function (jobName) {
|
|
41160
|
+
return "gcloud beta run jobs execute ".concat(jobName, " ").concat(commonArgs);
|
|
41161
|
+
};
|
|
41162
|
+
|
|
41163
|
+
var getFullJobName = function (name) {
|
|
41164
|
+
return context.environment.fullName.toLowerCase() + "-" + name;
|
|
41165
|
+
};
|
|
41166
|
+
|
|
41167
|
+
var jobsWithNames = Object.entries((_a = deployConfig.jobs) !== null && _a !== void 0 ? _a : {}).map(function (_a) {
|
|
41168
|
+
var _b = __read(_a, 2),
|
|
41169
|
+
name = _b[0],
|
|
41170
|
+
job = _b[1];
|
|
41171
|
+
|
|
41172
|
+
return [getFullJobName(name), job];
|
|
41173
|
+
});
|
|
41174
|
+
|
|
41175
|
+
var cloudRunDeployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(["echo \"$ENV_VARS\" > ____envvars.yaml"], __read(jobsWithNames.map(function (_a) {
|
|
41176
|
+
var _b = __read(_a, 2),
|
|
41177
|
+
name = _b[0],
|
|
41178
|
+
job = _b[1];
|
|
41179
|
+
|
|
41180
|
+
return getJobDeployScripts(name, job);
|
|
41181
|
+
}).flat()), false), __read(deployConfig.service !== false ? [getServiceDeployScript(deployConfig.service)] : []), false), __read(jobsWithNames.filter(function (_a) {
|
|
41182
|
+
var _b = __read(_a, 2),
|
|
41183
|
+
name = _b[0],
|
|
41184
|
+
job = _b[1];
|
|
41185
|
+
|
|
41186
|
+
return job.when === "postDeploy";
|
|
41187
|
+
}).map(function (_a) {
|
|
41188
|
+
var _b = __read(_a, 2),
|
|
41189
|
+
name = _b[0],
|
|
41190
|
+
job = _b[1];
|
|
41191
|
+
|
|
41192
|
+
return getJobRunScript(name);
|
|
41193
|
+
})), false), ["docker image rm ".concat(gcloudImageName)], false);
|
|
41194
|
+
|
|
41195
|
+
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) {
|
|
41196
|
+
var _b = __read(_a, 2),
|
|
41197
|
+
jobName = _b[0],
|
|
41198
|
+
job = _b[1];
|
|
41199
|
+
|
|
41200
|
+
return "gcloud beta run jobs delete ".concat(jobName);
|
|
41201
|
+
})), false);
|
|
41146
41202
|
|
|
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)];
|
|
41148
41203
|
var baseStopJob = (0, base_1.getBaseDeploymentStopJob)(context);
|
|
41149
41204
|
return [(0, lodash_1.merge)({}, baseDeploymentJob, (0, docker_1.getDockerJobBaseProps)(context), {
|
|
41150
41205
|
artifacts: {
|
|
41151
41206
|
paths: ["____envvars.yaml"]
|
|
41152
41207
|
},
|
|
41153
41208
|
variables: {
|
|
41209
|
+
CLOUDSDK_CORE_DISABLE_PROMPTS: "1",
|
|
41154
41210
|
ENV_VARS: (0, js_yaml_1.dump)(allEnvVars, {
|
|
41155
41211
|
lineWidth: -1,
|
|
41156
41212
|
quotingType: "'",
|
|
@@ -41158,37 +41214,98 @@ var createDeployJob = function (context) {
|
|
|
41158
41214
|
})
|
|
41159
41215
|
},
|
|
41160
41216
|
image: (0, runner_1.getRunnerImage)("gcloud"),
|
|
41161
|
-
script: __spreadArray(__spreadArray([], __read(pushImageToArtifactsRegistry), false), __read(
|
|
41217
|
+
script: __spreadArray(__spreadArray([], __read(pushImageToArtifactsRegistry), false), __read(cloudRunDeployScripts), false)
|
|
41162
41218
|
}), (0, lodash_1.merge)({}, baseStopJob, {
|
|
41163
41219
|
image: (0, runner_1.getRunnerImage)("gcloud"),
|
|
41164
|
-
|
|
41220
|
+
variables: {
|
|
41221
|
+
CLOUDSDK_CORE_DISABLE_PROMPTS: "1"
|
|
41222
|
+
},
|
|
41223
|
+
script: __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(cloudRunStopScripts), false)
|
|
41165
41224
|
})];
|
|
41166
41225
|
};
|
|
41167
41226
|
|
|
41168
|
-
exports.
|
|
41227
|
+
exports.createGoogleCloudRunDeployJobs = createGoogleCloudRunDeployJobs;
|
|
41169
41228
|
|
|
41170
41229
|
/***/ }),
|
|
41171
41230
|
|
|
41172
41231
|
/***/ 1344:
|
|
41173
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__)
|
|
41232
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
41174
41233
|
|
|
41175
41234
|
"use strict";
|
|
41176
41235
|
|
|
41177
41236
|
|
|
41237
|
+
var __assign = this && this.__assign || function () {
|
|
41238
|
+
__assign = Object.assign || function (t) {
|
|
41239
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
41240
|
+
s = arguments[i];
|
|
41241
|
+
|
|
41242
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
41243
|
+
}
|
|
41244
|
+
|
|
41245
|
+
return t;
|
|
41246
|
+
};
|
|
41247
|
+
|
|
41248
|
+
return __assign.apply(this, arguments);
|
|
41249
|
+
};
|
|
41250
|
+
|
|
41251
|
+
var __read = this && this.__read || function (o, n) {
|
|
41252
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
41253
|
+
if (!m) return o;
|
|
41254
|
+
var i = m.call(o),
|
|
41255
|
+
r,
|
|
41256
|
+
ar = [],
|
|
41257
|
+
e;
|
|
41258
|
+
|
|
41259
|
+
try {
|
|
41260
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
41261
|
+
} catch (error) {
|
|
41262
|
+
e = {
|
|
41263
|
+
error: error
|
|
41264
|
+
};
|
|
41265
|
+
} finally {
|
|
41266
|
+
try {
|
|
41267
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
41268
|
+
} finally {
|
|
41269
|
+
if (e) throw e.error;
|
|
41270
|
+
}
|
|
41271
|
+
}
|
|
41272
|
+
|
|
41273
|
+
return ar;
|
|
41274
|
+
};
|
|
41275
|
+
|
|
41178
41276
|
exports.__esModule = true;
|
|
41179
41277
|
exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
|
|
41180
41278
|
|
|
41279
|
+
var context_1 = __nccwpck_require__(2041);
|
|
41280
|
+
|
|
41181
41281
|
var deployJob_1 = __nccwpck_require__(2256);
|
|
41182
41282
|
|
|
41183
41283
|
exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
|
|
41184
41284
|
exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
|
|
41185
41285
|
exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
41186
|
-
jobs: deployJob_1.
|
|
41286
|
+
jobs: deployJob_1.createGoogleCloudRunDeployJobs,
|
|
41187
41287
|
defaults: function () {
|
|
41188
41288
|
return {};
|
|
41189
41289
|
},
|
|
41190
41290
|
additionalSecretKeys: function () {
|
|
41191
41291
|
return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
|
|
41292
|
+
},
|
|
41293
|
+
getAdditionalEnvVars: function (_a) {
|
|
41294
|
+
var fullName = _a.fullName,
|
|
41295
|
+
env = _a.env,
|
|
41296
|
+
componentName = _a.componentName,
|
|
41297
|
+
deployConfig = _a.deployConfig;
|
|
41298
|
+
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) {
|
|
41300
|
+
var _b = __read(_a, 2),
|
|
41301
|
+
name = _b[0],
|
|
41302
|
+
job = _b[1];
|
|
41303
|
+
|
|
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")];
|
|
41305
|
+
})) : {};
|
|
41306
|
+
return __assign({
|
|
41307
|
+
HOST_CANONICAL: HOST_CANONICAL
|
|
41308
|
+
}, jobTriggers);
|
|
41192
41309
|
}
|
|
41193
41310
|
};
|
|
41194
41311
|
|
|
@@ -41345,6 +41462,9 @@ exports.CUSTOM_DEPLOY_TYPE = {
|
|
|
41345
41462
|
},
|
|
41346
41463
|
additionalSecretKeys: function () {
|
|
41347
41464
|
return [];
|
|
41465
|
+
},
|
|
41466
|
+
getAdditionalEnvVars: function () {
|
|
41467
|
+
return {};
|
|
41348
41468
|
}
|
|
41349
41469
|
};
|
|
41350
41470
|
|
|
@@ -41408,6 +41528,9 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
|
|
|
41408
41528
|
},
|
|
41409
41529
|
additionalSecretKeys: function () {
|
|
41410
41530
|
return [];
|
|
41531
|
+
},
|
|
41532
|
+
getAdditionalEnvVars: function () {
|
|
41533
|
+
return {};
|
|
41411
41534
|
}
|
|
41412
41535
|
};
|
|
41413
41536
|
|
|
@@ -41460,8 +41583,8 @@ __exportStar(__nccwpck_require__(1344), exports);
|
|
|
41460
41583
|
exports.DEPLOY_TYPES = {
|
|
41461
41584
|
kubernetes: kubernetes_1.KUBERNETES_DEPLOY_TYPE,
|
|
41462
41585
|
custom: custom_1.CUSTOM_DEPLOY_TYPE,
|
|
41463
|
-
|
|
41464
|
-
|
|
41586
|
+
dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE,
|
|
41587
|
+
"google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE
|
|
41465
41588
|
};
|
|
41466
41589
|
|
|
41467
41590
|
/***/ }),
|
|
@@ -41475,20 +41598,26 @@ exports.DEPLOY_TYPES = {
|
|
|
41475
41598
|
exports.__esModule = true;
|
|
41476
41599
|
exports.additionalKubernetesSecretKeys = void 0;
|
|
41477
41600
|
|
|
41478
|
-
var additionalKubernetesSecretKeys = function (
|
|
41479
|
-
var
|
|
41601
|
+
var additionalKubernetesSecretKeys = function (_a) {
|
|
41602
|
+
var _b, _c, _d, _e;
|
|
41603
|
+
|
|
41604
|
+
var deployConfig = _a.deployConfig;
|
|
41605
|
+
|
|
41606
|
+
if (!deployConfig) {
|
|
41607
|
+
return [];
|
|
41608
|
+
}
|
|
41480
41609
|
|
|
41481
41610
|
var keys = [];
|
|
41482
41611
|
|
|
41483
|
-
if ((
|
|
41612
|
+
if ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) {
|
|
41484
41613
|
keys.push("MONGODB_ROOT_PASSWORD");
|
|
41485
41614
|
|
|
41486
|
-
if (
|
|
41615
|
+
if (deployConfig.values.mongodb.architecture === "replicaset") {
|
|
41487
41616
|
keys.push("MONGODB_REPLICASET_KEY");
|
|
41488
41617
|
}
|
|
41489
41618
|
}
|
|
41490
41619
|
|
|
41491
|
-
if ((
|
|
41620
|
+
if ((_e = (_d = deployConfig.values) === null || _d === void 0 ? void 0 : _d.cloudsql) === null || _e === void 0 ? void 0 : _e.enabled) {
|
|
41492
41621
|
keys.push("POSTGRESQL_PASSWORD");
|
|
41493
41622
|
keys.push("cloudsqlProxyCredentials");
|
|
41494
41623
|
}
|
|
@@ -41658,14 +41787,24 @@ exports.createKubernetesDeployJobs = createKubernetesDeployJobs;
|
|
|
41658
41787
|
/***/ }),
|
|
41659
41788
|
|
|
41660
41789
|
/***/ 5682:
|
|
41661
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__)
|
|
41790
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
41662
41791
|
|
|
41663
41792
|
"use strict";
|
|
41664
41793
|
|
|
41665
41794
|
|
|
41795
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
41796
|
+
return mod && mod.__esModule ? mod : {
|
|
41797
|
+
"default": mod
|
|
41798
|
+
};
|
|
41799
|
+
};
|
|
41800
|
+
|
|
41666
41801
|
exports.__esModule = true;
|
|
41667
41802
|
exports.KUBERNETES_DEPLOY_TYPE = void 0;
|
|
41668
41803
|
|
|
41804
|
+
var slugify_1 = __importDefault(__nccwpck_require__(4035));
|
|
41805
|
+
|
|
41806
|
+
var __1 = __nccwpck_require__(223);
|
|
41807
|
+
|
|
41669
41808
|
var additionalSecretKeys_1 = __nccwpck_require__(5775);
|
|
41670
41809
|
|
|
41671
41810
|
var deployJob_1 = __nccwpck_require__(9792);
|
|
@@ -41675,7 +41814,32 @@ exports.KUBERNETES_DEPLOY_TYPE = {
|
|
|
41675
41814
|
defaults: function () {
|
|
41676
41815
|
return {};
|
|
41677
41816
|
},
|
|
41678
|
-
additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys
|
|
41817
|
+
additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys,
|
|
41818
|
+
getAdditionalEnvVars: function (_a) {
|
|
41819
|
+
var _b;
|
|
41820
|
+
|
|
41821
|
+
var componentName = _a.componentName,
|
|
41822
|
+
fullConfig = _a.fullConfig,
|
|
41823
|
+
deployConfig = _a.deployConfig,
|
|
41824
|
+
env = _a.env,
|
|
41825
|
+
envType = _a.envType,
|
|
41826
|
+
commitInfo = _a.commitInfo;
|
|
41827
|
+
var KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
|
|
41828
|
+
var KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
|
|
41829
|
+
var KUBE_NAMESPACE = (0, __1.getKubernetesNamespace)(fullConfig, env);
|
|
41830
|
+
var componentSlug = (0, slugify_1["default"])(componentName);
|
|
41831
|
+
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
|
|
41833
|
+
fullConfig.domainCanonical || "panter.cloud";
|
|
41834
|
+
var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
|
|
41835
|
+
|
|
41836
|
+
return {
|
|
41837
|
+
KUBE_NAMESPACE: KUBE_NAMESPACE,
|
|
41838
|
+
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
41839
|
+
KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
|
|
41840
|
+
HOST_CANONICAL: HOST_CANONICAL
|
|
41841
|
+
};
|
|
41842
|
+
}
|
|
41679
41843
|
};
|
|
41680
41844
|
|
|
41681
41845
|
/***/ }),
|