@catladder/pipeline 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.
- package/dist/bundles/catladder-gitlab/index.js +219 -99
- package/dist/constants.js +1 -1
- package/dist/context/getEnvironment.d.ts +2 -2
- package/dist/context/getEnvironment.js +71 -78
- package/dist/deploy/cloudRun/deployJob.d.ts +1 -1
- package/dist/deploy/cloudRun/deployJob.js +38 -9
- package/dist/deploy/cloudRun/index.d.ts +6 -1
- package/dist/deploy/cloudRun/index.js +40 -2
- package/dist/deploy/custom/index.js +3 -0
- package/dist/deploy/dockerTag/index.js +3 -0
- package/dist/deploy/index.d.ts +17 -2
- package/dist/deploy/index.js +16 -3
- package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +4 -2
- package/dist/deploy/kubernetes/additionalSecretKeys.js +11 -5
- package/dist/deploy/kubernetes/index.js +36 -1
- package/dist/deploy/types/googleCloudRun.d.ts +28 -9
- package/dist/deploy/types/index.d.ts +4 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/context/getEnvironment.ts +59 -79
- package/src/deploy/cloudRun/deployJob.ts +37 -17
- package/src/deploy/cloudRun/index.ts +38 -2
- package/src/deploy/custom/index.ts +1 -0
- package/src/deploy/dockerTag/index.ts +1 -0
- package/src/deploy/index.ts +22 -4
- package/src/deploy/kubernetes/additionalSecretKeys.ts +10 -7
- package/src/deploy/kubernetes/index.ts +33 -0
- package/src/deploy/types/googleCloudRun.ts +31 -7
|
@@ -28177,7 +28177,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
28177
28177
|
|
|
28178
28178
|
exports.__esModule = true;
|
|
28179
28179
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
28180
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
28180
|
+
exports.PIPELINE_IMAGE_TAG = "main-5bc1bdb9" || 0;
|
|
28181
28181
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
28182
28182
|
|
|
28183
28183
|
/***/ }),
|
|
@@ -28378,52 +28378,19 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
28378
28378
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
28379
28379
|
};
|
|
28380
28380
|
|
|
28381
|
-
var __importDefault = this && this.__importDefault || function (mod) {
|
|
28382
|
-
return mod && mod.__esModule ? mod : {
|
|
28383
|
-
"default": mod
|
|
28384
|
-
};
|
|
28385
|
-
};
|
|
28386
|
-
|
|
28387
28381
|
exports.__esModule = true;
|
|
28388
|
-
exports.
|
|
28382
|
+
exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironment = void 0;
|
|
28389
28383
|
|
|
28390
28384
|
var lodash_1 = __nccwpck_require__(3255);
|
|
28391
28385
|
|
|
28392
|
-
var slugify_1 = __importDefault(__nccwpck_require__(4035));
|
|
28393
|
-
|
|
28394
28386
|
var deploy_1 = __nccwpck_require__(1264);
|
|
28395
28387
|
|
|
28396
|
-
var types_1 = __nccwpck_require__(4436);
|
|
28397
|
-
|
|
28398
28388
|
var config_1 = __nccwpck_require__(325);
|
|
28399
28389
|
|
|
28400
28390
|
var utils_1 = __nccwpck_require__(1815);
|
|
28401
28391
|
|
|
28402
28392
|
var resolveReferences_1 = __nccwpck_require__(540);
|
|
28403
28393
|
|
|
28404
|
-
var sanitizeForEnVar = function (s) {
|
|
28405
|
-
return s.replace(/-/g, "_");
|
|
28406
|
-
};
|
|
28407
|
-
|
|
28408
|
-
var getSecretVarName = function (env, componentName, key) {
|
|
28409
|
-
return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
|
|
28410
|
-
}; // remove dash from component name
|
|
28411
|
-
|
|
28412
|
-
|
|
28413
|
-
exports.getSecretVarName = getSecretVarName;
|
|
28414
|
-
|
|
28415
|
-
var addIndexVar = function (vars) {
|
|
28416
|
-
return __assign(__assign({}, vars), {
|
|
28417
|
-
_ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars))
|
|
28418
|
-
});
|
|
28419
|
-
};
|
|
28420
|
-
|
|
28421
|
-
var getSecretVarNameForContext = function (context, key) {
|
|
28422
|
-
return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
|
|
28423
|
-
};
|
|
28424
|
-
|
|
28425
|
-
exports.getSecretVarNameForContext = getSecretVarNameForContext;
|
|
28426
|
-
|
|
28427
28394
|
var getEnvironment = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
|
|
28428
28395
|
) {
|
|
28429
28396
|
if (alreadyVisited === void 0) {
|
|
@@ -28431,27 +28398,15 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
28431
28398
|
}
|
|
28432
28399
|
|
|
28433
28400
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
28434
|
-
var
|
|
28401
|
+
var envConfig, envType, basePredefinedVariables, gitlabEnvironmentName, environmentSlug, predefinedVariables, host, url, fullName, envVarContext, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
|
|
28435
28402
|
|
|
28436
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
28403
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
28437
28404
|
|
|
28438
|
-
return __generator(this, function (
|
|
28439
|
-
switch (
|
|
28405
|
+
return __generator(this, function (_l) {
|
|
28406
|
+
switch (_l.label) {
|
|
28440
28407
|
case 0:
|
|
28441
|
-
|
|
28442
|
-
|
|
28443
|
-
if (!defaultConfig) {
|
|
28444
|
-
throw new Error("unknown component " + componentName);
|
|
28445
|
-
}
|
|
28446
|
-
|
|
28447
|
-
envConfig = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
|
|
28448
|
-
|
|
28449
|
-
if (envConfig === false) {
|
|
28450
|
-
throw new Error("env is disabled: " + env);
|
|
28451
|
-
}
|
|
28452
|
-
|
|
28453
|
-
mergedConfig = (0, utils_1.mergeWithMergingArrays)(defaultConfig, envConfig);
|
|
28454
|
-
envType = (_c = envConfig === null || envConfig === void 0 ? void 0 : envConfig.type) !== null && _c !== void 0 ? _c : (0, config_1.isKnowEnvType)(env) ? env : null;
|
|
28408
|
+
envConfig = getEnvConfig(config, componentName, env);
|
|
28409
|
+
envType = (_a = envConfig === null || envConfig === void 0 ? void 0 : envConfig.type) !== null && _a !== void 0 ? _a : (0, config_1.isKnowEnvType)(env) ? env : null;
|
|
28455
28410
|
|
|
28456
28411
|
if (!envType) {
|
|
28457
28412
|
throw new Error("Missing type in environment " + env + " in component " + componentName);
|
|
@@ -28459,16 +28414,25 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
28459
28414
|
|
|
28460
28415
|
basePredefinedVariables = {
|
|
28461
28416
|
ENV_SHORT: env,
|
|
28462
|
-
APP_DIR:
|
|
28417
|
+
APP_DIR: envConfig.dir,
|
|
28463
28418
|
ENV_TYPE: envType
|
|
28464
28419
|
};
|
|
28465
28420
|
gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
|
|
28466
28421
|
environmentSlug = envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
|
|
28467
28422
|
fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
|
|
28423
|
+
envVarContext = {
|
|
28424
|
+
deployConfig: envConfig.deploy,
|
|
28425
|
+
fullName: fullName,
|
|
28426
|
+
envType: envType,
|
|
28427
|
+
commitInfo: commitInfo,
|
|
28428
|
+
componentName: componentName,
|
|
28429
|
+
env: env,
|
|
28430
|
+
fullConfig: config
|
|
28431
|
+
};
|
|
28468
28432
|
|
|
28469
28433
|
if (envType === "local") {
|
|
28470
|
-
devLocalConfig =
|
|
28471
|
-
port = (
|
|
28434
|
+
devLocalConfig = envConfig;
|
|
28435
|
+
port = (_b = devLocalConfig.port) !== null && _b !== void 0 ? _b : 3000;
|
|
28472
28436
|
host = "localhost:" + port;
|
|
28473
28437
|
url = "http://" + host;
|
|
28474
28438
|
predefinedVariables = {
|
|
@@ -28477,34 +28441,22 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
28477
28441
|
PORT: port.toString()
|
|
28478
28442
|
};
|
|
28479
28443
|
} else {
|
|
28480
|
-
|
|
28481
|
-
|
|
28482
|
-
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
|
|
28483
|
-
config.domainCanonical || "panter.cloud";
|
|
28484
|
-
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);
|
|
28485
|
-
host = (_f = mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.host) !== null && _f !== void 0 ? _f : HOST_CANONICAL;
|
|
28444
|
+
additionalEnvVars = envConfig.deploy ? deploy_1.DEPLOY_TYPES[envConfig.deploy.type].getAdditionalEnvVars(envVarContext) : {};
|
|
28445
|
+
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";
|
|
28486
28446
|
url = "https://".concat(host);
|
|
28487
|
-
|
|
28488
|
-
KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
|
|
28489
|
-
KUBE_NAMESPACE = (0, deploy_1.getKubernetesNamespace)(config, env);
|
|
28490
|
-
predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
|
|
28491
|
-
HOST_CANONICAL: HOST_CANONICAL,
|
|
28447
|
+
predefinedVariables = __assign(__assign(__assign({}, basePredefinedVariables), {
|
|
28492
28448
|
HOST: host,
|
|
28493
|
-
ROOT_URL: url
|
|
28494
|
-
|
|
28495
|
-
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
28496
|
-
KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX
|
|
28497
|
-
});
|
|
28449
|
+
ROOT_URL: url
|
|
28450
|
+
}), additionalEnvVars);
|
|
28498
28451
|
}
|
|
28499
28452
|
|
|
28500
|
-
publicEnvVarsRaw = (
|
|
28501
|
-
additionalSecretKeys =
|
|
28502
|
-
|
|
28503
|
-
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);
|
|
28453
|
+
publicEnvVarsRaw = (_f = (_e = envConfig.vars) === null || _e === void 0 ? void 0 : _e.public) !== null && _f !== void 0 ? _f : {};
|
|
28454
|
+
additionalSecretKeys = envConfig.deploy ? deploy_1.DEPLOY_TYPES[envConfig.deploy.type].additionalSecretKeys(envVarContext) : [];
|
|
28455
|
+
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);
|
|
28504
28456
|
secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
|
|
28505
28457
|
return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
|
|
28506
28458
|
}));
|
|
28507
|
-
legacyFromComponents = (
|
|
28459
|
+
legacyFromComponents = (_k = (_j = envConfig.vars) === null || _j === void 0 ? void 0 : _j.fromComponents) !== null && _k !== void 0 ? _k : {};
|
|
28508
28460
|
publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
28509
28461
|
publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
|
|
28510
28462
|
var _b = __read(_a, 2),
|
|
@@ -28537,7 +28489,7 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
28537
28489
|
}, alreadyVisited)];
|
|
28538
28490
|
|
|
28539
28491
|
case 1:
|
|
28540
|
-
envVars =
|
|
28492
|
+
envVars = _l.sent();
|
|
28541
28493
|
return [2
|
|
28542
28494
|
/*return*/
|
|
28543
28495
|
, {
|
|
@@ -28561,6 +28513,47 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
28561
28513
|
|
|
28562
28514
|
exports.getEnvironment = getEnvironment;
|
|
28563
28515
|
|
|
28516
|
+
var sanitizeForEnVar = function (s) {
|
|
28517
|
+
return s.replace(/-/g, "_");
|
|
28518
|
+
};
|
|
28519
|
+
|
|
28520
|
+
var getSecretVarName = function (env, componentName, key) {
|
|
28521
|
+
return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
|
|
28522
|
+
}; // remove dash from component name
|
|
28523
|
+
|
|
28524
|
+
|
|
28525
|
+
exports.getSecretVarName = getSecretVarName;
|
|
28526
|
+
|
|
28527
|
+
var addIndexVar = function (vars) {
|
|
28528
|
+
return __assign(__assign({}, vars), {
|
|
28529
|
+
_ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars))
|
|
28530
|
+
});
|
|
28531
|
+
};
|
|
28532
|
+
|
|
28533
|
+
var getSecretVarNameForContext = function (context, key) {
|
|
28534
|
+
return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
|
|
28535
|
+
};
|
|
28536
|
+
|
|
28537
|
+
exports.getSecretVarNameForContext = getSecretVarNameForContext;
|
|
28538
|
+
|
|
28539
|
+
var getEnvConfig = function (config, componentName, env) {
|
|
28540
|
+
var _a, _b;
|
|
28541
|
+
|
|
28542
|
+
var defaultConfig = config.components[componentName];
|
|
28543
|
+
|
|
28544
|
+
if (!defaultConfig) {
|
|
28545
|
+
throw new Error("unknown component " + componentName);
|
|
28546
|
+
}
|
|
28547
|
+
|
|
28548
|
+
var envCustomizations = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
|
|
28549
|
+
|
|
28550
|
+
if (envCustomizations === false) {
|
|
28551
|
+
throw new Error("env is disabled: " + env);
|
|
28552
|
+
}
|
|
28553
|
+
|
|
28554
|
+
return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
|
|
28555
|
+
};
|
|
28556
|
+
|
|
28564
28557
|
/***/ }),
|
|
28565
28558
|
|
|
28566
28559
|
/***/ 2101:
|
|
@@ -29389,7 +29382,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
29389
29382
|
};
|
|
29390
29383
|
|
|
29391
29384
|
exports.__esModule = true;
|
|
29392
|
-
exports.
|
|
29385
|
+
exports.createGoogleCloudRunDeployJobs = void 0;
|
|
29393
29386
|
|
|
29394
29387
|
var js_yaml_1 = __nccwpck_require__(3618);
|
|
29395
29388
|
|
|
@@ -29409,16 +29402,16 @@ var types_1 = __nccwpck_require__(4436);
|
|
|
29409
29402
|
|
|
29410
29403
|
var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(818);
|
|
29411
29404
|
|
|
29412
|
-
var
|
|
29405
|
+
var createGoogleCloudRunDeployJobs = function (context) {
|
|
29413
29406
|
var deployConfig = context.componentConfig.deploy;
|
|
29414
29407
|
|
|
29415
29408
|
if (deployConfig === false) {
|
|
29416
29409
|
return [];
|
|
29417
29410
|
}
|
|
29418
29411
|
|
|
29419
|
-
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
29412
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun", "google-cloudrun-job")) {
|
|
29420
29413
|
// should not happen
|
|
29421
|
-
throw new Error("deploy config is
|
|
29414
|
+
throw new Error("deploy config is wrong");
|
|
29422
29415
|
}
|
|
29423
29416
|
|
|
29424
29417
|
var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
|
|
@@ -29429,7 +29422,6 @@ var createDeployJob = function (context) {
|
|
|
29429
29422
|
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);
|
|
29430
29423
|
|
|
29431
29424
|
var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, _1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
|
|
29432
|
-
var serviceName = context.environment.fullName.toLowerCase();
|
|
29433
29425
|
var labelsString = Object.entries((0, getLabels_1.getLabels)(context)).map(function (_a) {
|
|
29434
29426
|
var _b = __read(_a, 2),
|
|
29435
29427
|
key = _b[0],
|
|
@@ -29437,9 +29429,39 @@ var createDeployJob = function (context) {
|
|
|
29437
29429
|
|
|
29438
29430
|
return "".concat(key, "=").concat(value);
|
|
29439
29431
|
}).join(",");
|
|
29440
|
-
var
|
|
29432
|
+
var commonArgs = "--project ".concat(deployConfig.projectId, " --region=").concat(deployConfig.region);
|
|
29433
|
+
|
|
29434
|
+
var getDeployCommand = function () {
|
|
29435
|
+
var _a;
|
|
29436
|
+
|
|
29437
|
+
var name = context.environment.fullName.toLowerCase();
|
|
29438
|
+
var command = (_a = deployConfig.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand;
|
|
29439
|
+
var commandArg = command ? "--command=\"".concat(command.split(" ").join(","), "\"") : "";
|
|
29440
|
+
var commonDeployArgs = "".concat(commandArg, " --image ").concat(gcloudImageName, " ").concat(commonArgs, " --env-vars-file=____envvars.yaml --labels ").concat(labelsString);
|
|
29441
|
+
|
|
29442
|
+
if (deployConfig.type === "google-cloudrun") {
|
|
29443
|
+
return "gcloud run deploy ".concat(name, " ").concat(commonDeployArgs, " --allow-unauthenticated");
|
|
29444
|
+
}
|
|
29445
|
+
|
|
29446
|
+
if (deployConfig.type === "google-cloudrun-job") {
|
|
29447
|
+
return "gcloud beta run jobs create ".concat(name, " ").concat(commonDeployArgs);
|
|
29448
|
+
}
|
|
29449
|
+
};
|
|
29450
|
+
|
|
29451
|
+
var getStopCommand = function () {
|
|
29452
|
+
var name = context.environment.fullName.toLowerCase();
|
|
29453
|
+
var commonStopArgs = "".concat(commonArgs, " --quiet");
|
|
29454
|
+
|
|
29455
|
+
if (deployConfig.type === "google-cloudrun") {
|
|
29456
|
+
return "gcloud run services delete ".concat(name, " ").concat(commonStopArgs);
|
|
29457
|
+
}
|
|
29458
|
+
|
|
29459
|
+
if (deployConfig.type === "google-cloudrun-job") {
|
|
29460
|
+
return "gcloud beta run jobs delete ".concat(name, " ").concat(commonStopArgs);
|
|
29461
|
+
}
|
|
29462
|
+
};
|
|
29441
29463
|
|
|
29442
|
-
var cloudRunDeploy = ["echo \"$ENV_VARS\" > ____envvars.yaml",
|
|
29464
|
+
var cloudRunDeploy = ["echo \"$ENV_VARS\" > ____envvars.yaml", getDeployCommand(), "docker image rm ".concat(gcloudImageName)];
|
|
29443
29465
|
var baseStopJob = (0, base_1.getBaseDeploymentStopJob)(context);
|
|
29444
29466
|
return [(0, lodash_1.merge)({}, baseDeploymentJob, (0, docker_1.getDockerJobBaseProps)(context), {
|
|
29445
29467
|
artifacts: {
|
|
@@ -29456,11 +29478,11 @@ var createDeployJob = function (context) {
|
|
|
29456
29478
|
script: __spreadArray(__spreadArray([], __read(pushImageToArtifactsRegistry), false), __read(cloudRunDeploy), false)
|
|
29457
29479
|
}), (0, lodash_1.merge)({}, baseStopJob, {
|
|
29458
29480
|
image: (0, runner_1.getRunnerImage)("gcloud"),
|
|
29459
|
-
script: __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [
|
|
29481
|
+
script: __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [getStopCommand()], false)
|
|
29460
29482
|
})];
|
|
29461
29483
|
};
|
|
29462
29484
|
|
|
29463
|
-
exports.
|
|
29485
|
+
exports.createGoogleCloudRunDeployJobs = createGoogleCloudRunDeployJobs;
|
|
29464
29486
|
|
|
29465
29487
|
/***/ }),
|
|
29466
29488
|
|
|
@@ -29471,21 +29493,59 @@ exports.createDeployJob = createDeployJob;
|
|
|
29471
29493
|
|
|
29472
29494
|
|
|
29473
29495
|
exports.__esModule = true;
|
|
29474
|
-
exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
|
|
29496
|
+
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;
|
|
29497
|
+
|
|
29498
|
+
var context_1 = __nccwpck_require__(7123);
|
|
29475
29499
|
|
|
29476
29500
|
var deployJob_1 = __nccwpck_require__(5565);
|
|
29477
29501
|
|
|
29478
29502
|
exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
|
|
29479
29503
|
exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
|
|
29480
29504
|
exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
29481
|
-
jobs: deployJob_1.
|
|
29505
|
+
jobs: deployJob_1.createGoogleCloudRunDeployJobs,
|
|
29482
29506
|
defaults: function () {
|
|
29483
29507
|
return {};
|
|
29484
29508
|
},
|
|
29485
29509
|
additionalSecretKeys: function () {
|
|
29486
29510
|
return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
|
|
29511
|
+
},
|
|
29512
|
+
getAdditionalEnvVars: function (_a) {
|
|
29513
|
+
var fullName = _a.fullName,
|
|
29514
|
+
env = _a.env,
|
|
29515
|
+
componentName = _a.componentName;
|
|
29516
|
+
var HOST_CANONICAL = fullName.toLowerCase() + "-" + process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)];
|
|
29517
|
+
return {
|
|
29518
|
+
HOST_CANONICAL: HOST_CANONICAL
|
|
29519
|
+
};
|
|
29487
29520
|
}
|
|
29488
29521
|
};
|
|
29522
|
+
exports.GCLOUD_RUN_JOB_DEPLOY_TYPE = {
|
|
29523
|
+
jobs: deployJob_1.createGoogleCloudRunDeployJobs,
|
|
29524
|
+
defaults: function () {
|
|
29525
|
+
return {};
|
|
29526
|
+
},
|
|
29527
|
+
additionalSecretKeys: function () {
|
|
29528
|
+
return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
|
|
29529
|
+
},
|
|
29530
|
+
getAdditionalEnvVars: function (_a) {
|
|
29531
|
+
var deployConfig = _a.deployConfig,
|
|
29532
|
+
fullName = _a.fullName;
|
|
29533
|
+
|
|
29534
|
+
if (!deployConfig) {
|
|
29535
|
+
return {};
|
|
29536
|
+
}
|
|
29537
|
+
|
|
29538
|
+
var jobName = fullName.toLowerCase();
|
|
29539
|
+
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");
|
|
29540
|
+
return {
|
|
29541
|
+
CLOUD_RUN_JOB_TRIGGER_URL: CLOUD_RUN_JOB_TRIGGER_URL
|
|
29542
|
+
};
|
|
29543
|
+
}
|
|
29544
|
+
};
|
|
29545
|
+
exports.GCLOUD_RUN_DEPLOY_TYPES = {
|
|
29546
|
+
"google-cloudrun": exports.GCLOUD_RUN_DEPLOY_TYPE,
|
|
29547
|
+
"google-cloudrun-job": exports.GCLOUD_RUN_JOB_DEPLOY_TYPE
|
|
29548
|
+
};
|
|
29489
29549
|
|
|
29490
29550
|
/***/ }),
|
|
29491
29551
|
|
|
@@ -29640,6 +29700,9 @@ exports.CUSTOM_DEPLOY_TYPE = {
|
|
|
29640
29700
|
},
|
|
29641
29701
|
additionalSecretKeys: function () {
|
|
29642
29702
|
return [];
|
|
29703
|
+
},
|
|
29704
|
+
getAdditionalEnvVars: function () {
|
|
29705
|
+
return {};
|
|
29643
29706
|
}
|
|
29644
29707
|
};
|
|
29645
29708
|
|
|
@@ -29703,6 +29766,9 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
|
|
|
29703
29766
|
},
|
|
29704
29767
|
additionalSecretKeys: function () {
|
|
29705
29768
|
return [];
|
|
29769
|
+
},
|
|
29770
|
+
getAdditionalEnvVars: function () {
|
|
29771
|
+
return {};
|
|
29706
29772
|
}
|
|
29707
29773
|
};
|
|
29708
29774
|
|
|
@@ -29714,6 +29780,20 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
|
|
|
29714
29780
|
"use strict";
|
|
29715
29781
|
|
|
29716
29782
|
|
|
29783
|
+
var __assign = this && this.__assign || function () {
|
|
29784
|
+
__assign = Object.assign || function (t) {
|
|
29785
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
29786
|
+
s = arguments[i];
|
|
29787
|
+
|
|
29788
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
29789
|
+
}
|
|
29790
|
+
|
|
29791
|
+
return t;
|
|
29792
|
+
};
|
|
29793
|
+
|
|
29794
|
+
return __assign.apply(this, arguments);
|
|
29795
|
+
};
|
|
29796
|
+
|
|
29717
29797
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
29718
29798
|
if (k2 === undefined) k2 = k;
|
|
29719
29799
|
Object.defineProperty(o, k2, {
|
|
@@ -29752,12 +29832,11 @@ __exportStar(__nccwpck_require__(3214), exports);
|
|
|
29752
29832
|
|
|
29753
29833
|
__exportStar(__nccwpck_require__(8718), exports);
|
|
29754
29834
|
|
|
29755
|
-
exports.DEPLOY_TYPES = {
|
|
29835
|
+
exports.DEPLOY_TYPES = __assign({
|
|
29756
29836
|
kubernetes: kubernetes_1.KUBERNETES_DEPLOY_TYPE,
|
|
29757
29837
|
custom: custom_1.CUSTOM_DEPLOY_TYPE,
|
|
29758
|
-
"google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE,
|
|
29759
29838
|
dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE
|
|
29760
|
-
};
|
|
29839
|
+
}, cloudRun_1.GCLOUD_RUN_DEPLOY_TYPES);
|
|
29761
29840
|
|
|
29762
29841
|
/***/ }),
|
|
29763
29842
|
|
|
@@ -29770,20 +29849,26 @@ exports.DEPLOY_TYPES = {
|
|
|
29770
29849
|
exports.__esModule = true;
|
|
29771
29850
|
exports.additionalKubernetesSecretKeys = void 0;
|
|
29772
29851
|
|
|
29773
|
-
var additionalKubernetesSecretKeys = function (
|
|
29774
|
-
var
|
|
29852
|
+
var additionalKubernetesSecretKeys = function (_a) {
|
|
29853
|
+
var _b, _c, _d, _e;
|
|
29854
|
+
|
|
29855
|
+
var deployConfig = _a.deployConfig;
|
|
29856
|
+
|
|
29857
|
+
if (!deployConfig) {
|
|
29858
|
+
return [];
|
|
29859
|
+
}
|
|
29775
29860
|
|
|
29776
29861
|
var keys = [];
|
|
29777
29862
|
|
|
29778
|
-
if ((
|
|
29863
|
+
if ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) {
|
|
29779
29864
|
keys.push("MONGODB_ROOT_PASSWORD");
|
|
29780
29865
|
|
|
29781
|
-
if (
|
|
29866
|
+
if (deployConfig.values.mongodb.architecture === "replicaset") {
|
|
29782
29867
|
keys.push("MONGODB_REPLICASET_KEY");
|
|
29783
29868
|
}
|
|
29784
29869
|
}
|
|
29785
29870
|
|
|
29786
|
-
if ((
|
|
29871
|
+
if ((_e = (_d = deployConfig.values) === null || _d === void 0 ? void 0 : _d.cloudsql) === null || _e === void 0 ? void 0 : _e.enabled) {
|
|
29787
29872
|
keys.push("POSTGRESQL_PASSWORD");
|
|
29788
29873
|
keys.push("cloudsqlProxyCredentials");
|
|
29789
29874
|
}
|
|
@@ -29953,14 +30038,24 @@ exports.createKubernetesDeployJobs = createKubernetesDeployJobs;
|
|
|
29953
30038
|
/***/ }),
|
|
29954
30039
|
|
|
29955
30040
|
/***/ 2964:
|
|
29956
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__)
|
|
30041
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
29957
30042
|
|
|
29958
30043
|
"use strict";
|
|
29959
30044
|
|
|
29960
30045
|
|
|
30046
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
30047
|
+
return mod && mod.__esModule ? mod : {
|
|
30048
|
+
"default": mod
|
|
30049
|
+
};
|
|
30050
|
+
};
|
|
30051
|
+
|
|
29961
30052
|
exports.__esModule = true;
|
|
29962
30053
|
exports.KUBERNETES_DEPLOY_TYPE = void 0;
|
|
29963
30054
|
|
|
30055
|
+
var slugify_1 = __importDefault(__nccwpck_require__(4035));
|
|
30056
|
+
|
|
30057
|
+
var __1 = __nccwpck_require__(1264);
|
|
30058
|
+
|
|
29964
30059
|
var additionalSecretKeys_1 = __nccwpck_require__(7746);
|
|
29965
30060
|
|
|
29966
30061
|
var deployJob_1 = __nccwpck_require__(2525);
|
|
@@ -29970,7 +30065,32 @@ exports.KUBERNETES_DEPLOY_TYPE = {
|
|
|
29970
30065
|
defaults: function () {
|
|
29971
30066
|
return {};
|
|
29972
30067
|
},
|
|
29973
|
-
additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys
|
|
30068
|
+
additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys,
|
|
30069
|
+
getAdditionalEnvVars: function (_a) {
|
|
30070
|
+
var _b;
|
|
30071
|
+
|
|
30072
|
+
var componentName = _a.componentName,
|
|
30073
|
+
fullConfig = _a.fullConfig,
|
|
30074
|
+
deployConfig = _a.deployConfig,
|
|
30075
|
+
env = _a.env,
|
|
30076
|
+
envType = _a.envType,
|
|
30077
|
+
commitInfo = _a.commitInfo;
|
|
30078
|
+
var KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
|
|
30079
|
+
var KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
|
|
30080
|
+
var KUBE_NAMESPACE = (0, __1.getKubernetesNamespace)(fullConfig, env);
|
|
30081
|
+
var componentSlug = (0, slugify_1["default"])(componentName);
|
|
30082
|
+
var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
|
|
30083
|
+
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
|
|
30084
|
+
fullConfig.domainCanonical || "panter.cloud";
|
|
30085
|
+
var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
|
|
30086
|
+
|
|
30087
|
+
return {
|
|
30088
|
+
KUBE_NAMESPACE: KUBE_NAMESPACE,
|
|
30089
|
+
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
30090
|
+
KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
|
|
30091
|
+
HOST_CANONICAL: HOST_CANONICAL
|
|
30092
|
+
};
|
|
30093
|
+
}
|
|
29974
30094
|
};
|
|
29975
30095
|
|
|
29976
30096
|
/***/ }),
|
package/dist/constants.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
5
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
5
|
+
exports.PIPELINE_IMAGE_TAG = "main-5bc1bdb9" || "";
|
|
6
6
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Config } from "../types/config";
|
|
2
2
|
import type { CommitInfo, Context, Environment } from "../types/context";
|
|
3
|
+
export declare const getEnvironment: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, alreadyVisited?: Record<string, Record<string, boolean>>) => Promise<Environment>;
|
|
3
4
|
export declare const getSecretVarName: (env: string, componentName: string, key: string) => string;
|
|
4
|
-
export declare const getSecretVarNameForContext: (context: Context, key: string) => string;
|
|
5
|
-
export declare const getEnvironment: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, alreadyVisited?: Record<string, Record<string, boolean>>) => Promise<Environment>;
|
|
5
|
+
export declare const getSecretVarNameForContext: (context: Context, key: string) => string;
|