@catladder/cli 0.0.1-bla → 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
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import Vorpal from "vorpal";
|
|
2
2
|
import { logError } from "../../../../utils/log";
|
|
3
3
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
4
|
-
import {
|
|
4
|
+
import { envAndComponents } from "../project/utils/autocompletions";
|
|
5
5
|
import ensureCluster from "../project/utils/ensureCluster";
|
|
6
6
|
import {
|
|
7
7
|
getMongodbShell,
|
|
8
|
-
getProjectMongodbAllPodsSortedWithLabel
|
|
8
|
+
getProjectMongodbAllPodsSortedWithLabel,
|
|
9
9
|
} from "./utils";
|
|
10
10
|
|
|
11
|
-
export default (vorpal: Vorpal) =>
|
|
11
|
+
export default async (vorpal: Vorpal) =>
|
|
12
12
|
vorpal
|
|
13
13
|
.command(
|
|
14
|
-
"project-mongo-get-shell <
|
|
14
|
+
"project-mongo-get-shell <envComponent>",
|
|
15
15
|
"get a shell to a mongodb in the environment"
|
|
16
16
|
)
|
|
17
|
-
.autocomplete(
|
|
18
|
-
.action(async function({
|
|
19
|
-
await ensureCluster.call(this);
|
|
20
|
-
const namespace = await getProjectNamespace(
|
|
21
|
-
const podNames = await getProjectMongodbAllPodsSortedWithLabel(
|
|
17
|
+
.autocomplete(await envAndComponents())
|
|
18
|
+
.action(async function ({ envComponent }) {
|
|
19
|
+
await ensureCluster.call(this, envComponent);
|
|
20
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
21
|
+
const podNames = await getProjectMongodbAllPodsSortedWithLabel(
|
|
22
|
+
envComponent
|
|
23
|
+
);
|
|
22
24
|
if (podNames.length === 0) {
|
|
23
25
|
logError(this, "sorry, no pods found");
|
|
24
26
|
return;
|
|
@@ -32,7 +34,7 @@ export default (vorpal: Vorpal) =>
|
|
|
32
34
|
type: "list",
|
|
33
35
|
name: "podName",
|
|
34
36
|
choices: podNames,
|
|
35
|
-
message: "Which pod? 🤔"
|
|
37
|
+
message: "Which pod? 🤔",
|
|
36
38
|
})
|
|
37
39
|
).podName;
|
|
38
40
|
}
|
|
@@ -2,18 +2,23 @@ import Vorpal from "vorpal";
|
|
|
2
2
|
import { logError } from "../../../../utils/log";
|
|
3
3
|
import { startPortForward } from "../../../../utils/portForward";
|
|
4
4
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
5
|
-
import {
|
|
5
|
+
import { envAndComponents } from "../project/utils/autocompletions";
|
|
6
6
|
import ensureCluster from "../project/utils/ensureCluster";
|
|
7
7
|
import { getProjectMongodbAllPodsSortedWithLabel } from "./utils";
|
|
8
8
|
|
|
9
|
-
export default (vorpal: Vorpal) =>
|
|
9
|
+
export default async (vorpal: Vorpal) =>
|
|
10
10
|
vorpal
|
|
11
|
-
.command(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
.command(
|
|
12
|
+
"project-mongo-port-forward <envComponent>",
|
|
13
|
+
"port foward to a mongodb"
|
|
14
|
+
)
|
|
15
|
+
.autocomplete(await envAndComponents())
|
|
16
|
+
.action(async function ({ envComponent }) {
|
|
17
|
+
await ensureCluster.call(this, envComponent);
|
|
18
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
19
|
+
const podNames = await getProjectMongodbAllPodsSortedWithLabel(
|
|
20
|
+
envComponent
|
|
21
|
+
);
|
|
17
22
|
if (podNames.length === 0) {
|
|
18
23
|
logError(this, "sorry, no pods found");
|
|
19
24
|
return;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { exec, spawn } from "child-process-promise";
|
|
2
|
-
import { Env } from "../../../../../types/types";
|
|
3
2
|
import {
|
|
4
3
|
getProjectNamespace,
|
|
5
4
|
getProjectPodNames,
|
|
@@ -8,8 +7,8 @@ import {
|
|
|
8
7
|
const filterMongoDbs = (podNames: string[]) =>
|
|
9
8
|
podNames.filter((name) => name.includes("mongodb-replicaset"));
|
|
10
9
|
|
|
11
|
-
export const getProjectMongodbAllPods = async (
|
|
12
|
-
filterMongoDbs(await getProjectPodNames(
|
|
10
|
+
export const getProjectMongodbAllPods = async (envComponent: string) =>
|
|
11
|
+
filterMongoDbs(await getProjectPodNames(envComponent));
|
|
13
12
|
|
|
14
13
|
export const getMongodbShell = async (namespace: string, podName: string) => {
|
|
15
14
|
const command = `kubectl exec -it ${podName} --namespace ${namespace} mongo`;
|
|
@@ -55,12 +54,12 @@ export const podIsMaster = async (namespace: string, podName: string) => {
|
|
|
55
54
|
|
|
56
55
|
const spaces = (n: number) => " ".repeat(n);
|
|
57
56
|
|
|
58
|
-
export const getMongoDbPodsWithReplInfo = async (
|
|
59
|
-
const namespace = await getProjectNamespace(
|
|
57
|
+
export const getMongoDbPodsWithReplInfo = async (envComponent: string) => {
|
|
58
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
60
59
|
return (
|
|
61
60
|
await Promise.all(
|
|
62
61
|
(
|
|
63
|
-
await getProjectMongodbAllPods(
|
|
62
|
+
await getProjectMongodbAllPods(envComponent)
|
|
64
63
|
).map(async (podName) => ({
|
|
65
64
|
podName,
|
|
66
65
|
componentName: podName.replace(/-mongodb-replicaset-[0-9]+/, ""),
|
|
@@ -70,8 +69,10 @@ export const getMongoDbPodsWithReplInfo = async (env: Env) => {
|
|
|
70
69
|
).sort((podA, podB) => (podA.isMaster ? (podB.isMaster ? 0 : -1) : 1));
|
|
71
70
|
};
|
|
72
71
|
|
|
73
|
-
export const getProjectMongodbAllPodsSortedWithLabel = async (
|
|
74
|
-
|
|
72
|
+
export const getProjectMongodbAllPodsSortedWithLabel = async (
|
|
73
|
+
envComponent: string
|
|
74
|
+
) => {
|
|
75
|
+
const pods = await getMongoDbPodsWithReplInfo(envComponent);
|
|
75
76
|
const maxComponentNameLength = Math.max(
|
|
76
77
|
...pods.map((c) => c.componentName.length)
|
|
77
78
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isOfDeployType } from "@catladder/pipeline";
|
|
1
2
|
import { spawn } from "child-process-promise";
|
|
2
3
|
import { writeFile } from "fs-extra";
|
|
3
4
|
import { withFile } from "tmp-promise";
|
|
@@ -6,21 +7,23 @@ import {
|
|
|
6
7
|
GOOGLE_CLOUD_SQL_PASS_PATH,
|
|
7
8
|
GOOGLE_PROJECT,
|
|
8
9
|
} from "../../../../config/constants";
|
|
9
|
-
import { readPass } from "../../../../utils/passwordstore";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import {
|
|
11
|
+
getEnvVars,
|
|
12
|
+
getPipelineContextByChoice,
|
|
13
|
+
getProjectConfig,
|
|
14
|
+
parseChoice,
|
|
15
|
+
} from "../../../../config/getProjectConfig";
|
|
16
|
+
import { readPass } from "../../../../utils/passwordstore";
|
|
17
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
17
18
|
|
|
18
|
-
export default (vorpal: Vorpal) =>
|
|
19
|
+
export default async (vorpal: Vorpal) =>
|
|
19
20
|
vorpal
|
|
20
|
-
.command("project-cloud-sql-proxy <
|
|
21
|
-
.autocomplete(
|
|
22
|
-
.action(async function ({
|
|
23
|
-
const {
|
|
21
|
+
.command("project-cloud-sql-proxy <envComponent>", "proxy to cloud sql db")
|
|
22
|
+
.autocomplete(await envAndComponents())
|
|
23
|
+
.action(async function ({ envComponent }) {
|
|
24
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
25
|
+
|
|
26
|
+
const config = await getProjectConfig();
|
|
24
27
|
// skynet-164509:europe-west6:pvl-cyclomania-review=tcp:5432
|
|
25
28
|
|
|
26
29
|
const { localPort } = await this.prompt({
|
|
@@ -30,18 +33,21 @@ export default (vorpal: Vorpal) =>
|
|
|
30
33
|
message: "Local port: ",
|
|
31
34
|
});
|
|
32
35
|
|
|
33
|
-
const
|
|
34
|
-
const POSTGRESQL_PASSWORD = (await getAllEnvVars(env, subapp))
|
|
36
|
+
const POSTGRESQL_PASSWORD = (await getEnvVars(this, env, componentName))
|
|
35
37
|
?.POSTGRESQL_PASSWORD;
|
|
36
38
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
+
const context = await getPipelineContextByChoice(env, componentName);
|
|
40
|
+
if (!isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
|
|
41
|
+
throw new Error("currently only supported for kubernetes deployment");
|
|
42
|
+
}
|
|
39
43
|
this.log(`postgres-PW: ${POSTGRESQL_PASSWORD}`);
|
|
40
44
|
this.log("");
|
|
41
45
|
|
|
46
|
+
const values = context.componentConfig.deploy.values;
|
|
47
|
+
|
|
42
48
|
const projectId = values?.cloudsql?.projectId || GOOGLE_PROJECT;
|
|
43
49
|
|
|
44
|
-
const defaultInstanceId = `${
|
|
50
|
+
const defaultInstanceId = `${config.customerName}-${config.appName}-${env}`;
|
|
45
51
|
const instanceId = values?.cloudsql?.instanceId || defaultInstanceId;
|
|
46
52
|
|
|
47
53
|
const defaultRegion = "europe-west6"; // currently hardcoded
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/* eslint-disable no-constant-condition */
|
|
2
|
+
import { stripIndents } from "common-tags";
|
|
3
|
+
import { difference } from "lodash";
|
|
4
|
+
import Vorpal, { CommandInstance } from "vorpal";
|
|
5
|
+
import { GOOGLE_CLOUD_SQL_PASS_PATH } from "../../../../config/constants";
|
|
6
|
+
import {
|
|
7
|
+
getEnvironment,
|
|
8
|
+
getEnvVars,
|
|
9
|
+
getPipelineContextByChoice,
|
|
10
|
+
getProjectComponents,
|
|
11
|
+
parseChoice,
|
|
12
|
+
} from "../../../../config/getProjectConfig";
|
|
13
|
+
import { editAsFile } from "../../../../utils/editAsFile";
|
|
14
|
+
import { upsertAllVariables } from "../../../../utils/gitlab";
|
|
15
|
+
import { hasBitwarden, readPass } from "../../../../utils/passwordstore";
|
|
16
|
+
import { delay } from "../../../../utils/promise";
|
|
17
|
+
import { allEnvsAndAllComponents } from "./utils/autocompletions";
|
|
18
|
+
|
|
19
|
+
/* for convenience, parse json objects. that makes it easier to edit secrets that are object */
|
|
20
|
+
const resolveJson = (v: Record<string, Record<string, string>>) =>
|
|
21
|
+
Object.fromEntries(
|
|
22
|
+
Object.entries(v).map(([c, secrets]) => {
|
|
23
|
+
return [
|
|
24
|
+
c,
|
|
25
|
+
Object.fromEntries(
|
|
26
|
+
Object.entries(secrets).map(([key, value]) => {
|
|
27
|
+
try {
|
|
28
|
+
return [key, JSON.parse(value)];
|
|
29
|
+
} catch (e) {
|
|
30
|
+
return [key, value];
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
),
|
|
34
|
+
];
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
const getEnvVarsToEdit = async (env: string, componentName: string) => {
|
|
38
|
+
const { secretEnvVarKeys } = await getEnvironment(env, componentName);
|
|
39
|
+
|
|
40
|
+
const allEnvVars = await getEnvVars(this, env, componentName);
|
|
41
|
+
return Object.fromEntries(
|
|
42
|
+
secretEnvVarKeys.map((key) => [key, allEnvVars[key]])
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
const doItFor = async (
|
|
46
|
+
instance: CommandInstance,
|
|
47
|
+
env: string,
|
|
48
|
+
components: string[]
|
|
49
|
+
) => {
|
|
50
|
+
let valuesToEdit: Record<string, Record<string, string>> = Object.fromEntries(
|
|
51
|
+
await Promise.all(
|
|
52
|
+
components.map(async (componentName) => [
|
|
53
|
+
componentName,
|
|
54
|
+
await getEnvVarsToEdit(env, componentName),
|
|
55
|
+
])
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
let hasErrors = true;
|
|
59
|
+
while (hasErrors) {
|
|
60
|
+
valuesToEdit = await editAsFile(
|
|
61
|
+
resolveJson(valuesToEdit),
|
|
62
|
+
stripIndents`
|
|
63
|
+
Please fill in all secrets for: ${components.join(", ")}
|
|
64
|
+
|
|
65
|
+
`
|
|
66
|
+
);
|
|
67
|
+
// check for errors
|
|
68
|
+
hasErrors = false;
|
|
69
|
+
for (const componentName of components) {
|
|
70
|
+
const usedKeys = valuesToEdit[componentName]
|
|
71
|
+
? Object.keys(valuesToEdit[componentName])
|
|
72
|
+
: [];
|
|
73
|
+
// check whether newValues have the exact number of keys
|
|
74
|
+
const { secretEnvVarKeys } = await getEnvironment(env, componentName);
|
|
75
|
+
const extranous = difference(usedKeys, secretEnvVarKeys);
|
|
76
|
+
const missing = difference(secretEnvVarKeys, usedKeys);
|
|
77
|
+
|
|
78
|
+
if (extranous.length > 0 || missing.length > 0) {
|
|
79
|
+
instance.log("");
|
|
80
|
+
instance.log(
|
|
81
|
+
`😿 Oh no! There is something wrong with "${componentName}"`
|
|
82
|
+
);
|
|
83
|
+
instance.log("");
|
|
84
|
+
if (extranous.length > 0) {
|
|
85
|
+
instance.log("these secrets are not declared in the config");
|
|
86
|
+
extranous.forEach((key) => instance.log(key));
|
|
87
|
+
instance.log("");
|
|
88
|
+
}
|
|
89
|
+
if (missing.length > 0) {
|
|
90
|
+
instance.log("these secrets have not been provided:");
|
|
91
|
+
missing.forEach((key) => instance.log(key));
|
|
92
|
+
instance.log("");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
await delay(1000);
|
|
96
|
+
const { shouldContinue } = await instance.prompt({
|
|
97
|
+
default: true,
|
|
98
|
+
message: "Try again? 🤔",
|
|
99
|
+
name: "shouldContinue",
|
|
100
|
+
type: "confirm",
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (!shouldContinue) {
|
|
104
|
+
throw new Error("abort");
|
|
105
|
+
}
|
|
106
|
+
hasErrors = true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
for (const componentName of components) {
|
|
112
|
+
await upsertAllVariables(
|
|
113
|
+
this,
|
|
114
|
+
valuesToEdit[componentName],
|
|
115
|
+
env,
|
|
116
|
+
componentName
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
if (hasBitwarden()) {
|
|
120
|
+
// add cloud sql secret if needed.
|
|
121
|
+
// TODO: this is legacy, in the future we want to have one service account per app
|
|
122
|
+
|
|
123
|
+
const context = await getPipelineContextByChoice(env, componentName);
|
|
124
|
+
if (
|
|
125
|
+
context.componentConfig.deploy &&
|
|
126
|
+
context.componentConfig.deploy.values?.cloudsql?.enabled
|
|
127
|
+
) {
|
|
128
|
+
await upsertAllVariables(
|
|
129
|
+
this,
|
|
130
|
+
{
|
|
131
|
+
cloudsqlProxyCredentials: await readPass(
|
|
132
|
+
GOOGLE_CLOUD_SQL_PASS_PATH
|
|
133
|
+
),
|
|
134
|
+
},
|
|
135
|
+
env,
|
|
136
|
+
componentName
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export default async (vorpal: Vorpal) => {
|
|
144
|
+
vorpal
|
|
145
|
+
.command(
|
|
146
|
+
"project-config-secrets <envComponent>",
|
|
147
|
+
"setup/update secrets stored in pass"
|
|
148
|
+
)
|
|
149
|
+
.autocomplete(await allEnvsAndAllComponents())
|
|
150
|
+
.action(async function ({ envComponent }) {
|
|
151
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
152
|
+
|
|
153
|
+
// componentName can be null. in this case, iterate over all components
|
|
154
|
+
if (!componentName) {
|
|
155
|
+
const components = await getProjectComponents();
|
|
156
|
+
await doItFor(this, env, components);
|
|
157
|
+
}
|
|
158
|
+
if (componentName) {
|
|
159
|
+
await doItFor(this, env, [componentName]);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/*
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
// adding gcloud sql proxy secret
|
|
166
|
+
const cloudsqlCredentials = await readPass(GOOGLE_CLOUD_SQL_PASS_PATH);
|
|
167
|
+
await createKubernetesSecret.call(
|
|
168
|
+
this,
|
|
169
|
+
namespace,
|
|
170
|
+
"cloudsql-instance-credentials",
|
|
171
|
+
{
|
|
172
|
+
"credentials.json": cloudsqlCredentials,
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
this.log("");
|
|
176
|
+
this.log(
|
|
177
|
+
"⚠️ You need to delete/restart pods in order to make them pick up the new config"
|
|
178
|
+
);
|
|
179
|
+
this.log(`you can use project-delete-pods ${env} to do that`);
|
|
180
|
+
this.log("");
|
|
181
|
+
this.log("");
|
|
182
|
+
await delay(1000);
|
|
183
|
+
}
|
|
184
|
+
this.log("");
|
|
185
|
+
this.log("😻 success!!!!!");
|
|
186
|
+
this.log("");
|
|
187
|
+
*/
|
|
188
|
+
});
|
|
189
|
+
}; /*
|
|
190
|
+
async function createNewEnvInPass(env: any, secretEnvVarsMapping: ISecrets) {
|
|
191
|
+
// const passPath = await getPassPath(env);
|
|
192
|
+
this.log(
|
|
193
|
+
"Your selected env is not yet in pass. Do you want to copy it from another env? "
|
|
194
|
+
);
|
|
195
|
+
const noAnswer = "No, I will create a new one from scratch.";
|
|
196
|
+
const { sourceEnv } = await this.prompt({
|
|
197
|
+
type: "list",
|
|
198
|
+
name: "sourceEnv",
|
|
199
|
+
choices: [...(await envAndComponents()).filter((e) => e !== env), noAnswer],
|
|
200
|
+
message: "Do you want to copy an env?",
|
|
201
|
+
});
|
|
202
|
+
// TODO: reimplenent
|
|
203
|
+
}
|
|
204
|
+
*/
|
|
@@ -4,24 +4,24 @@ import {
|
|
|
4
4
|
GOOGLE_CLOUD_SQL_PASS_PATH,
|
|
5
5
|
GOOGLE_PROJECT,
|
|
6
6
|
} from "../../../../config/constants";
|
|
7
|
-
import { readPass } from "../../../../utils/passwordstore";
|
|
8
7
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
8
|
+
getEnvVars,
|
|
9
|
+
getProjectConfig,
|
|
10
|
+
parseChoice,
|
|
11
|
+
} from "../../../../config/getProjectConfig";
|
|
12
|
+
import { readPass } from "../../../../utils/passwordstore";
|
|
13
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
14
14
|
|
|
15
|
-
export default (vorpal: Vorpal) =>
|
|
15
|
+
export default async (vorpal: Vorpal) =>
|
|
16
16
|
vorpal
|
|
17
|
-
.command(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = await
|
|
17
|
+
.command(
|
|
18
|
+
"copy-db <envComponent>",
|
|
19
|
+
"replace local db with the one from an env"
|
|
20
|
+
)
|
|
21
|
+
.autocomplete(await envAndComponents())
|
|
22
|
+
.action(async function copyDB({ envComponent }) {
|
|
23
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
24
|
+
const { customerName, appName } = await getProjectConfig();
|
|
25
25
|
|
|
26
26
|
const { shouldContinue } = await this.prompt({
|
|
27
27
|
type: "confirm",
|
|
@@ -34,15 +34,16 @@ export default (vorpal: Vorpal) =>
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const subapp = await promptForSubAppIfAny(this);
|
|
38
|
-
|
|
39
37
|
const GOOGLE_CLOUD_SQL_REGION = "europe-west6"; // currently hardcoded
|
|
40
|
-
const POSTGRESQL_PASSWORD =
|
|
41
|
-
|
|
38
|
+
const { POSTGRESQL_PASSWORD } = await getEnvVars(
|
|
39
|
+
this,
|
|
40
|
+
env,
|
|
41
|
+
componentName
|
|
42
|
+
);
|
|
42
43
|
|
|
43
44
|
const LOCAL_PORT = 54321;
|
|
44
45
|
|
|
45
|
-
const instanceName = `${GOOGLE_PROJECT}:${GOOGLE_CLOUD_SQL_REGION}:${
|
|
46
|
+
const instanceName = `${GOOGLE_PROJECT}:${GOOGLE_CLOUD_SQL_REGION}:${customerName}-${appName}-${env}=tcp:${LOCAL_PORT}`;
|
|
46
47
|
const cloudsqlCredentials = await readPass(GOOGLE_CLOUD_SQL_PASS_PATH);
|
|
47
48
|
|
|
48
49
|
const { POSTGRESQL_URL } = process.env;
|
|
@@ -72,9 +73,7 @@ export default (vorpal: Vorpal) =>
|
|
|
72
73
|
dumptmp=$(mktemp /tmp/dump.XXXXXX)
|
|
73
74
|
|
|
74
75
|
echo "Dumping file to $dumptmp"
|
|
75
|
-
pg_dump --dbname=postgres://postgres:${POSTGRESQL_PASSWORD}@localhost:${LOCAL_PORT}/${
|
|
76
|
-
subapp ?? COMPONENT_NAME
|
|
77
|
-
} --no-owner --no-privileges > $dumptmp
|
|
76
|
+
pg_dump --dbname=postgres://postgres:${POSTGRESQL_PASSWORD}@localhost:${LOCAL_PORT}/${componentName} --no-owner --no-privileges > $dumptmp
|
|
78
77
|
psql -q -c "drop database ${localDBName}" 1> /dev/null
|
|
79
78
|
psql -q -c "create database ${localDBName}" 1> /dev/null
|
|
80
79
|
echo "Restoring dump..."
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { V1DeleteOptions } from "@kubernetes/client-node";
|
|
2
1
|
import Vorpal from "vorpal";
|
|
3
2
|
import k8sApi from "../../../../k8sApi";
|
|
4
3
|
|
|
@@ -7,17 +6,17 @@ import {
|
|
|
7
6
|
getProjectNamespace,
|
|
8
7
|
getProjectPodNames,
|
|
9
8
|
} from "../../../../utils/projects";
|
|
10
|
-
import {
|
|
9
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
11
10
|
import ensureCluster from "./utils/ensureCluster";
|
|
12
11
|
|
|
13
|
-
export default (vorpal: Vorpal) =>
|
|
12
|
+
export default async (vorpal: Vorpal) =>
|
|
14
13
|
vorpal
|
|
15
|
-
.command("project-delete-pods <
|
|
16
|
-
.autocomplete(
|
|
17
|
-
.action(async function ({
|
|
18
|
-
await ensureCluster.call(this);
|
|
19
|
-
const namespace = await getProjectNamespace(
|
|
20
|
-
const podNames = await getProjectPodNames(
|
|
14
|
+
.command("project-delete-pods <envComponent>", "delete / restart pods")
|
|
15
|
+
.autocomplete(await envAndComponents())
|
|
16
|
+
.action(async function ({ envComponent }) {
|
|
17
|
+
await ensureCluster.call(this, envComponent);
|
|
18
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
19
|
+
const podNames = await getProjectPodNames(envComponent);
|
|
21
20
|
if (podNames.length === 0) {
|
|
22
21
|
logError(this, "sorry, no pods found");
|
|
23
22
|
return;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import Vorpal from "vorpal";
|
|
2
|
-
import { exec
|
|
3
|
-
import { Env } from "../../../../types/types";
|
|
2
|
+
import { exec } from "child-process-promise";
|
|
4
3
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
5
|
-
import {
|
|
4
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
6
5
|
|
|
7
|
-
export default (vorpal: Vorpal) =>
|
|
6
|
+
export default async (vorpal: Vorpal) =>
|
|
8
7
|
vorpal
|
|
9
8
|
.command(
|
|
10
|
-
"project-delete <
|
|
9
|
+
"project-delete <envComponent>",
|
|
11
10
|
"deletes a environment of a project (it deletes the namespace)"
|
|
12
11
|
)
|
|
13
|
-
.autocomplete(
|
|
14
|
-
.action(async function ({
|
|
15
|
-
const namespace = await getProjectNamespace(
|
|
12
|
+
.autocomplete(await envAndComponents())
|
|
13
|
+
.action(async function ({ envComponent }) {
|
|
14
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
16
15
|
const { shouldContinue } = await this.prompt({
|
|
17
16
|
type: "confirm",
|
|
18
17
|
name: "shouldContinue",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Vorpal from "vorpal";
|
|
2
|
+
import { getEnvVars, parseChoice } from "../../../../config/getProjectConfig";
|
|
3
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
4
|
+
|
|
5
|
+
export default async (vorpal: Vorpal) =>
|
|
6
|
+
vorpal
|
|
7
|
+
.command("project-env-vars <envComponent>", "list env vars")
|
|
8
|
+
.autocomplete(await envAndComponents())
|
|
9
|
+
.action(async function ({ envComponent }) {
|
|
10
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
11
|
+
const envvars = await getEnvVars(this, env, componentName);
|
|
12
|
+
Object.keys(envvars).forEach((key) =>
|
|
13
|
+
this.log(`${key}: ${envvars[key]}`)
|
|
14
|
+
);
|
|
15
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from "child-process-promise";
|
|
2
2
|
import Vorpal from "vorpal";
|
|
3
3
|
|
|
4
|
-
export default (vorpal: Vorpal) =>
|
|
4
|
+
export default async (vorpal: Vorpal) =>
|
|
5
5
|
vorpal
|
|
6
6
|
.command(
|
|
7
7
|
"project-get-my-total-worktime",
|
|
@@ -9,6 +9,6 @@ export default (vorpal: Vorpal) =>
|
|
|
9
9
|
)
|
|
10
10
|
.action(async () => {
|
|
11
11
|
await spawn("sh", ["-c", "curl -L http://bit.ly/10hA8iC | bash"], {
|
|
12
|
-
stdio: ["pipe", "inherit", "pipe"]
|
|
12
|
+
stdio: ["pipe", "inherit", "pipe"],
|
|
13
13
|
});
|
|
14
14
|
});
|
|
@@ -2,24 +2,24 @@ import Vorpal from "vorpal";
|
|
|
2
2
|
import { logError } from "../../../../utils/log";
|
|
3
3
|
import {
|
|
4
4
|
getProjectNamespace,
|
|
5
|
-
getProjectPodNames
|
|
5
|
+
getProjectPodNames,
|
|
6
6
|
} from "../../../../utils/projects";
|
|
7
7
|
import { getShell } from "../../../../utils/shell";
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
10
10
|
import ensureCluster from "./utils/ensureCluster";
|
|
11
11
|
|
|
12
|
-
export default (vorpal: Vorpal) =>
|
|
12
|
+
export default async (vorpal: Vorpal) =>
|
|
13
13
|
vorpal
|
|
14
14
|
.command(
|
|
15
|
-
"project-get-shell <
|
|
15
|
+
"project-get-shell <envComponent>",
|
|
16
16
|
"get a shell to a pod in the environment"
|
|
17
17
|
)
|
|
18
|
-
.autocomplete(
|
|
19
|
-
.action(async function({
|
|
20
|
-
await ensureCluster.call(this);
|
|
21
|
-
const namespace = await getProjectNamespace(
|
|
22
|
-
const podNames = await getProjectPodNames(
|
|
18
|
+
.autocomplete(await envAndComponents())
|
|
19
|
+
.action(async function ({ envComponent }) {
|
|
20
|
+
await ensureCluster.call(this, envComponent);
|
|
21
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
22
|
+
const podNames = await getProjectPodNames(envComponent);
|
|
23
23
|
if (podNames.length === 0) {
|
|
24
24
|
logError(this, "sorry, no pods found");
|
|
25
25
|
return;
|
|
@@ -28,7 +28,7 @@ export default (vorpal: Vorpal) =>
|
|
|
28
28
|
type: "list",
|
|
29
29
|
name: "podName",
|
|
30
30
|
choices: podNames,
|
|
31
|
-
message: "Which pod? 🤔"
|
|
31
|
+
message: "Which pod? 🤔",
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
return getShell(namespace, podName);
|
|
@@ -64,7 +64,7 @@ const promptJob = async (vorpal: CommandInstance, projectId: any, ctx: any) => {
|
|
|
64
64
|
return jobs.find((j: any) => j.id === jobId);
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export default (vorpal: Vorpal) => {
|
|
67
|
+
export default async (vorpal: Vorpal) => {
|
|
68
68
|
vorpal.command("project-ci-job-open", "Open a Job").action(async function () {
|
|
69
69
|
const { id: projectId } = await getProjectInfo(this);
|
|
70
70
|
|