@catladder/cli 0.0.0-test4 → 1.0.0
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/.nvmrc +1 -1
- package/bin/catenv +3 -0
- package/bin/catladder +1 -1
- package/dist/apps/catenv/catenv.d.ts +2 -0
- package/dist/apps/catenv/catenv.js +135 -0
- package/dist/apps/catenv/catenv.js.map +1 -0
- package/dist/apps/cli/cli.d.ts +2 -0
- package/dist/apps/cli/cli.js +81 -0
- package/dist/apps/cli/cli.js.map +1 -0
- package/dist/apps/cli/commands/general/index.d.ts +4 -0
- package/dist/apps/cli/commands/general/index.js +274 -0
- package/dist/apps/cli/commands/general/index.js.map +1 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.d.ts +3 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +56 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -0
- package/dist/apps/cli/commands/general/portForward.d.ts +3 -0
- package/dist/apps/cli/commands/general/portForward.js +98 -0
- package/dist/apps/cli/commands/general/portForward.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/index.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/index.js +53 -0
- package/dist/apps/cli/commands/mongodb/index.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +190 -0
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js +96 -0
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +105 -0
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/utils/index.d.ts +13 -0
- package/dist/apps/cli/commands/mongodb/utils/index.js +167 -0
- package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +128 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js +254 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
- package/dist/apps/cli/commands/project/commandCopyDB.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandCopyDB.js +102 -0
- package/dist/apps/cli/commands/project/commandCopyDB.js.map +1 -0
- package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandDeletePods.js +119 -0
- package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -0
- package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandDeleteProject.js +97 -0
- package/dist/apps/cli/commands/project/commandDeleteProject.js.map +1 -0
- package/dist/apps/cli/commands/project/commandEnvVars.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandEnvVars.js +74 -0
- package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -0
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +58 -0
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -0
- package/dist/apps/cli/commands/project/commandGetShell.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandGetShell.js +92 -0
- package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.js +185 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -0
- package/dist/apps/cli/commands/project/commandInitGitlab.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandInitGitlab.js +245 -0
- package/dist/apps/cli/commands/project/commandInitGitlab.js.map +1 -0
- package/dist/apps/cli/commands/project/commandInitProject.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandInitProject.js +345 -0
- package/dist/apps/cli/commands/project/commandInitProject.js.map +1 -0
- package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandListPods.js +78 -0
- package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
- package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js +113 -0
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
- package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
- package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenDashboard.js +92 -0
- package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
- package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenGit.js +56 -0
- package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
- package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +99 -0
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenLogs.js +87 -0
- package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
- package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
- package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
- package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandPortForward.js +106 -0
- package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
- package/dist/apps/cli/commands/project/commandReloadConfig.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandReloadConfig.js +62 -0
- package/dist/apps/cli/commands/project/commandReloadConfig.js.map +1 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
- package/dist/apps/cli/commands/project/index.d.ts +3 -0
- package/dist/apps/cli/commands/project/index.js +97 -0
- package/dist/apps/cli/commands/project/index.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +1 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js +92 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
- package/dist/apps/cli/commands/shared/index.d.ts +2 -0
- package/dist/apps/cli/commands/shared/index.js +72 -0
- package/dist/apps/cli/commands/shared/index.js.map +1 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +131 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
- package/dist/apps/cli/config/writeConfig.d.ts +5 -0
- package/dist/apps/cli/config/writeConfig.js +104 -0
- package/dist/apps/cli/config/writeConfig.js.map +1 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
- package/dist/apps/cli/verify/index.d.ts +2 -0
- package/dist/apps/cli/verify/index.js +90 -0
- package/dist/apps/cli/verify/index.js.map +1 -0
- package/dist/apps/cli/verify/migration/fromv2.d.ts +3 -0
- package/dist/apps/cli/verify/migration/fromv2.js +322 -0
- package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.js +88 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +17 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.js +26 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
- package/dist/catenv.d.ts +1 -0
- package/dist/catenv.js +8 -0
- package/dist/catenv.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +13 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/clusters.d.ts +14 -0
- package/dist/config/clusters.js +72 -0
- package/dist/config/clusters.js.map +1 -0
- package/dist/config/constants.d.ts +4 -0
- package/dist/config/constants.js +8 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/getProjectConfig.d.ts +21 -0
- package/dist/config/getProjectConfig.js +212 -0
- package/dist/config/getProjectConfig.js.map +1 -0
- package/dist/k8sApi/index.d.ts +5 -0
- package/dist/k8sApi/index.js +11 -0
- package/dist/k8sApi/index.js.map +1 -0
- package/dist/packageInfos.d.ts +2 -0
- package/dist/packageInfos.js +6 -0
- package/dist/packageInfos.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/types.d.ts +18 -0
- package/dist/types/types.js +3 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils/cluster.d.ts +12 -0
- package/dist/utils/cluster.js +100 -0
- package/dist/utils/cluster.js.map +1 -0
- package/dist/utils/dashboardToken.d.ts +2 -0
- package/dist/utils/dashboardToken.js +89 -0
- package/dist/utils/dashboardToken.js.map +1 -0
- package/dist/utils/editAsFile.d.ts +1 -0
- package/dist/utils/editAsFile.js +85 -0
- package/dist/utils/editAsFile.js.map +1 -0
- package/dist/utils/files.d.ts +2 -0
- package/dist/utils/files.js +83 -0
- package/dist/utils/files.js.map +1 -0
- package/dist/utils/formatEnvVars.d.ts +2 -0
- package/dist/utils/formatEnvVars.js +10 -0
- package/dist/utils/formatEnvVars.js.map +1 -0
- package/dist/utils/getEditor.d.ts +4 -0
- package/dist/utils/getEditor.js +70 -0
- package/dist/utils/getEditor.js.map +1 -0
- package/dist/utils/gitlab.d.ts +21 -0
- package/dist/utils/gitlab.js +258 -0
- package/dist/utils/gitlab.js.map +1 -0
- package/dist/utils/log.d.ts +1 -0
- package/dist/utils/log.js +14 -0
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/passwordstore/index.d.ts +8 -0
- package/dist/utils/passwordstore/index.js +378 -0
- package/dist/utils/passwordstore/index.js.map +1 -0
- package/dist/utils/portForward.d.ts +4 -0
- package/dist/utils/portForward.js +116 -0
- package/dist/utils/portForward.js.map +1 -0
- package/dist/utils/preferences/index.d.ts +3 -0
- package/dist/utils/preferences/index.js +119 -0
- package/dist/utils/preferences/index.js.map +1 -0
- package/dist/utils/projects/index.d.ts +8 -0
- package/dist/utils/projects/index.js +150 -0
- package/dist/utils/projects/index.js.map +1 -0
- package/dist/utils/promise.d.ts +2 -0
- package/dist/utils/promise.js +62 -0
- package/dist/utils/promise.js.map +1 -0
- package/dist/utils/shell.d.ts +1 -0
- package/dist/utils/shell.js +81 -0
- package/dist/utils/shell.js.map +1 -0
- package/package.json +10 -11
- package/src/apps/catenv/catenv.ts +48 -27
- package/src/apps/{shell/shell.ts → cli/cli.ts} +12 -2
- package/src/apps/{shell → cli}/commands/general/index.ts +1 -1
- package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
- package/src/apps/{shell → cli}/commands/general/portForward.ts +1 -1
- package/src/apps/{shell → cli}/commands/mongodb/index.ts +1 -1
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +18 -18
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +12 -10
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoPortForward.ts +13 -8
- package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +9 -8
- package/src/apps/{shell → cli}/commands/project/commandCloudSqlProxy.ts +23 -17
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +204 -0
- package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +22 -23
- package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +8 -9
- package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +7 -8
- package/src/apps/cli/commands/project/commandEnvVars.ts +15 -0
- package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +2 -2
- package/src/apps/{shell → cli}/commands/project/commandGetShell.ts +10 -10
- package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
- package/src/apps/cli/commands/project/commandInitGitlab.ts +203 -0
- package/src/apps/{shell → cli}/commands/project/commandInitProject.ts +14 -6
- package/src/apps/cli/commands/project/commandListPods.ts +18 -0
- package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +16 -7
- package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
- package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +10 -7
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +45 -0
- package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
- package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +1 -1
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +7 -7
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +9 -10
- package/src/apps/{shell → cli}/commands/project/commandOpenLogs.ts +7 -7
- package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +9 -7
- package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +8 -8
- package/src/apps/cli/commands/project/commandReloadConfig.ts +12 -0
- package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +7 -7
- package/src/apps/{shell → cli}/commands/project/index.ts +4 -3
- package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
- package/src/apps/cli/commands/project/utils/ensureCluster.ts +37 -0
- package/src/apps/{shell → cli}/commands/project/utils/ensureNamespace.ts +2 -3
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
- package/src/apps/{shell → cli}/commands/shared/index.ts +0 -0
- package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +11 -11
- package/src/apps/cli/config/writeConfig.ts +69 -0
- package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
- package/src/apps/cli/verify/index.ts +34 -0
- package/src/apps/cli/verify/migration/fromv2.ts +242 -0
- package/src/apps/cli/verify/migration/migrateSecrets.ts +37 -0
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +43 -0
- package/src/catenv.ts +3 -0
- package/src/cli.ts +8 -0
- package/src/config/getProjectConfig.ts +118 -0
- package/src/types/types.ts +0 -2
- package/src/utils/cluster.ts +15 -2
- package/src/utils/editAsFile.ts +31 -0
- package/src/utils/files.ts +6 -2
- package/src/utils/gitlab.ts +126 -32
- package/src/utils/passwordstore/index.ts +19 -21
- package/src/utils/preferences/index.ts +6 -3
- package/src/utils/projects/index.ts +14 -134
- package/tsconfig.json +3 -7
- package/bin/catenv.sh +0 -1
- package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
- package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
- package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
- package/src/apps/shell/commands/project/commandListPods.ts +0 -21
- package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
- package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
- package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
- package/src/apps/shell/commands/project/commandVariables.ts +0 -13
- package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
- package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
- package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
- package/src/index.ts +0 -17
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
exports.__esModule = true;
|
|
42
|
+
exports.getProjectPodNames = exports.getProjectPvcs = exports.getProjectPods = exports.getProjectNamespace = exports.hasGitlabCiFile = exports.readRootGitlabCiFile = exports.getRootGitlabCiFile = exports.getGitRoot = void 0;
|
|
43
|
+
var child_process_promise_1 = require("child-process-promise");
|
|
44
|
+
var path_1 = require("path");
|
|
45
|
+
var getProjectConfig_1 = require("../../config/getProjectConfig");
|
|
46
|
+
var k8sApi_1 = __importDefault(require("../../k8sApi"));
|
|
47
|
+
var files_1 = require("../files");
|
|
48
|
+
var getGitRoot = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
+
var _a;
|
|
50
|
+
return __generator(this, function (_b) {
|
|
51
|
+
switch (_b.label) {
|
|
52
|
+
case 0: return [4 /*yield*/, (0, child_process_promise_1.exec)("git rev-parse --show-toplevel")];
|
|
53
|
+
case 1: return [2 /*return*/, (_a = (_b.sent()).stdout) === null || _a === void 0 ? void 0 : _a.trim()];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}); };
|
|
57
|
+
exports.getGitRoot = getGitRoot;
|
|
58
|
+
var getRootGitlabCiFile = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
59
|
+
var gitRoot;
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
switch (_a.label) {
|
|
62
|
+
case 0: return [4 /*yield*/, (0, exports.getGitRoot)()];
|
|
63
|
+
case 1:
|
|
64
|
+
gitRoot = _a.sent();
|
|
65
|
+
return [2 /*return*/, (0, path_1.join)(gitRoot, ".gitlab-ci.yml")];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}); };
|
|
69
|
+
exports.getRootGitlabCiFile = getRootGitlabCiFile;
|
|
70
|
+
var readRootGitlabCiFile = function () { return __awaiter(void 0, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
|
|
71
|
+
switch (_b.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
_a = files_1.readFileOrError;
|
|
74
|
+
return [4 /*yield*/, (0, exports.getRootGitlabCiFile)()];
|
|
75
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
|
76
|
+
}
|
|
77
|
+
}); }); };
|
|
78
|
+
exports.readRootGitlabCiFile = readRootGitlabCiFile;
|
|
79
|
+
var hasGitlabCiFile = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
+
var _a, error, file;
|
|
81
|
+
return __generator(this, function (_b) {
|
|
82
|
+
switch (_b.label) {
|
|
83
|
+
case 0: return [4 /*yield*/, (0, exports.readRootGitlabCiFile)()];
|
|
84
|
+
case 1:
|
|
85
|
+
_a = _b.sent(), error = _a[0], file = _a[1];
|
|
86
|
+
if (error) {
|
|
87
|
+
return [2 /*return*/, false];
|
|
88
|
+
}
|
|
89
|
+
return [2 /*return*/, true];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}); };
|
|
93
|
+
exports.hasGitlabCiFile = hasGitlabCiFile;
|
|
94
|
+
var getProjectNamespace = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
|
|
95
|
+
var env, config;
|
|
96
|
+
return __generator(this, function (_a) {
|
|
97
|
+
switch (_a.label) {
|
|
98
|
+
case 0:
|
|
99
|
+
env = (0, getProjectConfig_1.parseChoice)(envComponent).env;
|
|
100
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
|
|
101
|
+
case 1:
|
|
102
|
+
config = _a.sent();
|
|
103
|
+
return [2 /*return*/, "".concat(config.customerName, "-").concat(config.appName, "-").concat(env)];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}); };
|
|
107
|
+
exports.getProjectNamespace = getProjectNamespace;
|
|
108
|
+
var getProjectPods = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
|
|
109
|
+
var namespace, res;
|
|
110
|
+
return __generator(this, function (_a) {
|
|
111
|
+
switch (_a.label) {
|
|
112
|
+
case 0: return [4 /*yield*/, (0, exports.getProjectNamespace)(envComponent)];
|
|
113
|
+
case 1:
|
|
114
|
+
namespace = _a.sent();
|
|
115
|
+
return [4 /*yield*/, k8sApi_1["default"].listNamespacedPod(namespace)];
|
|
116
|
+
case 2:
|
|
117
|
+
res = _a.sent();
|
|
118
|
+
return [2 /*return*/, res.body.items];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}); };
|
|
122
|
+
exports.getProjectPods = getProjectPods;
|
|
123
|
+
var getProjectPvcs = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
+
var namespace, res;
|
|
125
|
+
return __generator(this, function (_a) {
|
|
126
|
+
switch (_a.label) {
|
|
127
|
+
case 0: return [4 /*yield*/, (0, exports.getProjectNamespace)(envComponent)];
|
|
128
|
+
case 1:
|
|
129
|
+
namespace = _a.sent();
|
|
130
|
+
return [4 /*yield*/, k8sApi_1["default"].listNamespacedPersistentVolumeClaim(namespace)];
|
|
131
|
+
case 2:
|
|
132
|
+
res = _a.sent();
|
|
133
|
+
return [2 /*return*/, res.body.items];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}); };
|
|
137
|
+
exports.getProjectPvcs = getProjectPvcs;
|
|
138
|
+
var getProjectPodNames = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
|
|
139
|
+
var pods;
|
|
140
|
+
return __generator(this, function (_a) {
|
|
141
|
+
switch (_a.label) {
|
|
142
|
+
case 0: return [4 /*yield*/, (0, exports.getProjectPods)(envComponent)];
|
|
143
|
+
case 1:
|
|
144
|
+
pods = _a.sent();
|
|
145
|
+
return [2 /*return*/, pods.map(function (n) { return n.metadata.name; })];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}); };
|
|
149
|
+
exports.getProjectPodNames = getProjectPodNames;
|
|
150
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/projects/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA6C;AAE7C,6BAA4B;AAC5B,kEAA8E;AAC9E,wDAAkC;AAClC,kCAA2C;AAEpC,IAAM,UAAU,GAAG;;;;oBAChB,qBAAM,IAAA,4BAAI,EAAC,+BAA+B,CAAC,EAAA;oBAAnD,sBAAO,MAAA,CAAC,SAA2C,CAAC,CAAC,MAAM,0CAAE,IAAI,EAAE,EAAC;;;KACrE,CAAC;AAFW,QAAA,UAAU,cAErB;AAEK,IAAM,mBAAmB,GAAG;;;;oBACjB,qBAAM,IAAA,kBAAU,GAAE,EAAA;;gBAA5B,OAAO,GAAG,SAAkB;gBAClC,sBAAO,IAAA,WAAI,EAAC,OAAO,EAAE,gBAAgB,CAAC,EAAC;;;KACxC,CAAC;AAHW,QAAA,mBAAmB,uBAG9B;AAEK,IAAM,oBAAoB,GAAG;;;YAClC,KAAA,uBAAe,CAAA;YAAC,qBAAM,IAAA,2BAAmB,GAAE,EAAA;gBAA3C,sBAAA,kBAAgB,SAA2B,EAAC,EAAA;;SAAA,CAAC;AADlC,QAAA,oBAAoB,wBACc;AAExC,IAAM,eAAe,GAAG;;;;oBACP,qBAAM,IAAA,4BAAoB,GAAE,EAAA;;gBAA5C,KAAgB,SAA4B,EAA3C,KAAK,QAAA,EAAE,IAAI,QAAA;gBAClB,IAAI,KAAK,EAAE;oBACT,sBAAO,KAAK,EAAC;iBACd;gBACD,sBAAO,IAAI,EAAC;;;KACb,CAAC;AANW,QAAA,eAAe,mBAM1B;AAEK,IAAM,mBAAmB,GAAG,UAAO,YAAoB;;;;;gBACpD,GAAG,GAAK,IAAA,8BAAW,EAAC,YAAY,CAAC,IAA9B,CAA+B;gBAC3B,qBAAM,IAAA,mCAAgB,GAAE,EAAA;;gBAAjC,MAAM,GAAG,SAAwB;gBACvC,sBAAO,UAAG,MAAM,CAAC,YAAY,cAAI,MAAM,CAAC,OAAO,cAAI,GAAG,CAAE,EAAC;;;KAC1D,CAAC;AAJW,QAAA,mBAAmB,uBAI9B;AAEK,IAAM,cAAc,GAAG,UAAO,YAAoB;;;;oBACrC,qBAAM,IAAA,2BAAmB,EAAC,YAAY,CAAC,EAAA;;gBAAnD,SAAS,GAAG,SAAuC;gBAC7C,qBAAM,mBAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAA;;gBAA/C,GAAG,GAAG,SAAyC;gBAErD,sBAAO,GAAG,CAAC,IAAI,CAAC,KAAK,EAAC;;;KACvB,CAAC;AALW,QAAA,cAAc,kBAKzB;AAEK,IAAM,cAAc,GAAG,UAAO,YAAoB;;;;oBACrC,qBAAM,IAAA,2BAAmB,EAAC,YAAY,CAAC,EAAA;;gBAAnD,SAAS,GAAG,SAAuC;gBAC7C,qBAAM,mBAAM,CAAC,mCAAmC,CAAC,SAAS,CAAC,EAAA;;gBAAjE,GAAG,GAAG,SAA2D;gBAEvE,sBAAO,GAAG,CAAC,IAAI,CAAC,KAAK,EAAC;;;KACvB,CAAC;AALW,QAAA,cAAc,kBAKzB;AAEK,IAAM,kBAAkB,GAAG,UAAO,YAAoB;;;;oBAC9C,qBAAM,IAAA,sBAAc,EAAC,YAAY,CAAC,EAAA;;gBAAzC,IAAI,GAAG,SAAkC;gBAC/C,sBAAO,IAAI,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAf,CAAe,CAAC,EAAC;;;KACzC,CAAC;AAHW,QAAA,kBAAkB,sBAG7B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.__esModule = true;
|
|
39
|
+
exports.delay = exports.filter = void 0;
|
|
40
|
+
function filter(arr, iterator) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
42
|
+
var fail;
|
|
43
|
+
var _this = this;
|
|
44
|
+
return __generator(this, function (_a) {
|
|
45
|
+
switch (_a.label) {
|
|
46
|
+
case 0:
|
|
47
|
+
fail = Symbol("fail");
|
|
48
|
+
return [4 /*yield*/, Promise.all(arr.map(function (item) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0: return [4 /*yield*/, iterator(item)];
|
|
51
|
+
case 1: return [2 /*return*/, ((_a.sent()) ? item : fail)];
|
|
52
|
+
}
|
|
53
|
+
}); }); }))];
|
|
54
|
+
case 1: return [2 /*return*/, (_a.sent()).filter(function (i) { return i !== fail; })];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.filter = filter;
|
|
60
|
+
var delay = function (ms) { return new Promise(function (res) { return setTimeout(res, ms); }); };
|
|
61
|
+
exports.delay = delay;
|
|
62
|
+
//# sourceMappingURL=promise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise.js","sourceRoot":"","sources":["../../src/utils/promise.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAsB,MAAM,CAC1B,GAAQ,EACR,QAAuC;;;;;;;oBAEjC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;oBACnB,qBAAM,OAAO,CAAC,GAAG,CACxB,GAAG,CAAC,GAAG,CAAC,UAAM,IAAI;;wCAAM,qBAAM,QAAQ,CAAC,IAAI,CAAC,EAAA;wCAAtB,sBAAA,CAAC,CAAC,SAAoB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAA;;iCAAA,CAAC,CAC9D,EAAA;wBAFD,sBAAQ,CAAC,SAER,CAAC,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,KAAK,IAAI,EAAV,CAAU,CAAyB,EAAC;;;;CACpD;AARD,wBAQC;AAEM,IAAM,KAAK,GAAG,UAAC,EAAU,IAAK,OAAA,IAAI,OAAO,CAAC,UAAA,GAAG,IAAI,OAAA,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,EAAnB,CAAmB,CAAC,EAAvC,CAAuC,CAAC;AAAhE,QAAA,KAAK,SAA2D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getShell: (namespace: string, podName: string) => Promise<void>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.__esModule = true;
|
|
50
|
+
exports.getShell = void 0;
|
|
51
|
+
var child_process_promise_1 = require("child-process-promise");
|
|
52
|
+
var getShell = function (namespace, podName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
+
var command, e_1;
|
|
54
|
+
return __generator(this, function (_a) {
|
|
55
|
+
switch (_a.label) {
|
|
56
|
+
case 0:
|
|
57
|
+
command = "kubectl exec -it ".concat(podName, " -n ").concat(namespace, " -- /bin/sh -xc 'bash||sh'");
|
|
58
|
+
_a.label = 1;
|
|
59
|
+
case 1:
|
|
60
|
+
_a.trys.push([1, 3, , 4]);
|
|
61
|
+
return [4 /*yield*/, (0, child_process_promise_1.spawn)(command, {
|
|
62
|
+
stdio: "inherit",
|
|
63
|
+
shell: true,
|
|
64
|
+
env: __assign(__assign({}, process.env), { DEBUG: "" })
|
|
65
|
+
})];
|
|
66
|
+
case 2:
|
|
67
|
+
_a.sent();
|
|
68
|
+
return [3 /*break*/, 4];
|
|
69
|
+
case 3:
|
|
70
|
+
e_1 = _a.sent();
|
|
71
|
+
// tslint:disable-next-line:no-console
|
|
72
|
+
if (e_1.code !== 130) {
|
|
73
|
+
console.log(e_1);
|
|
74
|
+
}
|
|
75
|
+
return [3 /*break*/, 4];
|
|
76
|
+
case 4: return [2 /*return*/];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}); };
|
|
80
|
+
exports.getShell = getShell;
|
|
81
|
+
//# sourceMappingURL=shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA8C;AAEvC,IAAM,QAAQ,GAAG,UAAO,SAAiB,EAAE,OAAe;;;;;gBACzD,OAAO,GAAG,2BAAoB,OAAO,iBAAO,SAAS,+BAA4B,CAAC;;;;gBAEtF,qBAAM,IAAA,6BAAK,EAAC,OAAO,EAAE;wBACnB,KAAK,EAAE,SAAS;wBAChB,KAAK,EAAE,IAAI;wBACX,GAAG,wBACE,OAAO,CAAC,GAAG,KACd,KAAK,EAAE,EAAE,GACV;qBACF,CAAC,EAAA;;gBAPF,SAOE,CAAC;;;;gBAEH,sCAAsC;gBACtC,IAAI,GAAC,CAAC,IAAI,KAAK,GAAG,EAAE;oBAClB,OAAO,CAAC,GAAG,CAAC,GAAC,CAAC,CAAC;iBAChB;;;;;KAEJ,CAAC;AAjBW,QAAA,QAAQ,YAiBnB"}
|
package/package.json
CHANGED
|
@@ -7,16 +7,17 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"lint": "eslint \"src/**/*.ts\"",
|
|
9
9
|
"lint:fix": "eslint \"src/**/*.ts\" --fix",
|
|
10
|
-
"test": "
|
|
11
|
-
"build": "tsc",
|
|
12
|
-
"build:watch": "tsc -w"
|
|
10
|
+
"test": "yarn run lint",
|
|
11
|
+
"build": "yarn tsc",
|
|
12
|
+
"build:watch": "yarn tsc -w"
|
|
13
13
|
},
|
|
14
14
|
"bin": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"catenv": "./bin/catenv",
|
|
16
|
+
"catladder": "./bin/catladder"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@bitwarden/cli": "^1.8.0",
|
|
20
|
+
"@catladder/pipeline": "1.0.0",
|
|
20
21
|
"@kubernetes/client-node": "^0.16.1",
|
|
21
22
|
"child-process-promise": "^2.2.1",
|
|
22
23
|
"clipboardy": "^2.2.0",
|
|
@@ -43,23 +44,21 @@
|
|
|
43
44
|
"node": ">=12.0.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@semantic-release/git": "^10.0.1",
|
|
47
|
-
"@semantic-release/gitlab": "^7.0.4",
|
|
48
47
|
"@tsconfig/node14": "^1.0.1",
|
|
49
48
|
"@types/common-tags": "^1.8.0",
|
|
50
49
|
"@types/fs-extra": "^5.0.4",
|
|
51
|
-
"@types/js-yaml": "^
|
|
50
|
+
"@types/js-yaml": "^4.0.5",
|
|
52
51
|
"@types/lodash": "^4.14.119",
|
|
53
52
|
"@types/memoizee": "^0.4.2",
|
|
54
53
|
"@types/node-fetch": "^2.1.4",
|
|
55
54
|
"@types/request": "^2.48.1",
|
|
55
|
+
"@types/tmp": "^0.2.3",
|
|
56
56
|
"@types/update-notifier": "^2.5.0",
|
|
57
57
|
"@types/vorpal": "^1.12.0",
|
|
58
58
|
"@types/websocket": "^0.0.40",
|
|
59
59
|
"@types/yargs": "^13.0.0",
|
|
60
|
-
"
|
|
61
|
-
"@typescript-eslint/parser": "^5.8.0",
|
|
60
|
+
"eslint": "^8.7.0",
|
|
62
61
|
"typescript": "^4.5.4"
|
|
63
62
|
},
|
|
64
|
-
"version": "
|
|
63
|
+
"version": "1.0.0"
|
|
65
64
|
}
|
|
@@ -1,38 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Config, ComponentConfig } from "@catladder/pipeline";
|
|
2
|
+
import { getEnvVars, getProjectConfig } from "../../config/getProjectConfig";
|
|
3
|
+
import { getGitRoot } from "../../utils/projects";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
const getCurrentComponentName = async (
|
|
6
|
+
components: Record<string, ComponentConfig>
|
|
7
|
+
) => {
|
|
8
|
+
const gitRoot = await getGitRoot();
|
|
9
|
+
const currentDir = process.cwd();
|
|
10
|
+
return Object.keys(components).find((c) =>
|
|
11
|
+
currentDir.startsWith(join(gitRoot, components[c].dir))
|
|
12
|
+
);
|
|
13
|
+
};
|
|
6
14
|
|
|
7
15
|
const sanitizeEnvVarName = (name: string) => name.replace(/[\s\-.]+/g, "_");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
16
|
+
|
|
17
|
+
const getAllVariablesToPrint = async (config: Config) => {
|
|
18
|
+
const { components } = config;
|
|
19
|
+
|
|
20
|
+
const currentComponent = await getCurrentComponentName(components);
|
|
21
|
+
|
|
11
22
|
let variables = {};
|
|
12
|
-
if (
|
|
13
|
-
variables = await
|
|
14
|
-
} else
|
|
23
|
+
if (currentComponent) {
|
|
24
|
+
variables = await getEnvVars(null, "local", currentComponent);
|
|
25
|
+
} else {
|
|
15
26
|
// when in a monorep and not in a subapp, merge all env vars.
|
|
16
27
|
// this is not 100% correct, but better than not exporting any vars at all
|
|
17
28
|
// so we also add prefixed variants
|
|
18
|
-
variables = await
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Object.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
variables = await Object.keys(components).reduce(
|
|
30
|
+
async (acc, componentName) => {
|
|
31
|
+
const subappvars = await getEnvVars(null, "local", componentName);
|
|
32
|
+
return {
|
|
33
|
+
...(await acc),
|
|
34
|
+
...subappvars,
|
|
35
|
+
// also add prefixed variants in case
|
|
36
|
+
...Object.fromEntries(
|
|
37
|
+
Object.entries(subappvars).map(([key, value]) => [
|
|
38
|
+
`${sanitizeEnvVarName(componentName.toUpperCase())}_${key}`,
|
|
39
|
+
value,
|
|
40
|
+
])
|
|
41
|
+
),
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
{}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return variables;
|
|
48
|
+
};
|
|
49
|
+
export default async () => {
|
|
50
|
+
const config = await getProjectConfig();
|
|
51
|
+
if (!config) {
|
|
52
|
+
return;
|
|
34
53
|
}
|
|
35
54
|
|
|
55
|
+
const variables = await getAllVariablesToPrint(config);
|
|
56
|
+
|
|
36
57
|
console.log(
|
|
37
58
|
Object.entries(variables)
|
|
38
59
|
.map(([key, value]) => `export ${key}='${value}'`)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Vorpal from "vorpal";
|
|
2
|
+
import { config } from "yargs";
|
|
2
3
|
// tslint:disable-next-line:no-var-requires
|
|
3
4
|
import packageInfos from "../../packageInfos";
|
|
4
5
|
import { stopAllPortForwards } from "../../utils/portForward";
|
|
@@ -6,11 +7,16 @@ import general from "./commands/general";
|
|
|
6
7
|
import mongodb from "./commands/mongodb";
|
|
7
8
|
import project from "./commands/project";
|
|
8
9
|
import theStuffThatReallyMatters from "./commands/theStuffThatReallyMatters";
|
|
9
|
-
const welcomeMessage = `catladder 2 😻 version ${packageInfos.version}`;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
import { getProjectConfig } from "../../config/getProjectConfig";
|
|
12
|
+
import { verify } from "./verify";
|
|
13
|
+
import { showProjectBanner } from "./commands/project/utils/showProjectBanner";
|
|
14
|
+
|
|
15
|
+
export default async () => {
|
|
12
16
|
const vorpal = new Vorpal();
|
|
13
17
|
|
|
18
|
+
const welcomeMessage = `catladder 2022 😻 version ${packageInfos.version}`;
|
|
19
|
+
|
|
14
20
|
vorpal
|
|
15
21
|
.delimiter("catladder $") // emoji messes with cursor :-( https://github.com/dthree/vorpal/issues/332
|
|
16
22
|
.history("catladder")
|
|
@@ -19,6 +25,10 @@ export default () => {
|
|
|
19
25
|
.log(welcomeMessage)
|
|
20
26
|
.log("");
|
|
21
27
|
|
|
28
|
+
await showProjectBanner(vorpal);
|
|
29
|
+
|
|
30
|
+
verify(vorpal);
|
|
31
|
+
|
|
22
32
|
general(vorpal);
|
|
23
33
|
project(vorpal);
|
|
24
34
|
mongodb(vorpal);
|
|
@@ -34,7 +34,7 @@ export const getAllNamespacesNames = async () => {
|
|
|
34
34
|
const namespaces = await getAllNamespaces();
|
|
35
35
|
return namespaces.map((n) => n.metadata.name);
|
|
36
36
|
};
|
|
37
|
-
export default (vorpal: Vorpal) => {
|
|
37
|
+
export default async (vorpal: Vorpal) => {
|
|
38
38
|
vorpal
|
|
39
39
|
.command("connect-cluster <clustername>")
|
|
40
40
|
.autocomplete(getAllClusterNames())
|
|
File without changes
|
|
@@ -6,7 +6,7 @@ import { startPortForward } from "../../../../utils/portForward";
|
|
|
6
6
|
import k8sApi from "../../../../k8sApi";
|
|
7
7
|
import { namespaceAutoCompletion } from "./namespaceAutoCompletion";
|
|
8
8
|
|
|
9
|
-
export default (vorpal: Vorpal) =>
|
|
9
|
+
export default async (vorpal: Vorpal) =>
|
|
10
10
|
vorpal
|
|
11
11
|
.command("port-forward <namespace>", "start port-forwarding")
|
|
12
12
|
.autocomplete(namespaceAutoCompletion)
|
|
@@ -3,7 +3,7 @@ import projectMongoDestroyMember from "./projectMongoDestroyMember";
|
|
|
3
3
|
import projectMongoGetShell from "./projectMongoGetShell";
|
|
4
4
|
import projectMongoPortForward from "./projectMongoPortForward";
|
|
5
5
|
|
|
6
|
-
export default (vorpal: Vorpal) => {
|
|
6
|
+
export default async (vorpal: Vorpal) => {
|
|
7
7
|
projectMongoGetShell(vorpal);
|
|
8
8
|
projectMongoPortForward(vorpal);
|
|
9
9
|
projectMongoDestroyMember(vorpal);
|
|
@@ -3,9 +3,9 @@ import Vorpal from "vorpal";
|
|
|
3
3
|
import { logError } from "../../../../utils/log";
|
|
4
4
|
import {
|
|
5
5
|
getProjectNamespace,
|
|
6
|
-
getProjectPvcs
|
|
6
|
+
getProjectPvcs,
|
|
7
7
|
} from "../../../../utils/projects";
|
|
8
|
-
import {
|
|
8
|
+
import { envAndComponents } from "../project/utils/autocompletions";
|
|
9
9
|
import ensureCluster from "../project/utils/ensureCluster";
|
|
10
10
|
import { getMongoDbPodsWithReplInfo } from "./utils";
|
|
11
11
|
|
|
@@ -31,18 +31,18 @@ const removeFinalizerAndDelete = async (
|
|
|
31
31
|
) => {
|
|
32
32
|
return Promise.all([
|
|
33
33
|
removeFinalizer(namespace, type, name),
|
|
34
|
-
await deleteResource(namespace, type, name)
|
|
34
|
+
await deleteResource(namespace, type, name),
|
|
35
35
|
]);
|
|
36
36
|
};
|
|
37
|
-
export default (vorpal: Vorpal) =>
|
|
37
|
+
export default async (vorpal: Vorpal) =>
|
|
38
38
|
vorpal
|
|
39
39
|
.command(
|
|
40
|
-
"project-mongo-destroy-member <
|
|
40
|
+
"project-mongo-destroy-member <envComponent>",
|
|
41
41
|
"DESTROY a member of a replicaset in order to reinitialize it"
|
|
42
42
|
)
|
|
43
|
-
.autocomplete(
|
|
44
|
-
.action(async function({
|
|
45
|
-
await ensureCluster.call(this);
|
|
43
|
+
.autocomplete(await envAndComponents())
|
|
44
|
+
.action(async function ({ envComponent }) {
|
|
45
|
+
await ensureCluster.call(this, envComponent);
|
|
46
46
|
this.log(
|
|
47
47
|
"this command tries to delete a (secondary) member of the replicaset, it's persistent volume claim (pvc) and the volume"
|
|
48
48
|
);
|
|
@@ -67,18 +67,18 @@ export default (vorpal: Vorpal) =>
|
|
|
67
67
|
default: true,
|
|
68
68
|
message: "DO YOU UNDERSTAND?",
|
|
69
69
|
name: "understood",
|
|
70
|
-
type: "confirm"
|
|
70
|
+
type: "confirm",
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
if (!understood) {
|
|
74
74
|
throw new Error("abort");
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
const namespace = await getProjectNamespace(
|
|
78
|
-
const mongodbPods = await getMongoDbPodsWithReplInfo(
|
|
77
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
78
|
+
const mongodbPods = await getMongoDbPodsWithReplInfo(envComponent);
|
|
79
79
|
|
|
80
|
-
const pvcs = await getProjectPvcs(
|
|
81
|
-
const secondaries = mongodbPods.filter(pod => !pod.isMaster);
|
|
80
|
+
const pvcs = await getProjectPvcs(envComponent);
|
|
81
|
+
const secondaries = mongodbPods.filter((pod) => !pod.isMaster);
|
|
82
82
|
|
|
83
83
|
if (secondaries.length === 0) {
|
|
84
84
|
logError(this, "sorry, no pods found");
|
|
@@ -89,16 +89,16 @@ export default (vorpal: Vorpal) =>
|
|
|
89
89
|
await this.prompt({
|
|
90
90
|
type: "list",
|
|
91
91
|
name: "podName",
|
|
92
|
-
choices: secondaries.map(p => ({
|
|
92
|
+
choices: secondaries.map((p) => ({
|
|
93
93
|
name: `[ secondary ] ${p.podName}`,
|
|
94
|
-
value: p.podName
|
|
94
|
+
value: p.podName,
|
|
95
95
|
})),
|
|
96
|
-
message: "Which pod? 🤔"
|
|
96
|
+
message: "Which pod? 🤔",
|
|
97
97
|
})
|
|
98
98
|
).podName;
|
|
99
99
|
|
|
100
100
|
const thePvc = pvcs.find(
|
|
101
|
-
pvc => pvc.metadata.name === `datadir-${podName}`
|
|
101
|
+
(pvc) => pvc.metadata.name === `datadir-${podName}`
|
|
102
102
|
);
|
|
103
103
|
if (!thePvc) {
|
|
104
104
|
logError(this, `sorry, no pvc found for ${podName}`);
|
|
@@ -109,7 +109,7 @@ export default (vorpal: Vorpal) =>
|
|
|
109
109
|
message:
|
|
110
110
|
"THIS WILL DESTROY THE POD, ITS VOLUME AND ALL ITS DATA 🙀🙀🙀!!! continue? 🤔",
|
|
111
111
|
name: "shouldContinue",
|
|
112
|
-
type: "confirm"
|
|
112
|
+
type: "confirm",
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
if (!shouldContinue) {
|