@catladder/cli 0.0.0-main-7b4a3dd5 → 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/apps/cli/commands/project/commandSecretsClearBackups.d.ts +5 -0
- package/dist/apps/cli/commands/project/commandSecretsClearBackups.js +90 -0
- package/dist/apps/cli/commands/project/commandSecretsClearBackups.js.map +1 -0
- package/dist/apps/cli/commands/project/index.js +2 -0
- package/dist/apps/cli/commands/project/index.js.map +1 -1
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +2 -2
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
- package/dist/bundles/catenv/index.js +279 -108
- package/dist/bundles/cli/index.js +380 -110
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/gitlab.d.ts +3 -1
- package/dist/utils/gitlab.js +60 -9
- package/dist/utils/gitlab.js.map +1 -1
- package/package.json +2 -2
- package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +27 -0
- package/src/apps/cli/commands/project/index.ts +2 -0
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +21 -10
- package/src/utils/gitlab.ts +50 -12
|
@@ -3468,6 +3468,103 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
3468
3468
|
|
|
3469
3469
|
/***/ }),
|
|
3470
3470
|
|
|
3471
|
+
/***/ 41863:
|
|
3472
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
3473
|
+
|
|
3474
|
+
"use strict";
|
|
3475
|
+
|
|
3476
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3477
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3478
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3479
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
3480
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
3481
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
3482
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3483
|
+
});
|
|
3484
|
+
};
|
|
3485
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
3486
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
3487
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
3488
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
3489
|
+
function step(op) {
|
|
3490
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
3491
|
+
while (_) try {
|
|
3492
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
3493
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
3494
|
+
switch (op[0]) {
|
|
3495
|
+
case 0: case 1: t = op; break;
|
|
3496
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
3497
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
3498
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
3499
|
+
default:
|
|
3500
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
3501
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
3502
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
3503
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
3504
|
+
if (t[2]) _.ops.pop();
|
|
3505
|
+
_.trys.pop(); continue;
|
|
3506
|
+
}
|
|
3507
|
+
op = body.call(thisArg, _);
|
|
3508
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
3509
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
3510
|
+
}
|
|
3511
|
+
};
|
|
3512
|
+
exports.__esModule = true;
|
|
3513
|
+
exports.projectSecretsClearBackups = void 0;
|
|
3514
|
+
var gitlab_1 = __nccwpck_require__(79818);
|
|
3515
|
+
var autocompletions_1 = __nccwpck_require__(41373);
|
|
3516
|
+
var projectSecretsClearBackups = function (vorpal, keep) {
|
|
3517
|
+
if (keep === void 0) { keep = 3; }
|
|
3518
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3519
|
+
return __generator(this, function (_a) {
|
|
3520
|
+
switch (_a.label) {
|
|
3521
|
+
case 0: return [4 /*yield*/, (0, gitlab_1.clearBackups)(vorpal, keep)];
|
|
3522
|
+
case 1:
|
|
3523
|
+
_a.sent();
|
|
3524
|
+
return [2 /*return*/];
|
|
3525
|
+
}
|
|
3526
|
+
});
|
|
3527
|
+
});
|
|
3528
|
+
};
|
|
3529
|
+
exports.projectSecretsClearBackups = projectSecretsClearBackups;
|
|
3530
|
+
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3531
|
+
var _a, _b;
|
|
3532
|
+
return __generator(this, function (_c) {
|
|
3533
|
+
switch (_c.label) {
|
|
3534
|
+
case 0:
|
|
3535
|
+
_b = (_a = vorpal
|
|
3536
|
+
.command("project-secrets-clear-backups", "clears all backups"))
|
|
3537
|
+
.autocomplete;
|
|
3538
|
+
return [4 /*yield*/, (0, autocompletions_1.allEnvsAndAllComponents)()];
|
|
3539
|
+
case 1:
|
|
3540
|
+
_b.apply(_a, [_c.sent()])
|
|
3541
|
+
.action(function () {
|
|
3542
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3543
|
+
var keep;
|
|
3544
|
+
return __generator(this, function (_a) {
|
|
3545
|
+
switch (_a.label) {
|
|
3546
|
+
case 0: return [4 /*yield*/, this.prompt({
|
|
3547
|
+
type: "number",
|
|
3548
|
+
name: "keep",
|
|
3549
|
+
"default": 1,
|
|
3550
|
+
message: "How many backups should we keep? 🤔"
|
|
3551
|
+
})];
|
|
3552
|
+
case 1:
|
|
3553
|
+
keep = (_a.sent()).keep;
|
|
3554
|
+
return [4 /*yield*/, (0, exports.projectSecretsClearBackups)(this, keep)];
|
|
3555
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
3556
|
+
}
|
|
3557
|
+
});
|
|
3558
|
+
});
|
|
3559
|
+
});
|
|
3560
|
+
return [2 /*return*/];
|
|
3561
|
+
}
|
|
3562
|
+
});
|
|
3563
|
+
}); });
|
|
3564
|
+
//# sourceMappingURL=commandSecretsClearBackups.js.map
|
|
3565
|
+
|
|
3566
|
+
/***/ }),
|
|
3567
|
+
|
|
3471
3568
|
/***/ 54108:
|
|
3472
3569
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
3473
3570
|
|
|
@@ -3753,6 +3850,7 @@ var commandOpenGrafana_1 = __importDefault(__nccwpck_require__(70414));
|
|
|
3753
3850
|
var commandPortForward_1 = __importDefault(__nccwpck_require__(3415));
|
|
3754
3851
|
var commandTriggerCronjob_1 = __importDefault(__nccwpck_require__(51827));
|
|
3755
3852
|
var commandOpenGrafanaPod_1 = __importDefault(__nccwpck_require__(55848));
|
|
3853
|
+
var commandSecretsClearBackups_1 = __importDefault(__nccwpck_require__(41863));
|
|
3756
3854
|
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3757
3855
|
return __generator(this, function (_a) {
|
|
3758
3856
|
(0, commandSetup_1["default"])(vorpal);
|
|
@@ -3771,6 +3869,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
3771
3869
|
(0, commandOpenEnv_1["default"])(vorpal);
|
|
3772
3870
|
(0, commandTriggerCronjob_1["default"])(vorpal);
|
|
3773
3871
|
(0, commandConfigSecrets_1["default"])(vorpal);
|
|
3872
|
+
(0, commandSecretsClearBackups_1["default"])(vorpal);
|
|
3774
3873
|
(0, commandDeletePods_1["default"])(vorpal);
|
|
3775
3874
|
(0, commandCopyDB_1["default"])(vorpal);
|
|
3776
3875
|
(0, commandGetShell_1["default"])(vorpal);
|
|
@@ -3992,7 +4091,7 @@ var setupAccessTokens = function (instance) { return __awaiter(void 0, void 0, v
|
|
|
3992
4091
|
key: "GL_TOKEN",
|
|
3993
4092
|
value: GL_TOKEN,
|
|
3994
4093
|
masked: true
|
|
3995
|
-
})];
|
|
4094
|
+
}, "POST")];
|
|
3996
4095
|
case 7:
|
|
3997
4096
|
_b.sent();
|
|
3998
4097
|
return [3 /*break*/, 8];
|
|
@@ -4005,7 +4104,7 @@ var setupAccessTokens = function (instance) { return __awaiter(void 0, void 0, v
|
|
|
4005
4104
|
id: projectId,
|
|
4006
4105
|
name: "gitlab-deploy-token",
|
|
4007
4106
|
scopes: ["read_registry"]
|
|
4008
|
-
})];
|
|
4107
|
+
}, "POST")];
|
|
4009
4108
|
case 10:
|
|
4010
4109
|
_b.sent();
|
|
4011
4110
|
_b.label = 11;
|
|
@@ -7136,7 +7235,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7136
7235
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7137
7236
|
};
|
|
7138
7237
|
exports.__esModule = true;
|
|
7139
|
-
exports.upsertAllVariables = exports.getVariableValueByRawName = exports.getAllVariables = exports.getProjectInfo = exports.doGitlabRequest = exports.getGitlabToken = exports.setupGitlabToken = exports.hasGitlabToken = void 0;
|
|
7238
|
+
exports.upsertAllVariables = exports.clearBackups = exports.getVariableValueByRawName = exports.getAllVariables = exports.getProjectInfo = exports.doGitlabRequest = exports.getGitlabToken = exports.setupGitlabToken = exports.hasGitlabToken = void 0;
|
|
7140
7239
|
var pipeline_1 = __nccwpck_require__(25355);
|
|
7141
7240
|
var child_process_promise_1 = __nccwpck_require__(75763);
|
|
7142
7241
|
var lodash_1 = __nccwpck_require__(23255);
|
|
@@ -7210,28 +7309,31 @@ var getGitlabToken = function (vorpal) { return __awaiter(void 0, void 0, void 0
|
|
|
7210
7309
|
});
|
|
7211
7310
|
}); };
|
|
7212
7311
|
exports.getGitlabToken = getGitlabToken;
|
|
7213
|
-
var doGitlabRequest = function (vorpal, path, data,
|
|
7312
|
+
var doGitlabRequest = function (vorpal, path, data, method) {
|
|
7214
7313
|
if (data === void 0) { data = undefined; }
|
|
7314
|
+
if (method === void 0) { method = "GET"; }
|
|
7215
7315
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
7216
|
-
var rootToken,
|
|
7316
|
+
var rootToken, result, _a, _b, _c, _d, _e;
|
|
7217
7317
|
return __generator(this, function (_f) {
|
|
7218
7318
|
switch (_f.label) {
|
|
7219
7319
|
case 0: return [4 /*yield*/, (0, exports.getGitlabToken)(vorpal)];
|
|
7220
7320
|
case 1:
|
|
7221
7321
|
rootToken = _f.sent();
|
|
7222
|
-
method = data ? (update ? "PUT" : "POST") : "GET";
|
|
7223
7322
|
return [4 /*yield*/, (0, node_fetch_1["default"])("https://git.panter.ch/api/v4/".concat(path), {
|
|
7224
7323
|
method: method,
|
|
7225
7324
|
headers: {
|
|
7226
7325
|
"Content-Type": "application/json",
|
|
7227
7326
|
"Private-Token": rootToken
|
|
7228
7327
|
},
|
|
7229
|
-
body: JSON.stringify(data)
|
|
7328
|
+
body: data ? JSON.stringify(data) : undefined
|
|
7230
7329
|
})];
|
|
7231
7330
|
case 2:
|
|
7232
7331
|
result = _f.sent();
|
|
7233
7332
|
if (result.status >= 200 && result.status < 400) {
|
|
7234
|
-
|
|
7333
|
+
if (result.headers.get("content-type") === "application/json") {
|
|
7334
|
+
return [2 /*return*/, result.json()];
|
|
7335
|
+
}
|
|
7336
|
+
return [2 /*return*/, null];
|
|
7235
7337
|
}
|
|
7236
7338
|
if (result.status === 404) {
|
|
7237
7339
|
throw new Error("not found");
|
|
@@ -7313,7 +7415,7 @@ var createVariable = function (vorpal, projectId, key, value, masked, environmen
|
|
|
7313
7415
|
value: value,
|
|
7314
7416
|
masked: masked && isMaskable(value),
|
|
7315
7417
|
environment_scope: environment_scope
|
|
7316
|
-
})];
|
|
7418
|
+
}, "POST")];
|
|
7317
7419
|
case 1: return [2 /*return*/, _a.sent()];
|
|
7318
7420
|
}
|
|
7319
7421
|
});
|
|
@@ -7327,12 +7429,20 @@ var updateVariable = function (vorpal, projectId, key, value, masked) {
|
|
|
7327
7429
|
case 0: return [4 /*yield*/, (0, exports.doGitlabRequest)(vorpal, "projects/".concat(projectId, "/variables/").concat(key), {
|
|
7328
7430
|
value: value,
|
|
7329
7431
|
masked: masked && isMaskable(value)
|
|
7330
|
-
},
|
|
7432
|
+
}, "PUT")];
|
|
7331
7433
|
case 1: return [2 /*return*/, _a.sent()];
|
|
7332
7434
|
}
|
|
7333
7435
|
});
|
|
7334
7436
|
});
|
|
7335
7437
|
};
|
|
7438
|
+
var deleteVariable = function (vorpal, projectId, key) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7439
|
+
return __generator(this, function (_a) {
|
|
7440
|
+
switch (_a.label) {
|
|
7441
|
+
case 0: return [4 /*yield*/, (0, exports.doGitlabRequest)(vorpal, "projects/".concat(projectId, "/variables/").concat(key), undefined, "DELETE")];
|
|
7442
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
7443
|
+
}
|
|
7444
|
+
});
|
|
7445
|
+
}); };
|
|
7336
7446
|
var getAllCatladderEnvVarsInGitlab = function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7337
7447
|
var allVariables;
|
|
7338
7448
|
return __generator(this, function (_a) {
|
|
@@ -7362,6 +7472,46 @@ var getAllCatladderEnvVarsInGitlab = function (vorpal) { return __awaiter(void 0
|
|
|
7362
7472
|
}
|
|
7363
7473
|
});
|
|
7364
7474
|
}); };
|
|
7475
|
+
var getBackupKey = function (fullKey, timestamp) {
|
|
7476
|
+
return "".concat(fullKey, "_backup_").concat(timestamp);
|
|
7477
|
+
};
|
|
7478
|
+
var clearBackups = function (vorpal, keep) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7479
|
+
var existingVariables, id, _i, _a, _b, key, backups, backupsSorted, toDelete, _c, toDelete_1, timestamp;
|
|
7480
|
+
return __generator(this, function (_d) {
|
|
7481
|
+
switch (_d.label) {
|
|
7482
|
+
case 0: return [4 /*yield*/, getAllCatladderEnvVarsInGitlab(vorpal)];
|
|
7483
|
+
case 1:
|
|
7484
|
+
existingVariables = _d.sent();
|
|
7485
|
+
return [4 /*yield*/, (0, exports.getProjectInfo)(vorpal)];
|
|
7486
|
+
case 2:
|
|
7487
|
+
id = (_d.sent()).id;
|
|
7488
|
+
_i = 0, _a = Object.entries(existingVariables);
|
|
7489
|
+
_d.label = 3;
|
|
7490
|
+
case 3:
|
|
7491
|
+
if (!(_i < _a.length)) return [3 /*break*/, 8];
|
|
7492
|
+
_b = _a[_i], key = _b[0], backups = _b[1].backups;
|
|
7493
|
+
backupsSorted = backups.sort(function (a, b) { return b - a; });
|
|
7494
|
+
toDelete = backupsSorted.slice(keep);
|
|
7495
|
+
_c = 0, toDelete_1 = toDelete;
|
|
7496
|
+
_d.label = 4;
|
|
7497
|
+
case 4:
|
|
7498
|
+
if (!(_c < toDelete_1.length)) return [3 /*break*/, 7];
|
|
7499
|
+
timestamp = toDelete_1[_c];
|
|
7500
|
+
return [4 /*yield*/, deleteVariable(vorpal, id, getBackupKey(key, timestamp))];
|
|
7501
|
+
case 5:
|
|
7502
|
+
_d.sent();
|
|
7503
|
+
_d.label = 6;
|
|
7504
|
+
case 6:
|
|
7505
|
+
_c++;
|
|
7506
|
+
return [3 /*break*/, 4];
|
|
7507
|
+
case 7:
|
|
7508
|
+
_i++;
|
|
7509
|
+
return [3 /*break*/, 3];
|
|
7510
|
+
case 8: return [2 /*return*/];
|
|
7511
|
+
}
|
|
7512
|
+
});
|
|
7513
|
+
}); };
|
|
7514
|
+
exports.clearBackups = clearBackups;
|
|
7365
7515
|
var upsertAllVariables = function (vorpal, variables, env, componentName, backup, masked // FIXME: would be better to have this per variable
|
|
7366
7516
|
) {
|
|
7367
7517
|
if (backup === void 0) { backup = true; }
|
|
@@ -7394,7 +7544,7 @@ var upsertAllVariables = function (vorpal, variables, env, componentName, backup
|
|
|
7394
7544
|
case 4:
|
|
7395
7545
|
_d.sent();
|
|
7396
7546
|
if (!backup) return [3 /*break*/, 6];
|
|
7397
|
-
return [4 /*yield*/, createVariable(vorpal, id, fullKey
|
|
7547
|
+
return [4 /*yield*/, createVariable(vorpal, id, getBackupKey(fullKey, new Date().getTime()), oldValue, masked, "_backup")];
|
|
7398
7548
|
case 5:
|
|
7399
7549
|
_d.sent();
|
|
7400
7550
|
_d.label = 6;
|
|
@@ -350603,7 +350753,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
350603
350753
|
|
|
350604
350754
|
exports.__esModule = true;
|
|
350605
350755
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
350606
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
350756
|
+
exports.PIPELINE_IMAGE_TAG = "main-5bc1bdb9" || 0;
|
|
350607
350757
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
350608
350758
|
|
|
350609
350759
|
/***/ }),
|
|
@@ -350804,52 +350954,19 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
350804
350954
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
350805
350955
|
};
|
|
350806
350956
|
|
|
350807
|
-
var __importDefault = this && this.__importDefault || function (mod) {
|
|
350808
|
-
return mod && mod.__esModule ? mod : {
|
|
350809
|
-
"default": mod
|
|
350810
|
-
};
|
|
350811
|
-
};
|
|
350812
|
-
|
|
350813
350957
|
exports.__esModule = true;
|
|
350814
|
-
exports.
|
|
350958
|
+
exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironment = void 0;
|
|
350815
350959
|
|
|
350816
350960
|
var lodash_1 = __nccwpck_require__(23255);
|
|
350817
350961
|
|
|
350818
|
-
var slugify_1 = __importDefault(__nccwpck_require__(44035));
|
|
350819
|
-
|
|
350820
350962
|
var deploy_1 = __nccwpck_require__(90223);
|
|
350821
350963
|
|
|
350822
|
-
var types_1 = __nccwpck_require__(63109);
|
|
350823
|
-
|
|
350824
350964
|
var config_1 = __nccwpck_require__(19997);
|
|
350825
350965
|
|
|
350826
350966
|
var utils_1 = __nccwpck_require__(37461);
|
|
350827
350967
|
|
|
350828
350968
|
var resolveReferences_1 = __nccwpck_require__(80928);
|
|
350829
350969
|
|
|
350830
|
-
var sanitizeForEnVar = function (s) {
|
|
350831
|
-
return s.replace(/-/g, "_");
|
|
350832
|
-
};
|
|
350833
|
-
|
|
350834
|
-
var getSecretVarName = function (env, componentName, key) {
|
|
350835
|
-
return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
|
|
350836
|
-
}; // remove dash from component name
|
|
350837
|
-
|
|
350838
|
-
|
|
350839
|
-
exports.getSecretVarName = getSecretVarName;
|
|
350840
|
-
|
|
350841
|
-
var addIndexVar = function (vars) {
|
|
350842
|
-
return __assign(__assign({}, vars), {
|
|
350843
|
-
_ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars))
|
|
350844
|
-
});
|
|
350845
|
-
};
|
|
350846
|
-
|
|
350847
|
-
var getSecretVarNameForContext = function (context, key) {
|
|
350848
|
-
return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
|
|
350849
|
-
};
|
|
350850
|
-
|
|
350851
|
-
exports.getSecretVarNameForContext = getSecretVarNameForContext;
|
|
350852
|
-
|
|
350853
350970
|
var getEnvironment = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
|
|
350854
350971
|
) {
|
|
350855
350972
|
if (alreadyVisited === void 0) {
|
|
@@ -350857,27 +350974,15 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
350857
350974
|
}
|
|
350858
350975
|
|
|
350859
350976
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
350860
|
-
var
|
|
350977
|
+
var envConfig, envType, basePredefinedVariables, gitlabEnvironmentName, environmentSlug, predefinedVariables, host, url, fullName, envVarContext, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
|
|
350861
350978
|
|
|
350862
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
350979
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
350863
350980
|
|
|
350864
|
-
return __generator(this, function (
|
|
350865
|
-
switch (
|
|
350981
|
+
return __generator(this, function (_l) {
|
|
350982
|
+
switch (_l.label) {
|
|
350866
350983
|
case 0:
|
|
350867
|
-
|
|
350868
|
-
|
|
350869
|
-
if (!defaultConfig) {
|
|
350870
|
-
throw new Error("unknown component " + componentName);
|
|
350871
|
-
}
|
|
350872
|
-
|
|
350873
|
-
envConfig = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
|
|
350874
|
-
|
|
350875
|
-
if (envConfig === false) {
|
|
350876
|
-
throw new Error("env is disabled: " + env);
|
|
350877
|
-
}
|
|
350878
|
-
|
|
350879
|
-
mergedConfig = (0, utils_1.mergeWithMergingArrays)(defaultConfig, envConfig);
|
|
350880
|
-
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;
|
|
350881
350986
|
|
|
350882
350987
|
if (!envType) {
|
|
350883
350988
|
throw new Error("Missing type in environment " + env + " in component " + componentName);
|
|
@@ -350885,16 +350990,25 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
350885
350990
|
|
|
350886
350991
|
basePredefinedVariables = {
|
|
350887
350992
|
ENV_SHORT: env,
|
|
350888
|
-
APP_DIR:
|
|
350993
|
+
APP_DIR: envConfig.dir,
|
|
350889
350994
|
ENV_TYPE: envType
|
|
350890
350995
|
};
|
|
350891
350996
|
gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
|
|
350892
350997
|
environmentSlug = envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
|
|
350893
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
|
+
};
|
|
350894
351008
|
|
|
350895
351009
|
if (envType === "local") {
|
|
350896
|
-
devLocalConfig =
|
|
350897
|
-
port = (
|
|
351010
|
+
devLocalConfig = envConfig;
|
|
351011
|
+
port = (_b = devLocalConfig.port) !== null && _b !== void 0 ? _b : 3000;
|
|
350898
351012
|
host = "localhost:" + port;
|
|
350899
351013
|
url = "http://" + host;
|
|
350900
351014
|
predefinedVariables = {
|
|
@@ -350903,34 +351017,22 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
350903
351017
|
PORT: port.toString()
|
|
350904
351018
|
};
|
|
350905
351019
|
} else {
|
|
350906
|
-
|
|
350907
|
-
|
|
350908
|
-
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
|
|
350909
|
-
config.domainCanonical || "panter.cloud";
|
|
350910
|
-
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);
|
|
350911
|
-
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";
|
|
350912
351022
|
url = "https://".concat(host);
|
|
350913
|
-
|
|
350914
|
-
KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
|
|
350915
|
-
KUBE_NAMESPACE = (0, deploy_1.getKubernetesNamespace)(config, env);
|
|
350916
|
-
predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
|
|
350917
|
-
HOST_CANONICAL: HOST_CANONICAL,
|
|
351023
|
+
predefinedVariables = __assign(__assign(__assign({}, basePredefinedVariables), {
|
|
350918
351024
|
HOST: host,
|
|
350919
|
-
ROOT_URL: url
|
|
350920
|
-
|
|
350921
|
-
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
350922
|
-
KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX
|
|
350923
|
-
});
|
|
351025
|
+
ROOT_URL: url
|
|
351026
|
+
}), additionalEnvVars);
|
|
350924
351027
|
}
|
|
350925
351028
|
|
|
350926
|
-
publicEnvVarsRaw = (
|
|
350927
|
-
additionalSecretKeys =
|
|
350928
|
-
|
|
350929
|
-
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);
|
|
350930
351032
|
secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
|
|
350931
351033
|
return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
|
|
350932
351034
|
}));
|
|
350933
|
-
legacyFromComponents = (
|
|
351035
|
+
legacyFromComponents = (_k = (_j = envConfig.vars) === null || _j === void 0 ? void 0 : _j.fromComponents) !== null && _k !== void 0 ? _k : {};
|
|
350934
351036
|
publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
350935
351037
|
publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
|
|
350936
351038
|
var _b = __read(_a, 2),
|
|
@@ -350963,7 +351065,7 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
350963
351065
|
}, alreadyVisited)];
|
|
350964
351066
|
|
|
350965
351067
|
case 1:
|
|
350966
|
-
envVars =
|
|
351068
|
+
envVars = _l.sent();
|
|
350967
351069
|
return [2
|
|
350968
351070
|
/*return*/
|
|
350969
351071
|
, {
|
|
@@ -350987,6 +351089,47 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
350987
351089
|
|
|
350988
351090
|
exports.getEnvironment = getEnvironment;
|
|
350989
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
|
+
|
|
350990
351133
|
/***/ }),
|
|
350991
351134
|
|
|
350992
351135
|
/***/ 30486:
|
|
@@ -351815,7 +351958,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
351815
351958
|
};
|
|
351816
351959
|
|
|
351817
351960
|
exports.__esModule = true;
|
|
351818
|
-
exports.
|
|
351961
|
+
exports.createGoogleCloudRunDeployJobs = void 0;
|
|
351819
351962
|
|
|
351820
351963
|
var js_yaml_1 = __nccwpck_require__(3618);
|
|
351821
351964
|
|
|
@@ -351835,16 +351978,16 @@ var types_1 = __nccwpck_require__(63109);
|
|
|
351835
351978
|
|
|
351836
351979
|
var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(22607);
|
|
351837
351980
|
|
|
351838
|
-
var
|
|
351981
|
+
var createGoogleCloudRunDeployJobs = function (context) {
|
|
351839
351982
|
var deployConfig = context.componentConfig.deploy;
|
|
351840
351983
|
|
|
351841
351984
|
if (deployConfig === false) {
|
|
351842
351985
|
return [];
|
|
351843
351986
|
}
|
|
351844
351987
|
|
|
351845
|
-
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
351988
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun", "google-cloudrun-job")) {
|
|
351846
351989
|
// should not happen
|
|
351847
|
-
throw new Error("deploy config is
|
|
351990
|
+
throw new Error("deploy config is wrong");
|
|
351848
351991
|
}
|
|
351849
351992
|
|
|
351850
351993
|
var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
|
|
@@ -351855,7 +351998,6 @@ var createDeployJob = function (context) {
|
|
|
351855
351998
|
var pushImageToArtifactsRegistry = __spreadArray(__spreadArray([docker_1.gitlabDockerLogin], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud auth configure-docker ".concat(deployConfig.region, "-docker.pkg.dev"), "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG ".concat(gcloudImageName), "docker push ".concat(gcloudImageName)], false);
|
|
351856
351999
|
|
|
351857
352000
|
var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, _1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
|
|
351858
|
-
var serviceName = context.environment.fullName.toLowerCase();
|
|
351859
352001
|
var labelsString = Object.entries((0, getLabels_1.getLabels)(context)).map(function (_a) {
|
|
351860
352002
|
var _b = __read(_a, 2),
|
|
351861
352003
|
key = _b[0],
|
|
@@ -351863,9 +352005,39 @@ var createDeployJob = function (context) {
|
|
|
351863
352005
|
|
|
351864
352006
|
return "".concat(key, "=").concat(value);
|
|
351865
352007
|
}).join(",");
|
|
351866
|
-
var
|
|
352008
|
+
var commonArgs = "--project ".concat(deployConfig.projectId, " --region=").concat(deployConfig.region);
|
|
352009
|
+
|
|
352010
|
+
var getDeployCommand = function () {
|
|
352011
|
+
var _a;
|
|
352012
|
+
|
|
352013
|
+
var name = context.environment.fullName.toLowerCase();
|
|
352014
|
+
var command = (_a = deployConfig.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand;
|
|
352015
|
+
var commandArg = command ? "--command=\"".concat(command.split(" ").join(","), "\"") : "";
|
|
352016
|
+
var commonDeployArgs = "".concat(commandArg, " --image ").concat(gcloudImageName, " ").concat(commonArgs, " --env-vars-file=____envvars.yaml --labels ").concat(labelsString);
|
|
352017
|
+
|
|
352018
|
+
if (deployConfig.type === "google-cloudrun") {
|
|
352019
|
+
return "gcloud run deploy ".concat(name, " ").concat(commonDeployArgs, " --allow-unauthenticated");
|
|
352020
|
+
}
|
|
352021
|
+
|
|
352022
|
+
if (deployConfig.type === "google-cloudrun-job") {
|
|
352023
|
+
return "gcloud beta run jobs create ".concat(name, " ").concat(commonDeployArgs);
|
|
352024
|
+
}
|
|
352025
|
+
};
|
|
352026
|
+
|
|
352027
|
+
var getStopCommand = function () {
|
|
352028
|
+
var name = context.environment.fullName.toLowerCase();
|
|
352029
|
+
var commonStopArgs = "".concat(commonArgs, " --quiet");
|
|
351867
352030
|
|
|
351868
|
-
|
|
352031
|
+
if (deployConfig.type === "google-cloudrun") {
|
|
352032
|
+
return "gcloud run services delete ".concat(name, " ").concat(commonStopArgs);
|
|
352033
|
+
}
|
|
352034
|
+
|
|
352035
|
+
if (deployConfig.type === "google-cloudrun-job") {
|
|
352036
|
+
return "gcloud beta run jobs delete ".concat(name, " ").concat(commonStopArgs);
|
|
352037
|
+
}
|
|
352038
|
+
};
|
|
352039
|
+
|
|
352040
|
+
var cloudRunDeploy = ["echo \"$ENV_VARS\" > ____envvars.yaml", getDeployCommand(), "docker image rm ".concat(gcloudImageName)];
|
|
351869
352041
|
var baseStopJob = (0, base_1.getBaseDeploymentStopJob)(context);
|
|
351870
352042
|
return [(0, lodash_1.merge)({}, baseDeploymentJob, (0, docker_1.getDockerJobBaseProps)(context), {
|
|
351871
352043
|
artifacts: {
|
|
@@ -351882,11 +352054,11 @@ var createDeployJob = function (context) {
|
|
|
351882
352054
|
script: __spreadArray(__spreadArray([], __read(pushImageToArtifactsRegistry), false), __read(cloudRunDeploy), false)
|
|
351883
352055
|
}), (0, lodash_1.merge)({}, baseStopJob, {
|
|
351884
352056
|
image: (0, runner_1.getRunnerImage)("gcloud"),
|
|
351885
|
-
script: __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [
|
|
352057
|
+
script: __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [getStopCommand()], false)
|
|
351886
352058
|
})];
|
|
351887
352059
|
};
|
|
351888
352060
|
|
|
351889
|
-
exports.
|
|
352061
|
+
exports.createGoogleCloudRunDeployJobs = createGoogleCloudRunDeployJobs;
|
|
351890
352062
|
|
|
351891
352063
|
/***/ }),
|
|
351892
352064
|
|
|
@@ -351897,21 +352069,59 @@ exports.createDeployJob = createDeployJob;
|
|
|
351897
352069
|
|
|
351898
352070
|
|
|
351899
352071
|
exports.__esModule = true;
|
|
351900
|
-
exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
|
|
352072
|
+
exports.GCLOUD_RUN_DEPLOY_TYPES = exports.GCLOUD_RUN_JOB_DEPLOY_TYPE = exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
|
|
352073
|
+
|
|
352074
|
+
var context_1 = __nccwpck_require__(22041);
|
|
351901
352075
|
|
|
351902
352076
|
var deployJob_1 = __nccwpck_require__(82256);
|
|
351903
352077
|
|
|
351904
352078
|
exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
|
|
351905
352079
|
exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
|
|
351906
352080
|
exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
351907
|
-
jobs: deployJob_1.
|
|
352081
|
+
jobs: deployJob_1.createGoogleCloudRunDeployJobs,
|
|
351908
352082
|
defaults: function () {
|
|
351909
352083
|
return {};
|
|
351910
352084
|
},
|
|
351911
352085
|
additionalSecretKeys: function () {
|
|
351912
352086
|
return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
|
|
352087
|
+
},
|
|
352088
|
+
getAdditionalEnvVars: function (_a) {
|
|
352089
|
+
var fullName = _a.fullName,
|
|
352090
|
+
env = _a.env,
|
|
352091
|
+
componentName = _a.componentName;
|
|
352092
|
+
var HOST_CANONICAL = fullName.toLowerCase() + "-" + process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)];
|
|
352093
|
+
return {
|
|
352094
|
+
HOST_CANONICAL: HOST_CANONICAL
|
|
352095
|
+
};
|
|
351913
352096
|
}
|
|
351914
352097
|
};
|
|
352098
|
+
exports.GCLOUD_RUN_JOB_DEPLOY_TYPE = {
|
|
352099
|
+
jobs: deployJob_1.createGoogleCloudRunDeployJobs,
|
|
352100
|
+
defaults: function () {
|
|
352101
|
+
return {};
|
|
352102
|
+
},
|
|
352103
|
+
additionalSecretKeys: function () {
|
|
352104
|
+
return [exports.GCLOUD_DEPLOY_CREDENTIALS_KEY];
|
|
352105
|
+
},
|
|
352106
|
+
getAdditionalEnvVars: function (_a) {
|
|
352107
|
+
var deployConfig = _a.deployConfig,
|
|
352108
|
+
fullName = _a.fullName;
|
|
352109
|
+
|
|
352110
|
+
if (!deployConfig) {
|
|
352111
|
+
return {};
|
|
352112
|
+
}
|
|
352113
|
+
|
|
352114
|
+
var jobName = fullName.toLowerCase();
|
|
352115
|
+
var CLOUD_RUN_JOB_TRIGGER_URL = "https://".concat(deployConfig.region, "-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/").concat(deployConfig.projectId, "/jobs/").concat(jobName, ":run");
|
|
352116
|
+
return {
|
|
352117
|
+
CLOUD_RUN_JOB_TRIGGER_URL: CLOUD_RUN_JOB_TRIGGER_URL
|
|
352118
|
+
};
|
|
352119
|
+
}
|
|
352120
|
+
};
|
|
352121
|
+
exports.GCLOUD_RUN_DEPLOY_TYPES = {
|
|
352122
|
+
"google-cloudrun": exports.GCLOUD_RUN_DEPLOY_TYPE,
|
|
352123
|
+
"google-cloudrun-job": exports.GCLOUD_RUN_JOB_DEPLOY_TYPE
|
|
352124
|
+
};
|
|
351915
352125
|
|
|
351916
352126
|
/***/ }),
|
|
351917
352127
|
|
|
@@ -352066,6 +352276,9 @@ exports.CUSTOM_DEPLOY_TYPE = {
|
|
|
352066
352276
|
},
|
|
352067
352277
|
additionalSecretKeys: function () {
|
|
352068
352278
|
return [];
|
|
352279
|
+
},
|
|
352280
|
+
getAdditionalEnvVars: function () {
|
|
352281
|
+
return {};
|
|
352069
352282
|
}
|
|
352070
352283
|
};
|
|
352071
352284
|
|
|
@@ -352129,6 +352342,9 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
|
|
|
352129
352342
|
},
|
|
352130
352343
|
additionalSecretKeys: function () {
|
|
352131
352344
|
return [];
|
|
352345
|
+
},
|
|
352346
|
+
getAdditionalEnvVars: function () {
|
|
352347
|
+
return {};
|
|
352132
352348
|
}
|
|
352133
352349
|
};
|
|
352134
352350
|
|
|
@@ -352140,6 +352356,20 @@ exports.DOCKER_TAG_DEPLOY_TYPE = {
|
|
|
352140
352356
|
"use strict";
|
|
352141
352357
|
|
|
352142
352358
|
|
|
352359
|
+
var __assign = this && this.__assign || function () {
|
|
352360
|
+
__assign = Object.assign || function (t) {
|
|
352361
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
352362
|
+
s = arguments[i];
|
|
352363
|
+
|
|
352364
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
352365
|
+
}
|
|
352366
|
+
|
|
352367
|
+
return t;
|
|
352368
|
+
};
|
|
352369
|
+
|
|
352370
|
+
return __assign.apply(this, arguments);
|
|
352371
|
+
};
|
|
352372
|
+
|
|
352143
352373
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
352144
352374
|
if (k2 === undefined) k2 = k;
|
|
352145
352375
|
Object.defineProperty(o, k2, {
|
|
@@ -352178,12 +352408,11 @@ __exportStar(__nccwpck_require__(13539), exports);
|
|
|
352178
352408
|
|
|
352179
352409
|
__exportStar(__nccwpck_require__(81344), exports);
|
|
352180
352410
|
|
|
352181
|
-
exports.DEPLOY_TYPES = {
|
|
352411
|
+
exports.DEPLOY_TYPES = __assign({
|
|
352182
352412
|
kubernetes: kubernetes_1.KUBERNETES_DEPLOY_TYPE,
|
|
352183
352413
|
custom: custom_1.CUSTOM_DEPLOY_TYPE,
|
|
352184
|
-
"google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE,
|
|
352185
352414
|
dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE
|
|
352186
|
-
};
|
|
352415
|
+
}, cloudRun_1.GCLOUD_RUN_DEPLOY_TYPES);
|
|
352187
352416
|
|
|
352188
352417
|
/***/ }),
|
|
352189
352418
|
|
|
@@ -352196,20 +352425,26 @@ exports.DEPLOY_TYPES = {
|
|
|
352196
352425
|
exports.__esModule = true;
|
|
352197
352426
|
exports.additionalKubernetesSecretKeys = void 0;
|
|
352198
352427
|
|
|
352199
|
-
var additionalKubernetesSecretKeys = function (
|
|
352200
|
-
var
|
|
352428
|
+
var additionalKubernetesSecretKeys = function (_a) {
|
|
352429
|
+
var _b, _c, _d, _e;
|
|
352430
|
+
|
|
352431
|
+
var deployConfig = _a.deployConfig;
|
|
352432
|
+
|
|
352433
|
+
if (!deployConfig) {
|
|
352434
|
+
return [];
|
|
352435
|
+
}
|
|
352201
352436
|
|
|
352202
352437
|
var keys = [];
|
|
352203
352438
|
|
|
352204
|
-
if ((
|
|
352439
|
+
if ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) {
|
|
352205
352440
|
keys.push("MONGODB_ROOT_PASSWORD");
|
|
352206
352441
|
|
|
352207
|
-
if (
|
|
352442
|
+
if (deployConfig.values.mongodb.architecture === "replicaset") {
|
|
352208
352443
|
keys.push("MONGODB_REPLICASET_KEY");
|
|
352209
352444
|
}
|
|
352210
352445
|
}
|
|
352211
352446
|
|
|
352212
|
-
if ((
|
|
352447
|
+
if ((_e = (_d = deployConfig.values) === null || _d === void 0 ? void 0 : _d.cloudsql) === null || _e === void 0 ? void 0 : _e.enabled) {
|
|
352213
352448
|
keys.push("POSTGRESQL_PASSWORD");
|
|
352214
352449
|
keys.push("cloudsqlProxyCredentials");
|
|
352215
352450
|
}
|
|
@@ -352379,14 +352614,24 @@ exports.createKubernetesDeployJobs = createKubernetesDeployJobs;
|
|
|
352379
352614
|
/***/ }),
|
|
352380
352615
|
|
|
352381
352616
|
/***/ 95682:
|
|
352382
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__)
|
|
352617
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
352383
352618
|
|
|
352384
352619
|
"use strict";
|
|
352385
352620
|
|
|
352386
352621
|
|
|
352622
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
352623
|
+
return mod && mod.__esModule ? mod : {
|
|
352624
|
+
"default": mod
|
|
352625
|
+
};
|
|
352626
|
+
};
|
|
352627
|
+
|
|
352387
352628
|
exports.__esModule = true;
|
|
352388
352629
|
exports.KUBERNETES_DEPLOY_TYPE = void 0;
|
|
352389
352630
|
|
|
352631
|
+
var slugify_1 = __importDefault(__nccwpck_require__(44035));
|
|
352632
|
+
|
|
352633
|
+
var __1 = __nccwpck_require__(90223);
|
|
352634
|
+
|
|
352390
352635
|
var additionalSecretKeys_1 = __nccwpck_require__(75775);
|
|
352391
352636
|
|
|
352392
352637
|
var deployJob_1 = __nccwpck_require__(9792);
|
|
@@ -352396,7 +352641,32 @@ exports.KUBERNETES_DEPLOY_TYPE = {
|
|
|
352396
352641
|
defaults: function () {
|
|
352397
352642
|
return {};
|
|
352398
352643
|
},
|
|
352399
|
-
additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys
|
|
352644
|
+
additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys,
|
|
352645
|
+
getAdditionalEnvVars: function (_a) {
|
|
352646
|
+
var _b;
|
|
352647
|
+
|
|
352648
|
+
var componentName = _a.componentName,
|
|
352649
|
+
fullConfig = _a.fullConfig,
|
|
352650
|
+
deployConfig = _a.deployConfig,
|
|
352651
|
+
env = _a.env,
|
|
352652
|
+
envType = _a.envType,
|
|
352653
|
+
commitInfo = _a.commitInfo;
|
|
352654
|
+
var KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
|
|
352655
|
+
var KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
|
|
352656
|
+
var KUBE_NAMESPACE = (0, __1.getKubernetesNamespace)(fullConfig, env);
|
|
352657
|
+
var componentSlug = (0, slugify_1["default"])(componentName);
|
|
352658
|
+
var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
|
|
352659
|
+
var domainCanonical = deployConfig && ((_b = deployConfig.cluster) === null || _b === void 0 ? void 0 : _b.domainCanonical) || // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
|
|
352660
|
+
fullConfig.domainCanonical || "panter.cloud";
|
|
352661
|
+
var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
|
|
352662
|
+
|
|
352663
|
+
return {
|
|
352664
|
+
KUBE_NAMESPACE: KUBE_NAMESPACE,
|
|
352665
|
+
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
352666
|
+
KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
|
|
352667
|
+
HOST_CANONICAL: HOST_CANONICAL
|
|
352668
|
+
};
|
|
352669
|
+
}
|
|
352400
352670
|
};
|
|
352401
352671
|
|
|
352402
352672
|
/***/ }),
|