@catladder/cli 0.0.0-test3 → 0.0.0-yarnrc-support-bdbef31f
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 +4 -2
- 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 +208 -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 +129 -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 +294 -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 +136 -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 +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/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 +2 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js +106 -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 +345 -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 +10 -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 +232 -0
- package/dist/config/getProjectConfig.js.map +1 -0
- package/dist/k8sApi/index.d.ts +6 -0
- package/dist/k8sApi/index.js +15 -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 +75 -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/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 +262 -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 +154 -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 +48 -27
- package/src/apps/{shell/shell.ts → cli/cli.ts} +10 -2
- package/src/apps/{shell → cli}/commands/general/index.ts +2 -40
- 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 +26 -21
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +205 -0
- package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +24 -26
- 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 +248 -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 +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/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 +42 -0
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +55 -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 +262 -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 +4 -0
- package/src/cli.ts +9 -0
- package/src/config/constants.ts +0 -1
- package/src/config/getProjectConfig.ts +136 -0
- package/src/k8sApi/index.ts +5 -1
- package/src/types/types.ts +0 -2
- package/src/utils/cluster.ts +8 -15
- package/src/utils/editAsFile.ts +31 -0
- package/src/utils/files.ts +6 -2
- package/src/utils/gitlab.ts +133 -34
- package/src/utils/passwordstore/index.ts +19 -21
- package/src/utils/preferences/index.ts +6 -3
- package/src/utils/projects/index.ts +15 -136
- 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/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
|
@@ -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
|
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getFullKubernetesClusterName,
|
|
3
|
+
isOfDeployType,
|
|
4
|
+
getKubernetesNamespace,
|
|
5
|
+
} from "@catladder/pipeline";
|
|
6
|
+
import Vorpal from "vorpal";
|
|
7
|
+
import { $ } from "zx";
|
|
8
|
+
import { getAllPipelineContexts } from "../../../../config/getProjectConfig";
|
|
9
|
+
import { connectToCluster } from "../../../../utils/cluster";
|
|
10
|
+
import { upsertAllVariables } from "../../../../utils/gitlab";
|
|
11
|
+
import ensureNamespace from "./utils/ensureNamespace";
|
|
12
|
+
|
|
13
|
+
export default async (vorpal: Vorpal) =>
|
|
14
|
+
vorpal
|
|
15
|
+
.command(
|
|
16
|
+
"project-init-gitlab",
|
|
17
|
+
"Initializes the gitlab repo, e.g. connects the cluster to it"
|
|
18
|
+
)
|
|
19
|
+
.action(async function () {
|
|
20
|
+
const allContext = await getAllPipelineContexts();
|
|
21
|
+
|
|
22
|
+
for (const context of allContext) {
|
|
23
|
+
const deployConfig = context.componentConfig.deploy;
|
|
24
|
+
if (isOfDeployType(deployConfig, "kubernetes")) {
|
|
25
|
+
const fullName = getFullKubernetesClusterName(deployConfig.cluster);
|
|
26
|
+
this.log(
|
|
27
|
+
`connecting ${context.environment.shortName}:${context.componentName} ${fullName}`
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
await connectToCluster(fullName);
|
|
31
|
+
|
|
32
|
+
const namespace = await ensureNamespace(context);
|
|
33
|
+
|
|
34
|
+
//$.verbose = true;
|
|
35
|
+
|
|
36
|
+
// we name the service account and the role and the role binding with the same name
|
|
37
|
+
// we currently create one per component to better separate them
|
|
38
|
+
const serviceAccountName = `cl-${context.componentName}-deploy`;
|
|
39
|
+
const KUBE_URL =
|
|
40
|
+
await $`TERM=dumb kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'`.then(
|
|
41
|
+
(s) => s.stdout.trim()
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
// first upsert service acount in the ns
|
|
45
|
+
try {
|
|
46
|
+
await $`kubectl delete serviceaccount --namespace ${namespace} ${serviceAccountName}`;
|
|
47
|
+
await $`kubectl delete rolebinding --namespace ${namespace} ${serviceAccountName}`;
|
|
48
|
+
await $`kubectl delete role --namespace ${namespace} ${serviceAccountName}`;
|
|
49
|
+
} catch (e) {
|
|
50
|
+
// ignore
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
await $`kubectl create serviceaccount --namespace ${namespace} ${serviceAccountName}`;
|
|
54
|
+
|
|
55
|
+
// upsert role in the ns
|
|
56
|
+
|
|
57
|
+
await $`cat <<EOF | kubectl apply -f -
|
|
58
|
+
kind: Role
|
|
59
|
+
apiVersion: rbac.authorization.k8s.io/v1
|
|
60
|
+
metadata:
|
|
61
|
+
namespace: ${namespace}
|
|
62
|
+
name: ${serviceAccountName}
|
|
63
|
+
rules:
|
|
64
|
+
- apiGroups: ["", "extensions", "apps", "networking.k8s.io", "batch"]
|
|
65
|
+
resources: ["deployments", "replicasets", "statefulsets", "pods", "secrets", "configmaps", "services", "ingresses", "serviceaccounts", "jobs", "cronjobs"]
|
|
66
|
+
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] # You can also use ["*"]
|
|
67
|
+
---
|
|
68
|
+
kind: RoleBinding
|
|
69
|
+
apiVersion: rbac.authorization.k8s.io/v1
|
|
70
|
+
metadata:
|
|
71
|
+
name: ${serviceAccountName}
|
|
72
|
+
namespace: ${namespace}
|
|
73
|
+
subjects:
|
|
74
|
+
- kind: ServiceAccount
|
|
75
|
+
name: ${serviceAccountName}
|
|
76
|
+
namespace: ${namespace}
|
|
77
|
+
roleRef:
|
|
78
|
+
kind: Role
|
|
79
|
+
name: ${serviceAccountName}
|
|
80
|
+
apiGroup: rbac.authorization.k8s.io
|
|
81
|
+
EOF
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
// get token name
|
|
85
|
+
const tokenName =
|
|
86
|
+
await $`kubectl get serviceaccount --namespace ${namespace} ${serviceAccountName} -o jsonpath='{.secrets[0].name}'`;
|
|
87
|
+
|
|
88
|
+
const KUBE_CA_PEM =
|
|
89
|
+
await $`kubectl get secret ${tokenName} --namespace ${namespace} -o jsonpath="{['data']['ca\\.crt']}"`.then(
|
|
90
|
+
(c) => c.stdout.trim()
|
|
91
|
+
);
|
|
92
|
+
const KUBE_TOKEN =
|
|
93
|
+
await $`kubectl get secret ${tokenName} --namespace ${namespace} -o jsonpath="{['data']['token']}" | base64 --decode`.then(
|
|
94
|
+
(c) => c.stdout.trim()
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const vars = {
|
|
98
|
+
KUBE_TOKEN,
|
|
99
|
+
KUBE_CA_PEM,
|
|
100
|
+
KUBE_URL,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
await upsertAllVariables(
|
|
104
|
+
this,
|
|
105
|
+
vars,
|
|
106
|
+
context.environment.shortName,
|
|
107
|
+
context.componentName
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// there is a constraint, see https://git.panter.ch/catladder/catladder/-/issues/2#note_345677
|
|
113
|
+
// any two components have to use the same custer per env, so e.g. dev:api and dev:www cannot use two different namespaces
|
|
114
|
+
// in practise, that is often not an issue, but it might happen because the config allows it
|
|
115
|
+
/*
|
|
116
|
+
Object.entries(configuredClusters).forEach(([fullname, config]) =>
|
|
117
|
+
this.log(` - ${config.cluster.name || "unknown"} (${fullname})`)
|
|
118
|
+
);
|
|
119
|
+
this.log("");
|
|
120
|
+
|
|
121
|
+
const missingClusters = Object.fromEntries(
|
|
122
|
+
Object.entries(configuredClusters).filter(
|
|
123
|
+
([c]) => !existingClusters.some((exist) => exist === c)
|
|
124
|
+
)
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
this.log("");
|
|
128
|
+
this.log("These clusters are not configured yet on gitlab:");
|
|
129
|
+
this.log("");
|
|
130
|
+
|
|
131
|
+
Object.entries(missingClusters).forEach(([fullname, config]) =>
|
|
132
|
+
this.log(` - ${config.cluster.name || "unknown"} (${fullname})`)
|
|
133
|
+
);
|
|
134
|
+
this.log("");
|
|
135
|
+
|
|
136
|
+
for (const [fullname, config] of Object.entries(missingClusters)) {
|
|
137
|
+
this.log(`${config.name} (${fullname})`);
|
|
138
|
+
this.log("");
|
|
139
|
+
const { shouldContinue } = await this.prompt({
|
|
140
|
+
type: "confirm",
|
|
141
|
+
name: "shouldContinue",
|
|
142
|
+
message: "Should I add the this cluster ? 🤔 ",
|
|
143
|
+
});
|
|
144
|
+
this.log("");
|
|
145
|
+
if (shouldContinue) {
|
|
146
|
+
await connectToCluster(fullname);
|
|
147
|
+
const { stdout: api_url } =
|
|
148
|
+
await $`kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'`;
|
|
149
|
+
const { stdout: ca_cert } =
|
|
150
|
+
await $`kubectl get secret default-token-69xv4 -o jsonpath="{['data']['ca\.crt']}" | base64 --decode`;
|
|
151
|
+
const { stdout: token } =
|
|
152
|
+
await $`kubectl get secret default-token-69xv4 -o jsonpath="{['data']['token']}" | base64 --decode`;
|
|
153
|
+
const postResult = await doGitlabRequest(
|
|
154
|
+
this,
|
|
155
|
+
`projects/${projectId}/clusters/user`,
|
|
156
|
+
{
|
|
157
|
+
name: fullname,
|
|
158
|
+
managed: false,
|
|
159
|
+
environment_scope: "*",
|
|
160
|
+
platform_kubernetes_attributes: {
|
|
161
|
+
api_url,
|
|
162
|
+
ca_cert,
|
|
163
|
+
token,
|
|
164
|
+
namespace: await getProjectNamespace("prod"),
|
|
165
|
+
},
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
const { message } = postResult;
|
|
169
|
+
if (message) {
|
|
170
|
+
this.log(`Message from gitlab: ${message}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const variables = await doGitlabRequest(
|
|
176
|
+
this,
|
|
177
|
+
`projects/${projectId}/variables`
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
if (!variables.find((v: any) => v.key === "GL_TOKEN")) {
|
|
181
|
+
this.log(
|
|
182
|
+
"I need add a GL_TOKEN to the project, so that semantic release will work\n"
|
|
183
|
+
);
|
|
184
|
+
this.log(
|
|
185
|
+
"👉 Please please create a project access token in gitlab and copy its value into clipboard\n\n - name: something like 'semantic-release'\n - expires: leave empty\n - scopes: api, read_repository"
|
|
186
|
+
);
|
|
187
|
+
this.log("\n");
|
|
188
|
+
|
|
189
|
+
const { understood } = await this.prompt({
|
|
190
|
+
default: true,
|
|
191
|
+
message: "Understood and open gitlab now? 🤔",
|
|
192
|
+
name: "understood",
|
|
193
|
+
type: "confirm",
|
|
194
|
+
});
|
|
195
|
+
if (!understood) {
|
|
196
|
+
this.log("continuing anyway...");
|
|
197
|
+
}
|
|
198
|
+
open(`${projectWebUrl}/-/settings/access_tokens`);
|
|
199
|
+
|
|
200
|
+
this.log("\n");
|
|
201
|
+
|
|
202
|
+
this.log("Enter your copied token now: ");
|
|
203
|
+
|
|
204
|
+
this.log("\n");
|
|
205
|
+
const { GL_TOKEN } = await this.prompt({
|
|
206
|
+
type: "password",
|
|
207
|
+
name: "GL_TOKEN",
|
|
208
|
+
message: "Access Token: ",
|
|
209
|
+
});
|
|
210
|
+
await doGitlabRequest(this, `projects/${projectId}/variables`, {
|
|
211
|
+
key: "GL_TOKEN",
|
|
212
|
+
value: GL_TOKEN,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const deploy_tokens = await doGitlabRequest(
|
|
217
|
+
this,
|
|
218
|
+
`projects/${projectId}/deploy_tokens`
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
if (
|
|
222
|
+
!deploy_tokens.find(
|
|
223
|
+
(v: { name: string }) => v.name === "gitlab-deploy-token"
|
|
224
|
+
)
|
|
225
|
+
) {
|
|
226
|
+
this.log(
|
|
227
|
+
"I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project."
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
await doGitlabRequest(this, `projects/${projectId}/deploy_tokens`, {
|
|
231
|
+
id: projectId,
|
|
232
|
+
name: "gitlab-deploy-token",
|
|
233
|
+
scopes: ["read_registry"],
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
this.log("gitlab is ready! 🥂");
|
|
237
|
+
this.log("\n");
|
|
238
|
+
this.log("do not forget to make sure that:");
|
|
239
|
+
[
|
|
240
|
+
"you have __health route in place",
|
|
241
|
+
"lint and test are defined",
|
|
242
|
+
"eat your vegetables",
|
|
243
|
+
"be awesome 🤩",
|
|
244
|
+
].forEach((tip) => this.log(` - ${tip}`));
|
|
245
|
+
this.log("\n");
|
|
246
|
+
this.log("\n");
|
|
247
|
+
*/
|
|
248
|
+
});
|
|
@@ -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
|
});
|