@catladder/cli 0.0.0-test7 → 0.0.0-waitfor-deploy-e64a33ba
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/README.md +6 -3
- package/bin/catenv +3 -0
- package/bin/catladder +1 -1
- package/dist/apps/catenv/catenv.d.ts +5 -0
- package/dist/apps/catenv/catenv.js +143 -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 +216 -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 +97 -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 +137 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +4 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js +320 -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 +120 -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/commandInitProject.old.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandInitProject.old.js +345 -0
- package/dist/apps/cli/commands/project/commandInitProject.old.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 +85 -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 +61 -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/commandSetup.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandSetup.js +58 -0
- package/dist/apps/cli/commands/project/commandSetup.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 +94 -0
- package/dist/apps/cli/commands/project/index.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/index.d.ts +2 -0
- package/dist/apps/cli/commands/project/setup/index.js +103 -0
- package/dist/apps/cli/commands/project/setup/index.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +2 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +115 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupContext.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupContext.js +74 -0
- package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js +132 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.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 +2 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js +104 -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 +3 -0
- package/dist/apps/cli/commands/shared/index.js +70 -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 +101 -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 +106 -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 +94 -0
- package/dist/apps/cli/verify/index.js.map +1 -0
- package/dist/apps/cli/verify/migration/fromv2.d.ts +4 -0
- package/dist/apps/cli/verify/migration/fromv2.js +347 -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 +18 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.js +30 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
- package/dist/catenv.d.ts +1 -0
- package/dist/catenv.js +15 -0
- package/dist/catenv.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +15 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/constants.d.ts +3 -0
- package/dist/config/constants.js +7 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/getProjectConfig.d.ts +24 -0
- package/dist/config/getProjectConfig.js +259 -0
- package/dist/config/getProjectConfig.js.map +1 -0
- package/dist/k8sApi/index.d.ts +8 -0
- package/dist/k8sApi/index.js +29 -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 +3 -0
- package/dist/utils/cluster.js +73 -0
- package/dist/utils/cluster.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/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 +22 -0
- package/dist/utils/gitlab.js +278 -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 +153 -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 +16 -21
- package/src/apps/catenv/catenv.ts +55 -27
- package/src/apps/{shell/shell.ts → cli/cli.ts} +10 -2
- package/src/apps/{shell → cli}/commands/general/index.ts +7 -46
- package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
- package/src/apps/{shell → cli}/commands/general/portForward.ts +3 -2
- 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/cli/commands/project/commandCloudSqlProxy.ts +88 -0
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +220 -0
- package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +24 -26
- package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +10 -10
- 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/{shell/commands/project/commandInitProject.ts → cli/commands/project/commandInitProject.old.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 +48 -0
- package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
- package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +3 -3
- 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/cli/commands/project/commandOpenLogs.ts +52 -0
- 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/commandSetup.ts +12 -0
- package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +10 -10
- package/src/apps/{shell → cli}/commands/project/index.ts +6 -7
- package/src/apps/cli/commands/project/setup/index.ts +42 -0
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +72 -0
- package/src/apps/cli/commands/project/setup/setupContext.ts +37 -0
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +112 -0
- package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
- package/src/apps/cli/commands/project/utils/ensureCluster.ts +42 -0
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +56 -0
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
- package/src/apps/cli/commands/shared/index.ts +36 -0
- package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +7 -26
- package/src/apps/cli/config/writeConfig.ts +71 -0
- package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
- package/src/apps/cli/verify/index.ts +30 -0
- package/src/apps/cli/verify/migration/fromv2.ts +264 -0
- package/src/apps/cli/verify/migration/migrateSecrets.ts +37 -0
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
- package/src/catenv.ts +11 -0
- package/src/cli.ts +9 -0
- package/src/config/constants.ts +0 -1
- package/src/config/getProjectConfig.ts +160 -0
- package/src/k8sApi/index.ts +22 -6
- package/src/types/types.ts +0 -2
- package/src/utils/cluster.ts +6 -15
- package/src/utils/editAsFile.ts +31 -0
- package/src/utils/files.ts +6 -2
- package/src/utils/gitlab.ts +144 -34
- package/src/utils/passwordstore/index.ts +19 -21
- package/src/utils/preferences/index.ts +6 -3
- package/src/utils/projects/index.ts +18 -137
- package/tsconfig.json +3 -7
- package/bin/catenv.sh +0 -1
- package/src/apps/shell/commands/project/commandCloudSqlProxy.ts +0 -65
- 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/commandOpenLogs.ts +0 -23
- 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/ensureNamespace.ts +0 -32
- package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
- package/src/apps/shell/commands/shared/index.ts +0 -31
- package/src/config/clusters.ts +0 -45
- package/src/index.ts +0 -17
- package/src/types/git-repo-name.d.ts +0 -1
- package/src/types/yawn-yaml.d.ts +0 -1
- package/src/utils/dashboardToken.ts +0 -20
- package/src/utils/formatEnvVars.ts +0 -7
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import { spawn } from "child-process-promise";
|
|
2
2
|
import Vorpal from "vorpal";
|
|
3
|
+
import { GOOGLE_CLOUD_SQL_PASS_PATH } from "../../../../config/constants";
|
|
3
4
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
getEnvVars,
|
|
6
|
+
getProjectConfig,
|
|
7
|
+
parseChoice,
|
|
8
|
+
} from "../../../../config/getProjectConfig";
|
|
7
9
|
import { readPass } from "../../../../utils/passwordstore";
|
|
8
|
-
import {
|
|
9
|
-
getAllEnvVars,
|
|
10
|
-
getLocalProjectVariables,
|
|
11
|
-
} from "../../../../utils/projects";
|
|
12
|
-
import { envAutocompletion } from "./utils/autocompletions";
|
|
13
|
-
import { promptForSubAppIfAny } from "./utils/monorepo";
|
|
10
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
14
11
|
|
|
15
|
-
export default (vorpal: Vorpal) =>
|
|
12
|
+
export default async (vorpal: Vorpal) =>
|
|
16
13
|
vorpal
|
|
17
|
-
.command(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = await
|
|
14
|
+
.command(
|
|
15
|
+
"copy-db <envComponent>",
|
|
16
|
+
"replace local db with the one from an env"
|
|
17
|
+
)
|
|
18
|
+
.autocomplete(await envAndComponents())
|
|
19
|
+
.action(async function copyDB({ envComponent }) {
|
|
20
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
21
|
+
const { customerName, appName } = await getProjectConfig();
|
|
25
22
|
|
|
26
23
|
const { shouldContinue } = await this.prompt({
|
|
27
24
|
type: "confirm",
|
|
@@ -34,15 +31,18 @@ export default (vorpal: Vorpal) =>
|
|
|
34
31
|
return;
|
|
35
32
|
}
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
// TODO: reimpleent with new config
|
|
35
|
+
throw new Error("needs reimplementation with new config");
|
|
39
36
|
const GOOGLE_CLOUD_SQL_REGION = "europe-west6"; // currently hardcoded
|
|
40
|
-
const POSTGRESQL_PASSWORD =
|
|
41
|
-
|
|
37
|
+
const { POSTGRESQL_PASSWORD } = await getEnvVars(
|
|
38
|
+
this,
|
|
39
|
+
env,
|
|
40
|
+
componentName
|
|
41
|
+
);
|
|
42
42
|
|
|
43
43
|
const LOCAL_PORT = 54321;
|
|
44
44
|
|
|
45
|
-
const instanceName = `${
|
|
45
|
+
const instanceName = `${"xxxxxx reimplement shoulld be project id"}:${GOOGLE_CLOUD_SQL_REGION}:${customerName}-${appName}-${env}=tcp:${LOCAL_PORT}`;
|
|
46
46
|
const cloudsqlCredentials = await readPass(GOOGLE_CLOUD_SQL_PASS_PATH);
|
|
47
47
|
|
|
48
48
|
const { POSTGRESQL_URL } = process.env;
|
|
@@ -72,9 +72,7 @@ export default (vorpal: Vorpal) =>
|
|
|
72
72
|
dumptmp=$(mktemp /tmp/dump.XXXXXX)
|
|
73
73
|
|
|
74
74
|
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
|
|
75
|
+
pg_dump --dbname=postgres://postgres:${POSTGRESQL_PASSWORD}@localhost:${LOCAL_PORT}/${componentName} --no-owner --no-privileges > $dumptmp
|
|
78
76
|
psql -q -c "drop database ${localDBName}" 1> /dev/null
|
|
79
77
|
psql -q -c "create database ${localDBName}" 1> /dev/null
|
|
80
78
|
echo "Restoring dump..."
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { V1DeleteOptions } from "@kubernetes/client-node";
|
|
2
1
|
import Vorpal from "vorpal";
|
|
3
|
-
import
|
|
2
|
+
import { getk8sApi } from "../../../../k8sApi";
|
|
4
3
|
|
|
5
4
|
import { logError } from "../../../../utils/log";
|
|
6
5
|
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;
|
|
@@ -41,6 +40,7 @@ export default (vorpal: Vorpal) =>
|
|
|
41
40
|
message: "Continue ? 🤔 ",
|
|
42
41
|
});
|
|
43
42
|
this.log("");
|
|
43
|
+
const k8sApi = getk8sApi();
|
|
44
44
|
if (shouldContinue) {
|
|
45
45
|
for (const podName of selectedPodNames) {
|
|
46
46
|
await k8sApi.deleteNamespacedPod(podName, namespace, "true");
|
|
@@ -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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile, writeFile } from "fs-extra";
|
|
2
|
-
import {
|
|
2
|
+
import { dump } from "js-yaml";
|
|
3
3
|
import { mapKeys, snakeCase, toUpper } from "lodash";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import Vorpal from "vorpal";
|
|
@@ -29,7 +29,7 @@ const DEFAULT_VARIABLES = {
|
|
|
29
29
|
clusterName: "production",
|
|
30
30
|
};
|
|
31
31
|
// TODO: we should find a way how to fetch the variables of the inclues directly from gitlab
|
|
32
|
-
const
|
|
32
|
+
const DEFAULT_NODE_asdfAPPLICATION = {};
|
|
33
33
|
|
|
34
34
|
const DEFAULT_FILES_TO_CREATE: FileToCreate[] = [
|
|
35
35
|
{
|
|
@@ -38,6 +38,9 @@ const DEFAULT_FILES_TO_CREATE: FileToCreate[] = [
|
|
|
38
38
|
readFile(path.resolve(__dirname, "../includes/envrc"), "utf8"),
|
|
39
39
|
},
|
|
40
40
|
];
|
|
41
|
+
/*
|
|
42
|
+
|
|
43
|
+
TODO: reimplement as PRESETS ?
|
|
41
44
|
const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
|
|
42
45
|
nextJS: {
|
|
43
46
|
variables: {},
|
|
@@ -154,7 +157,7 @@ const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
|
|
|
154
157
|
{
|
|
155
158
|
filename: "values-review.yml",
|
|
156
159
|
content: async () =>
|
|
157
|
-
|
|
160
|
+
dump({
|
|
158
161
|
jobs: {
|
|
159
162
|
"db-prepare-seed": {
|
|
160
163
|
hook: "post-install",
|
|
@@ -180,10 +183,15 @@ const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
|
|
|
180
183
|
values: {},
|
|
181
184
|
},
|
|
182
185
|
};
|
|
183
|
-
|
|
186
|
+
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
const PLATFORMS: any = {};
|
|
190
|
+
export default async (vorpal: Vorpal) =>
|
|
184
191
|
vorpal
|
|
185
192
|
.command("project-init", "Inits a new project")
|
|
186
193
|
.action(async function () {
|
|
194
|
+
throw new Error("needs reimplementation");
|
|
187
195
|
const hasGitlabFile = await hasGitlabCiFile();
|
|
188
196
|
if (hasGitlabFile) {
|
|
189
197
|
this.log("there is already a gitlab-ci.yml file. Skipping");
|
|
@@ -251,7 +259,7 @@ export default (vorpal: Vorpal) =>
|
|
|
251
259
|
variables: transformedVariables,
|
|
252
260
|
};
|
|
253
261
|
|
|
254
|
-
const gitlabCiContent =
|
|
262
|
+
const gitlabCiContent = dump(gitlabCiContentObj);
|
|
255
263
|
await writeFile(".gitlab-ci.yml", gitlabCiContent);
|
|
256
264
|
|
|
257
265
|
allFilesToCreate.forEach(async ({ filename, content }) => {
|
|
@@ -260,7 +268,7 @@ export default (vorpal: Vorpal) =>
|
|
|
260
268
|
await writeFile(filename, theContent);
|
|
261
269
|
});
|
|
262
270
|
|
|
263
|
-
await writeFile("values.yml",
|
|
271
|
+
await writeFile("values.yml", dump(values));
|
|
264
272
|
|
|
265
273
|
this.log("");
|
|
266
274
|
this.log("gitlab-ci created! 💪😻");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { dump } from "js-yaml";
|
|
2
|
+
import { pick } from "lodash";
|
|
3
|
+
import Vorpal from "vorpal";
|
|
4
|
+
import { getProjectPods } from "../../../../utils/projects";
|
|
5
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
6
|
+
import ensureCluster from "./utils/ensureCluster";
|
|
7
|
+
|
|
8
|
+
export default async (vorpal: Vorpal) =>
|
|
9
|
+
vorpal
|
|
10
|
+
.command("project-list-pods <envComponent>", "list pods of local project")
|
|
11
|
+
.autocomplete(await envAndComponents())
|
|
12
|
+
.action(async function ({ envComponent }) {
|
|
13
|
+
await ensureCluster.call(this, envComponent);
|
|
14
|
+
const pods = await getProjectPods(envComponent);
|
|
15
|
+
this.log(
|
|
16
|
+
dump(pods.map((p) => pick(p, ["metadata.name", "status.startTime"])))
|
|
17
|
+
);
|
|
18
|
+
});
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { exec } from "child-process-promise";
|
|
2
2
|
import Vorpal from "vorpal";
|
|
3
|
+
import {
|
|
4
|
+
getEnvironment,
|
|
5
|
+
parseChoice,
|
|
6
|
+
} from "../../../../config/getProjectConfig";
|
|
3
7
|
import { logError } from "../../../../utils/log";
|
|
4
|
-
|
|
5
|
-
import {
|
|
8
|
+
|
|
9
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Error: rendered manifests contain a resource that already exists.
|
|
9
13
|
* Unable to continue with install: ConfigMap "web-app-env" in namespace "pvl-bike2school-dev" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "pvl-bike2school-dev-web"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "pvl-bike2school-dev"
|
|
10
14
|
*/
|
|
11
|
-
export default (vorpal: Vorpal) =>
|
|
15
|
+
export default async (vorpal: Vorpal) =>
|
|
12
16
|
vorpal
|
|
13
17
|
.command(
|
|
14
|
-
"project-migrate-helm3 <
|
|
18
|
+
"project-migrate-helm3 <envComponent>",
|
|
15
19
|
"Do manual step for helm2 to helm3 migration"
|
|
16
20
|
)
|
|
17
21
|
.autocomplete(
|
|
18
|
-
|
|
22
|
+
(await envAndComponents()).filter(
|
|
23
|
+
(e) => !e.startsWith("local") && !e.startsWith("review")
|
|
24
|
+
)
|
|
19
25
|
)
|
|
20
|
-
.action(async function ({
|
|
26
|
+
.action(async function ({ envComponent }) {
|
|
21
27
|
try {
|
|
28
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
22
29
|
const result = await exec("helm version --short");
|
|
23
30
|
const version = result.stdout as string;
|
|
24
31
|
this.log(`your helm version: ${version}`);
|
|
@@ -35,7 +42,9 @@ export default (vorpal: Vorpal) =>
|
|
|
35
42
|
} catch (e) {
|
|
36
43
|
// ignore
|
|
37
44
|
}
|
|
38
|
-
|
|
45
|
+
|
|
46
|
+
const releaseName = (await getEnvironment(env, componentName)).envVars
|
|
47
|
+
.RELEASE_NAME; // TODO: maybe its own function would be better
|
|
39
48
|
this.log(`helm release name: ${releaseName}`);
|
|
40
49
|
this.log("");
|
|
41
50
|
this.log("migrating now... 😼. This may take a moment");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Vorpal from "vorpal";
|
|
2
|
+
import { getProjectNamespace } from "../../../../utils/projects";
|
|
3
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
4
|
+
|
|
5
|
+
export default async (vorpal: Vorpal) =>
|
|
6
|
+
vorpal
|
|
7
|
+
.command(
|
|
8
|
+
"project-namespace <envComponent>",
|
|
9
|
+
"show namespace of local project"
|
|
10
|
+
)
|
|
11
|
+
.autocomplete(await envAndComponents())
|
|
12
|
+
.action(async function ({ envComponent }) {
|
|
13
|
+
this.log(await getProjectNamespace(envComponent));
|
|
14
|
+
});
|
|
@@ -9,15 +9,18 @@ import { startPortForward } from "../../../../utils/portForward";
|
|
|
9
9
|
|
|
10
10
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
13
13
|
import ensureCluster from "./utils/ensureCluster";
|
|
14
|
-
export default (vorpal: Vorpal) =>
|
|
14
|
+
export default async (vorpal: Vorpal) =>
|
|
15
15
|
vorpal
|
|
16
|
-
.command(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
.command(
|
|
17
|
+
"project-check-costs <envComponent>",
|
|
18
|
+
"Shows you how much you're spending"
|
|
19
|
+
)
|
|
20
|
+
.autocomplete(await envAndComponents())
|
|
21
|
+
.action(async function ({ envComponent }) {
|
|
22
|
+
await ensureCluster.call(this, envComponent);
|
|
23
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
21
24
|
const url = `http://localhost:${GRAFANA_PROXY_LOCAL_PORT}/namespace.html?name=${namespace}`;
|
|
22
25
|
await startPortForward(
|
|
23
26
|
"deployment/kubecost-cost-analyzer",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Vorpal from "vorpal";
|
|
2
|
+
import {
|
|
3
|
+
getPipelineContextByChoice,
|
|
4
|
+
parseChoice,
|
|
5
|
+
} from "../../../../config/getProjectConfig";
|
|
6
|
+
import { getGoogleAuthUserNumber } from "../../utils/getGoogleAuthUserNumber";
|
|
7
|
+
import { openGoogleCloudKubernetesDashboard } from "../shared";
|
|
8
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
9
|
+
export default async (vorpal: Vorpal) =>
|
|
10
|
+
vorpal
|
|
11
|
+
.command(
|
|
12
|
+
"project-open-dashboard <envComponent>",
|
|
13
|
+
"open kubernetes dashboard on google"
|
|
14
|
+
)
|
|
15
|
+
.autocomplete(await envAndComponents())
|
|
16
|
+
.action(async function ({ envComponent }) {
|
|
17
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
18
|
+
const { componentConfig, environment } = await getPipelineContextByChoice(
|
|
19
|
+
env,
|
|
20
|
+
componentName
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
if (
|
|
24
|
+
!componentConfig.deploy ||
|
|
25
|
+
componentConfig.deploy.type !== "kubernetes"
|
|
26
|
+
) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
"only kubernetes deployments are supported at the moment"
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (
|
|
33
|
+
!componentConfig.deploy.cluster ||
|
|
34
|
+
componentConfig.deploy.cluster.type !== "gcloud"
|
|
35
|
+
) {
|
|
36
|
+
throw new Error("no gcloud custer configured");
|
|
37
|
+
}
|
|
38
|
+
// currently only supports kubernetes
|
|
39
|
+
const namespace = environment.envVars.KUBE_NAMESPACE;
|
|
40
|
+
|
|
41
|
+
const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
|
|
42
|
+
|
|
43
|
+
openGoogleCloudKubernetesDashboard(
|
|
44
|
+
componentConfig.deploy.cluster,
|
|
45
|
+
namespace,
|
|
46
|
+
authGoogleNumber
|
|
47
|
+
);
|
|
48
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import open from "open";
|
|
2
|
+
import Vorpal from "vorpal";
|
|
3
|
+
import {
|
|
4
|
+
getEnvironment,
|
|
5
|
+
parseChoice,
|
|
6
|
+
} from "../../../../config/getProjectConfig";
|
|
7
|
+
|
|
8
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
9
|
+
import ensureCluster from "./utils/ensureCluster";
|
|
10
|
+
|
|
11
|
+
export default async (vorpal: Vorpal) =>
|
|
12
|
+
vorpal
|
|
13
|
+
.command("project-open-env <envComponent>", "open the live environment")
|
|
14
|
+
.autocomplete(await envAndComponents())
|
|
15
|
+
.action(async function ({ envComponent }) {
|
|
16
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
17
|
+
await ensureCluster.call(this, envComponent);
|
|
18
|
+
const environment = await getEnvironment(env, componentName);
|
|
19
|
+
const url = environment.url;
|
|
20
|
+
|
|
21
|
+
open(url);
|
|
22
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { exec } from "child-process-promise";
|
|
2
1
|
import Vorpal from "vorpal";
|
|
2
|
+
import { $ } from "zx";
|
|
3
3
|
|
|
4
|
-
export default (vorpal: Vorpal) =>
|
|
4
|
+
export default async (vorpal: Vorpal) =>
|
|
5
5
|
vorpal
|
|
6
6
|
.command(
|
|
7
7
|
"project-open-git",
|
|
8
8
|
"open the repo on gitlab / github in your browser"
|
|
9
9
|
)
|
|
10
10
|
.action(async () => {
|
|
11
|
-
await
|
|
11
|
+
await $`npx git-open`;
|
|
12
12
|
});
|
|
@@ -8,18 +8,18 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
12
12
|
import ensureCluster from "./utils/ensureCluster";
|
|
13
|
-
export default (vorpal: Vorpal) =>
|
|
13
|
+
export default async (vorpal: Vorpal) =>
|
|
14
14
|
vorpal
|
|
15
15
|
.command(
|
|
16
|
-
"project-open-grafana <
|
|
16
|
+
"project-open-grafana <envComponent>",
|
|
17
17
|
"open Grafana dashboard for your namespace"
|
|
18
18
|
)
|
|
19
|
-
.autocomplete(
|
|
20
|
-
.action(async function ({
|
|
21
|
-
await ensureCluster.call(this);
|
|
22
|
-
const namespace = await getProjectNamespace(
|
|
19
|
+
.autocomplete(await envAndComponents())
|
|
20
|
+
.action(async function ({ envComponent }) {
|
|
21
|
+
await ensureCluster.call(this, envComponent);
|
|
22
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
23
23
|
const url = `http://localhost:${GRAFANA_PROXY_LOCAL_PORT}/grafana/d/at-cost-analysis-namespace2/namespace-utilization-metrics?var-namespace=${namespace}`;
|
|
24
24
|
await startPortForward(
|
|
25
25
|
"deployment/kubecost-cost-analyzer",
|
|
@@ -6,24 +6,23 @@ import {
|
|
|
6
6
|
} from "../../../../config/constants";
|
|
7
7
|
import { logError } from "../../../../utils/log";
|
|
8
8
|
import { startPortForward } from "../../../../utils/portForward";
|
|
9
|
-
|
|
10
9
|
import {
|
|
11
10
|
getProjectNamespace,
|
|
12
11
|
getProjectPodNames,
|
|
13
12
|
} from "../../../../utils/projects";
|
|
14
|
-
|
|
15
|
-
import { envAutocompletion } from "./utils/autocompletions";
|
|
13
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
16
14
|
import ensureCluster from "./utils/ensureCluster";
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
export default async (vorpal: Vorpal) =>
|
|
18
17
|
vorpal
|
|
19
18
|
.command(
|
|
20
|
-
"project-open-grafana-pod <
|
|
19
|
+
"project-open-grafana-pod <envComponent>",
|
|
21
20
|
"open Grafana dashboard for a specific pod"
|
|
22
21
|
)
|
|
23
|
-
.autocomplete(
|
|
24
|
-
.action(async function ({
|
|
25
|
-
await ensureCluster.call(this);
|
|
26
|
-
const podNames = await getProjectPodNames(
|
|
22
|
+
.autocomplete(await envAndComponents())
|
|
23
|
+
.action(async function ({ envComponent }) {
|
|
24
|
+
await ensureCluster.call(this, envComponent);
|
|
25
|
+
const podNames = await getProjectPodNames(envComponent);
|
|
27
26
|
if (podNames.length === 0) {
|
|
28
27
|
logError(this, "sorry, no pods found");
|
|
29
28
|
return;
|
|
@@ -34,7 +33,7 @@ export default (vorpal: Vorpal) =>
|
|
|
34
33
|
choices: podNames,
|
|
35
34
|
message: "Which pod? 🤔",
|
|
36
35
|
});
|
|
37
|
-
const namespace = await getProjectNamespace(
|
|
36
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
38
37
|
const url = `http://localhost:${GRAFANA_PROXY_LOCAL_PORT}/grafana/d/at-cost-analysis-pod/pod-cost-and-utilization-metrics?var-namespace=${namespace}&var-pod=${podName}`;
|
|
39
38
|
await startPortForward(
|
|
40
39
|
"deployment/kubecost-cost-analyzer",
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Vorpal from "vorpal";
|
|
2
|
+
import {
|
|
3
|
+
getPipelineContextByChoice,
|
|
4
|
+
parseChoice,
|
|
5
|
+
} from "../../../../config/getProjectConfig";
|
|
6
|
+
import { getCurrentConnectedClusterName } from "../../../../utils/cluster";
|
|
7
|
+
import { getProjectNamespace } from "../../../../utils/projects";
|
|
8
|
+
import { getGoogleAuthUserNumber } from "../../utils/getGoogleAuthUserNumber";
|
|
9
|
+
import { openGoogleCloudLogs } from "../shared";
|
|
10
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
11
|
+
import ensureCluster from "./utils/ensureCluster";
|
|
12
|
+
|
|
13
|
+
export default async (vorpal: Vorpal) =>
|
|
14
|
+
vorpal
|
|
15
|
+
.command(
|
|
16
|
+
"project-open-logs <envComponent>",
|
|
17
|
+
"open google cloud logs (stackdriver logs)"
|
|
18
|
+
)
|
|
19
|
+
.autocomplete(await envAndComponents())
|
|
20
|
+
.action(async function ({ envComponent }) {
|
|
21
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
22
|
+
const { componentConfig, environment } = await getPipelineContextByChoice(
|
|
23
|
+
env,
|
|
24
|
+
componentName
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
if (
|
|
28
|
+
!componentConfig.deploy ||
|
|
29
|
+
componentConfig.deploy.type !== "kubernetes"
|
|
30
|
+
) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
"only kubernetes deployments are supported at the moment"
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (
|
|
37
|
+
!componentConfig.deploy.cluster ||
|
|
38
|
+
componentConfig.deploy.cluster.type !== "gcloud"
|
|
39
|
+
) {
|
|
40
|
+
throw new Error("no gcloud custer configured");
|
|
41
|
+
}
|
|
42
|
+
// currently only supports kubernetes
|
|
43
|
+
const namespace = environment.envVars.KUBE_NAMESPACE;
|
|
44
|
+
|
|
45
|
+
const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
|
|
46
|
+
|
|
47
|
+
await openGoogleCloudLogs(
|
|
48
|
+
componentConfig.deploy.cluster,
|
|
49
|
+
namespace,
|
|
50
|
+
authGoogleNumber
|
|
51
|
+
);
|
|
52
|
+
});
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import Vorpal from "vorpal";
|
|
2
2
|
import { exec } from "child-process-promise";
|
|
3
|
-
import { Env } from "../../../../types/types";
|
|
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
|
-
.command(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
.command(
|
|
9
|
+
"project-pause <envComponent>",
|
|
10
|
+
"halts all running pods (scales to 0)"
|
|
11
|
+
)
|
|
12
|
+
.autocomplete(await envAndComponents())
|
|
13
|
+
.action(async function ({ envComponent }) {
|
|
14
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
13
15
|
const { shouldContinue } = await this.prompt({
|
|
14
16
|
type: "confirm",
|
|
15
17
|
name: "shouldContinue",
|