@catladder/cli 0.0.0-main-5f142cf2 → 0.0.0-main-825347d8
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 +1 -0
- package/bin/catladder +1 -1
- package/bin/debugCatenv +1 -0
- package/dist/apps/catenv/catenv.js +130 -35
- package/dist/apps/catenv/catenv.js.map +1 -1
- package/dist/apps/cli/cli.d.ts +2 -0
- package/dist/apps/cli/cli.js +82 -0
- package/dist/apps/cli/cli.js.map +1 -0
- package/dist/apps/{shell → cli}/commands/general/index.d.ts +1 -1
- package/dist/apps/cli/commands/general/index.js +274 -0
- package/dist/apps/cli/commands/general/index.js.map +1 -0
- package/dist/apps/{shell → cli}/commands/general/namespaceAutoCompletion.d.ts +0 -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/{shell → cli}/commands/mongodb/utils/index.d.ts +0 -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 +217 -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/{shell → cli}/commands/project/commandMigrateHelm3.d.ts +1 -1
- 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/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 +95 -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/{shell → cli}/commands/project/utils/ensureCluster.d.ts +0 -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/{shell → cli}/commands/project/utils/ensureNamespace.d.ts +0 -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/{shell → cli}/commands/shared/index.d.ts +0 -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/{shell → cli}/utils/getGoogleAuthUserNumber.d.ts +0 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
- package/dist/{index.d.ts → catenv.d.ts} +0 -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.js +57 -9
- package/dist/config/clusters.js.map +1 -1
- package/dist/config/constants.js +1 -1
- package/dist/config/getProjectConfig.d.ts +11 -7
- package/dist/config/getProjectConfig.js +166 -61
- package/dist/config/getProjectConfig.js.map +1 -1
- package/dist/k8sApi/index.js +5 -5
- package/dist/k8sApi/index.js.map +1 -1
- package/dist/packageInfos.js +3 -3
- package/dist/packageInfos.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types.js +1 -1
- package/dist/utils/cluster.js +79 -19
- package/dist/utils/cluster.js.map +1 -1
- package/dist/utils/dashboardToken.js +80 -15
- package/dist/utils/dashboardToken.js.map +1 -1
- package/dist/utils/editAsFile.d.ts +1 -1
- package/dist/utils/editAsFile.js +78 -15
- package/dist/utils/editAsFile.js.map +1 -1
- package/dist/utils/files.js +70 -16
- package/dist/utils/files.js.map +1 -1
- package/dist/utils/formatEnvVars.js +8 -5
- package/dist/utils/formatEnvVars.js.map +1 -1
- package/dist/utils/getEditor.js +64 -14
- package/dist/utils/getEditor.js.map +1 -1
- package/dist/utils/gitlab.d.ts +2 -1
- package/dist/utils/gitlab.js +194 -79
- package/dist/utils/gitlab.js.map +1 -1
- package/dist/utils/log.js +3 -3
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/passwordstore/index.js +362 -154
- package/dist/utils/passwordstore/index.js.map +1 -1
- package/dist/utils/portForward.js +103 -34
- package/dist/utils/portForward.js.map +1 -1
- package/dist/utils/preferences/index.js +110 -28
- package/dist/utils/preferences/index.js.map +1 -1
- package/dist/utils/projects/index.js +136 -40
- package/dist/utils/projects/index.js.map +1 -1
- package/dist/utils/promise.js +56 -5
- package/dist/utils/promise.js.map +1 -1
- package/dist/utils/shell.js +75 -19
- package/dist/utils/shell.js.map +1 -1
- package/package.json +9 -10
- package/src/apps/catenv/catenv.ts +16 -5
- package/src/apps/{shell/shell.ts → cli/cli.ts} +2 -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 +3 -3
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +3 -3
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoPortForward.ts +3 -3
- package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +0 -0
- package/src/apps/{shell → cli}/commands/project/commandCloudSqlProxy.ts +7 -7
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +161 -0
- package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +9 -5
- package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +3 -3
- package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +3 -3
- 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 +3 -3
- package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
- package/src/apps/{shell → cli}/commands/project/commandInitGitlab.ts +3 -3
- package/src/apps/{shell → cli}/commands/project/commandInitProject.ts +2 -2
- package/src/apps/{shell → cli}/commands/project/commandListPods.ts +3 -3
- package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +11 -5
- package/src/apps/{shell → cli}/commands/project/commandNamespace.ts +3 -3
- package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +3 -3
- package/src/apps/{shell → cli}/commands/project/commandOpenDashboard.ts +12 -6
- 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 +3 -3
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +4 -5
- package/src/apps/{shell → cli}/commands/project/commandOpenLogs.ts +3 -3
- package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +3 -3
- package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +3 -3
- package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +3 -3
- package/src/apps/{shell → cli}/commands/project/index.ts +1 -1
- package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
- package/src/apps/{shell → cli}/commands/project/utils/ensureCluster.ts +6 -2
- package/src/apps/{shell → cli}/commands/project/utils/ensureNamespace.ts +0 -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/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
- package/src/catenv.ts +3 -0
- package/src/cli.ts +8 -0
- package/src/config/getProjectConfig.ts +48 -40
- package/src/utils/editAsFile.ts +12 -2
- package/src/utils/gitlab.ts +14 -10
- package/src/utils/projects/index.ts +2 -1
- package/tsconfig.json +2 -2
- package/bin/catenv.sh +0 -1
- package/dist/apps/shell/commands/general/index.js +0 -104
- package/dist/apps/shell/commands/general/index.js.map +0 -1
- package/dist/apps/shell/commands/general/namespaceAutoCompletion.js +0 -11
- package/dist/apps/shell/commands/general/namespaceAutoCompletion.js.map +0 -1
- package/dist/apps/shell/commands/general/portForward.d.ts +0 -3
- package/dist/apps/shell/commands/general/portForward.js +0 -42
- package/dist/apps/shell/commands/general/portForward.js.map +0 -1
- package/dist/apps/shell/commands/mongodb/index.d.ts +0 -3
- package/dist/apps/shell/commands/mongodb/index.js +0 -14
- package/dist/apps/shell/commands/mongodb/index.js.map +0 -1
- package/dist/apps/shell/commands/mongodb/projectMongoDestroyMember.d.ts +0 -3
- package/dist/apps/shell/commands/mongodb/projectMongoDestroyMember.js +0 -93
- package/dist/apps/shell/commands/mongodb/projectMongoDestroyMember.js.map +0 -1
- package/dist/apps/shell/commands/mongodb/projectMongoGetShell.d.ts +0 -3
- package/dist/apps/shell/commands/mongodb/projectMongoGetShell.js +0 -36
- package/dist/apps/shell/commands/mongodb/projectMongoGetShell.js.map +0 -1
- package/dist/apps/shell/commands/mongodb/projectMongoPortForward.d.ts +0 -3
- package/dist/apps/shell/commands/mongodb/projectMongoPortForward.js +0 -43
- package/dist/apps/shell/commands/mongodb/projectMongoPortForward.js.map +0 -1
- package/dist/apps/shell/commands/mongodb/utils/index.js +0 -61
- package/dist/apps/shell/commands/mongodb/utils/index.js.map +0 -1
- package/dist/apps/shell/commands/project/commandCloudSqlProxy.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandCloudSqlProxy.js +0 -47
- package/dist/apps/shell/commands/project/commandCloudSqlProxy.js.map +0 -1
- package/dist/apps/shell/commands/project/commandConfigSecrets.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandConfigSecrets.js +0 -96
- package/dist/apps/shell/commands/project/commandConfigSecrets.js.map +0 -1
- package/dist/apps/shell/commands/project/commandCopyDB.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandCopyDB.js +0 -67
- package/dist/apps/shell/commands/project/commandCopyDB.js.map +0 -1
- package/dist/apps/shell/commands/project/commandDeletePods.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandDeletePods.js +0 -45
- package/dist/apps/shell/commands/project/commandDeletePods.js.map +0 -1
- package/dist/apps/shell/commands/project/commandDeleteProject.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandDeleteProject.js +0 -28
- package/dist/apps/shell/commands/project/commandDeleteProject.js.map +0 -1
- package/dist/apps/shell/commands/project/commandEnvVars.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandEnvVars.js +0 -12
- package/dist/apps/shell/commands/project/commandEnvVars.js.map +0 -1
- package/dist/apps/shell/commands/project/commandGetMyTotalWorktime.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandGetMyTotalWorktime.js +0 -11
- package/dist/apps/shell/commands/project/commandGetMyTotalWorktime.js.map +0 -1
- package/dist/apps/shell/commands/project/commandGetShell.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandGetShell.js +0 -30
- package/dist/apps/shell/commands/project/commandGetShell.js.map +0 -1
- package/dist/apps/shell/commands/project/commandGitlabCi.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandGitlabCi.js +0 -86
- package/dist/apps/shell/commands/project/commandGitlabCi.js.map +0 -1
- package/dist/apps/shell/commands/project/commandInitGitlab.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandInitGitlab.js +0 -142
- package/dist/apps/shell/commands/project/commandInitGitlab.js.map +0 -1
- package/dist/apps/shell/commands/project/commandInitProject.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandInitProject.js +0 -253
- package/dist/apps/shell/commands/project/commandInitProject.js.map +0 -1
- package/dist/apps/shell/commands/project/commandListPods.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandListPods.js +0 -19
- package/dist/apps/shell/commands/project/commandListPods.js.map +0 -1
- package/dist/apps/shell/commands/project/commandMigrateHelm3.js +0 -45
- package/dist/apps/shell/commands/project/commandMigrateHelm3.js.map +0 -1
- package/dist/apps/shell/commands/project/commandNamespace.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandNamespace.js +0 -11
- package/dist/apps/shell/commands/project/commandNamespace.js.map +0 -1
- package/dist/apps/shell/commands/project/commandOpenCostDashboard.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandOpenCostDashboard.js +0 -22
- package/dist/apps/shell/commands/project/commandOpenCostDashboard.js.map +0 -1
- package/dist/apps/shell/commands/project/commandOpenDashboard.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandOpenDashboard.js +0 -28
- package/dist/apps/shell/commands/project/commandOpenDashboard.js.map +0 -1
- package/dist/apps/shell/commands/project/commandOpenEnv.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandOpenEnv.js +0 -19
- package/dist/apps/shell/commands/project/commandOpenEnv.js.map +0 -1
- package/dist/apps/shell/commands/project/commandOpenGit.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandOpenGit.js +0 -9
- package/dist/apps/shell/commands/project/commandOpenGit.js.map +0 -1
- package/dist/apps/shell/commands/project/commandOpenGrafana.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandOpenGrafana.js +0 -22
- package/dist/apps/shell/commands/project/commandOpenGrafana.js.map +0 -1
- package/dist/apps/shell/commands/project/commandOpenGrafanaPod.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandOpenGrafanaPod.js +0 -34
- package/dist/apps/shell/commands/project/commandOpenGrafanaPod.js.map +0 -1
- package/dist/apps/shell/commands/project/commandOpenLogs.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandOpenLogs.js +0 -22
- package/dist/apps/shell/commands/project/commandOpenLogs.js.map +0 -1
- package/dist/apps/shell/commands/project/commandPauseProject.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandPauseProject.js +0 -28
- package/dist/apps/shell/commands/project/commandPauseProject.js.map +0 -1
- package/dist/apps/shell/commands/project/commandPortForward.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandPortForward.js +0 -40
- package/dist/apps/shell/commands/project/commandPortForward.js.map +0 -1
- package/dist/apps/shell/commands/project/commandTriggerCronjob.d.ts +0 -3
- package/dist/apps/shell/commands/project/commandTriggerCronjob.js +0 -56
- package/dist/apps/shell/commands/project/commandTriggerCronjob.js.map +0 -1
- package/dist/apps/shell/commands/project/index.d.ts +0 -3
- package/dist/apps/shell/commands/project/index.js +0 -56
- package/dist/apps/shell/commands/project/index.js.map +0 -1
- package/dist/apps/shell/commands/project/utils/autocompletions.d.ts +0 -1
- package/dist/apps/shell/commands/project/utils/autocompletions.js +0 -6
- package/dist/apps/shell/commands/project/utils/autocompletions.js.map +0 -1
- package/dist/apps/shell/commands/project/utils/ensureCluster.js +0 -32
- package/dist/apps/shell/commands/project/utils/ensureCluster.js.map +0 -1
- package/dist/apps/shell/commands/project/utils/ensureNamespace.js +0 -39
- package/dist/apps/shell/commands/project/utils/ensureNamespace.js.map +0 -1
- package/dist/apps/shell/commands/shared/index.js +0 -22
- package/dist/apps/shell/commands/shared/index.js.map +0 -1
- package/dist/apps/shell/commands/theStuffThatReallyMatters/index.d.ts +0 -3
- package/dist/apps/shell/commands/theStuffThatReallyMatters/index.js +0 -51
- package/dist/apps/shell/commands/theStuffThatReallyMatters/index.js.map +0 -1
- package/dist/apps/shell/shell.d.ts +0 -2
- package/dist/apps/shell/shell.js +0 -38
- package/dist/apps/shell/shell.js.map +0 -1
- package/dist/apps/shell/utils/getGoogleAuthUserNumber.js +0 -20
- package/dist/apps/shell/utils/getGoogleAuthUserNumber.js.map +0 -1
- package/dist/index.js +0 -21
- package/dist/index.js.map +0 -1
- package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -114
- package/src/apps/shell/commands/project/commandEnvVars.ts +0 -14
- package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
- package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -3
- package/src/index.ts +0 -17
package/dist/utils/shell.js
CHANGED
|
@@ -1,25 +1,81 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
await (0, child_process_promise_1.spawn)(command, {
|
|
9
|
-
stdio: "inherit",
|
|
10
|
-
shell: true,
|
|
11
|
-
env: {
|
|
12
|
-
...process.env,
|
|
13
|
-
DEBUG: "",
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
catch (e) {
|
|
18
|
-
// tslint:disable-next-line:no-console
|
|
19
|
-
if (e.code !== 130) {
|
|
20
|
-
console.log(e);
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
21
8
|
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
22
47
|
}
|
|
23
48
|
};
|
|
49
|
+
exports.__esModule = true;
|
|
50
|
+
exports.getShell = void 0;
|
|
51
|
+
var child_process_promise_1 = require("child-process-promise");
|
|
52
|
+
var getShell = function (namespace, podName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
+
var command, e_1;
|
|
54
|
+
return __generator(this, function (_a) {
|
|
55
|
+
switch (_a.label) {
|
|
56
|
+
case 0:
|
|
57
|
+
command = "kubectl exec -it ".concat(podName, " -n ").concat(namespace, " -- /bin/sh -xc 'bash||sh'");
|
|
58
|
+
_a.label = 1;
|
|
59
|
+
case 1:
|
|
60
|
+
_a.trys.push([1, 3, , 4]);
|
|
61
|
+
return [4 /*yield*/, (0, child_process_promise_1.spawn)(command, {
|
|
62
|
+
stdio: "inherit",
|
|
63
|
+
shell: true,
|
|
64
|
+
env: __assign(__assign({}, process.env), { DEBUG: "" })
|
|
65
|
+
})];
|
|
66
|
+
case 2:
|
|
67
|
+
_a.sent();
|
|
68
|
+
return [3 /*break*/, 4];
|
|
69
|
+
case 3:
|
|
70
|
+
e_1 = _a.sent();
|
|
71
|
+
// tslint:disable-next-line:no-console
|
|
72
|
+
if (e_1.code !== 130) {
|
|
73
|
+
console.log(e_1);
|
|
74
|
+
}
|
|
75
|
+
return [3 /*break*/, 4];
|
|
76
|
+
case 4: return [2 /*return*/];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}); };
|
|
24
80
|
exports.getShell = getShell;
|
|
25
81
|
//# sourceMappingURL=shell.js.map
|
package/dist/utils/shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA8C;AAEvC,IAAM,QAAQ,GAAG,UAAO,SAAiB,EAAE,OAAe;;;;;gBACzD,OAAO,GAAG,2BAAoB,OAAO,iBAAO,SAAS,+BAA4B,CAAC;;;;gBAEtF,qBAAM,IAAA,6BAAK,EAAC,OAAO,EAAE;wBACnB,KAAK,EAAE,SAAS;wBAChB,KAAK,EAAE,IAAI;wBACX,GAAG,wBACE,OAAO,CAAC,GAAG,KACd,KAAK,EAAE,EAAE,GACV;qBACF,CAAC,EAAA;;gBAPF,SAOE,CAAC;;;;gBAEH,sCAAsC;gBACtC,IAAI,GAAC,CAAC,IAAI,KAAK,GAAG,EAAE;oBAClB,OAAO,CAAC,GAAG,CAAC,GAAC,CAAC,CAAC;iBAChB;;;;;KAEJ,CAAC;AAjBW,QAAA,QAAQ,YAiBnB"}
|
package/package.json
CHANGED
|
@@ -7,16 +7,17 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"lint": "eslint \"src/**/*.ts\"",
|
|
9
9
|
"lint:fix": "eslint \"src/**/*.ts\" --fix",
|
|
10
|
-
"test": "
|
|
11
|
-
"build": "tsc",
|
|
12
|
-
"build:watch": "tsc -w"
|
|
10
|
+
"test": "yarn run lint",
|
|
11
|
+
"build": "yarn tsc",
|
|
12
|
+
"build:watch": "yarn tsc -w"
|
|
13
13
|
},
|
|
14
14
|
"bin": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"catenv": "./bin/catenv.sh",
|
|
16
|
+
"catladder": "./bin/catladder"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@bitwarden/cli": "^1.8.0",
|
|
20
|
+
"@catladder/pipeline": "0.0.0-fudi",
|
|
20
21
|
"@kubernetes/client-node": "^0.16.1",
|
|
21
22
|
"child-process-promise": "^2.2.1",
|
|
22
23
|
"clipboardy": "^2.2.0",
|
|
@@ -43,8 +44,6 @@
|
|
|
43
44
|
"node": ">=12.0.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@semantic-release/git": "^10.0.1",
|
|
47
|
-
"@semantic-release/gitlab": "^7.0.4",
|
|
48
47
|
"@tsconfig/node14": "^1.0.1",
|
|
49
48
|
"@types/common-tags": "^1.8.0",
|
|
50
49
|
"@types/fs-extra": "^5.0.4",
|
|
@@ -53,13 +52,13 @@
|
|
|
53
52
|
"@types/memoizee": "^0.4.2",
|
|
54
53
|
"@types/node-fetch": "^2.1.4",
|
|
55
54
|
"@types/request": "^2.48.1",
|
|
55
|
+
"@types/tmp": "^0.2.3",
|
|
56
56
|
"@types/update-notifier": "^2.5.0",
|
|
57
57
|
"@types/vorpal": "^1.12.0",
|
|
58
58
|
"@types/websocket": "^0.0.40",
|
|
59
59
|
"@types/yargs": "^13.0.0",
|
|
60
|
-
"
|
|
61
|
-
"@typescript-eslint/parser": "^5.8.0",
|
|
60
|
+
"eslint": "^8.7.0",
|
|
62
61
|
"typescript": "^4.5.4"
|
|
63
62
|
},
|
|
64
|
-
"version": "0.0.0-main-
|
|
63
|
+
"version": "0.0.0-main-825347d8"
|
|
65
64
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentConfig } from "@catladder/pipeline";
|
|
1
|
+
import { Config, ComponentConfig } from "@catladder/pipeline";
|
|
2
2
|
import { getEnvVars, getProjectConfig } from "../../config/getProjectConfig";
|
|
3
3
|
import { getGitRoot } from "../../utils/projects";
|
|
4
4
|
import { join } from "path";
|
|
@@ -13,20 +13,22 @@ const getCurrentComponentName = async (
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const sanitizeEnvVarName = (name: string) => name.replace(/[\s\-.]+/g, "_");
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
const getAllVariablesToPrint = async (config: Config) => {
|
|
18
|
+
const { components } = config;
|
|
18
19
|
|
|
19
20
|
const currentComponent = await getCurrentComponentName(components);
|
|
21
|
+
|
|
20
22
|
let variables = {};
|
|
21
23
|
if (currentComponent) {
|
|
22
|
-
variables = await getEnvVars(null, "
|
|
24
|
+
variables = await getEnvVars(null, "local", currentComponent);
|
|
23
25
|
} else {
|
|
24
26
|
// when in a monorep and not in a subapp, merge all env vars.
|
|
25
27
|
// this is not 100% correct, but better than not exporting any vars at all
|
|
26
28
|
// so we also add prefixed variants
|
|
27
29
|
variables = await Object.keys(components).reduce(
|
|
28
30
|
async (acc, componentName) => {
|
|
29
|
-
const subappvars = await getEnvVars(null, "
|
|
31
|
+
const subappvars = await getEnvVars(null, "local", componentName);
|
|
30
32
|
return {
|
|
31
33
|
...(await acc),
|
|
32
34
|
...subappvars,
|
|
@@ -42,6 +44,15 @@ export default async () => {
|
|
|
42
44
|
{}
|
|
43
45
|
);
|
|
44
46
|
}
|
|
47
|
+
return variables;
|
|
48
|
+
};
|
|
49
|
+
export default async () => {
|
|
50
|
+
const config = await getProjectConfig();
|
|
51
|
+
if (!config) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const variables = await getAllVariablesToPrint(config);
|
|
45
56
|
|
|
46
57
|
console.log(
|
|
47
58
|
Object.entries(variables)
|
|
@@ -10,8 +10,8 @@ import theStuffThatReallyMatters from "./commands/theStuffThatReallyMatters";
|
|
|
10
10
|
|
|
11
11
|
import { getProjectConfig } from "../../config/getProjectConfig";
|
|
12
12
|
|
|
13
|
-
export default () => {
|
|
14
|
-
const projectConfig = getProjectConfig();
|
|
13
|
+
export default async () => {
|
|
14
|
+
const projectConfig = await getProjectConfig();
|
|
15
15
|
const welcomeMessage = `catladder 2022 😻 version ${packageInfos.version}`;
|
|
16
16
|
|
|
17
17
|
const vorpal = new Vorpal();
|
|
@@ -34,7 +34,7 @@ export const getAllNamespacesNames = async () => {
|
|
|
34
34
|
const namespaces = await getAllNamespaces();
|
|
35
35
|
return namespaces.map((n) => n.metadata.name);
|
|
36
36
|
};
|
|
37
|
-
export default (vorpal: Vorpal) => {
|
|
37
|
+
export default async (vorpal: Vorpal) => {
|
|
38
38
|
vorpal
|
|
39
39
|
.command("connect-cluster <clustername>")
|
|
40
40
|
.autocomplete(getAllClusterNames())
|
|
File without changes
|
|
@@ -6,7 +6,7 @@ import { startPortForward } from "../../../../utils/portForward";
|
|
|
6
6
|
import k8sApi from "../../../../k8sApi";
|
|
7
7
|
import { namespaceAutoCompletion } from "./namespaceAutoCompletion";
|
|
8
8
|
|
|
9
|
-
export default (vorpal: Vorpal) =>
|
|
9
|
+
export default async (vorpal: Vorpal) =>
|
|
10
10
|
vorpal
|
|
11
11
|
.command("port-forward <namespace>", "start port-forwarding")
|
|
12
12
|
.autocomplete(namespaceAutoCompletion)
|
|
@@ -3,7 +3,7 @@ import projectMongoDestroyMember from "./projectMongoDestroyMember";
|
|
|
3
3
|
import projectMongoGetShell from "./projectMongoGetShell";
|
|
4
4
|
import projectMongoPortForward from "./projectMongoPortForward";
|
|
5
5
|
|
|
6
|
-
export default (vorpal: Vorpal) => {
|
|
6
|
+
export default async (vorpal: Vorpal) => {
|
|
7
7
|
projectMongoGetShell(vorpal);
|
|
8
8
|
projectMongoPortForward(vorpal);
|
|
9
9
|
projectMongoDestroyMember(vorpal);
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getProjectNamespace,
|
|
6
6
|
getProjectPvcs,
|
|
7
7
|
} from "../../../../utils/projects";
|
|
8
|
-
import {
|
|
8
|
+
import { envAndComponents } from "../project/utils/autocompletions";
|
|
9
9
|
import ensureCluster from "../project/utils/ensureCluster";
|
|
10
10
|
import { getMongoDbPodsWithReplInfo } from "./utils";
|
|
11
11
|
|
|
@@ -34,13 +34,13 @@ const removeFinalizerAndDelete = async (
|
|
|
34
34
|
await deleteResource(namespace, type, name),
|
|
35
35
|
]);
|
|
36
36
|
};
|
|
37
|
-
export default (vorpal: Vorpal) =>
|
|
37
|
+
export default async (vorpal: Vorpal) =>
|
|
38
38
|
vorpal
|
|
39
39
|
.command(
|
|
40
40
|
"project-mongo-destroy-member <envComponent>",
|
|
41
41
|
"DESTROY a member of a replicaset in order to reinitialize it"
|
|
42
42
|
)
|
|
43
|
-
.autocomplete(
|
|
43
|
+
.autocomplete(await envAndComponents())
|
|
44
44
|
.action(async function ({ envComponent }) {
|
|
45
45
|
await ensureCluster.call(this, envComponent);
|
|
46
46
|
this.log(
|
|
@@ -1,20 +1,20 @@
|
|
|
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
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
14
|
"project-mongo-get-shell <envComponent>",
|
|
15
15
|
"get a shell to a mongodb in the environment"
|
|
16
16
|
)
|
|
17
|
-
.autocomplete(
|
|
17
|
+
.autocomplete(await envAndComponents())
|
|
18
18
|
.action(async function ({ envComponent }) {
|
|
19
19
|
await ensureCluster.call(this, envComponent);
|
|
20
20
|
const namespace = await getProjectNamespace(envComponent);
|
|
@@ -2,17 +2,17 @@ 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
11
|
.command(
|
|
12
12
|
"project-mongo-port-forward <envComponent>",
|
|
13
13
|
"port foward to a mongodb"
|
|
14
14
|
)
|
|
15
|
-
.autocomplete(
|
|
15
|
+
.autocomplete(await envAndComponents())
|
|
16
16
|
.action(async function ({ envComponent }) {
|
|
17
17
|
await ensureCluster.call(this, envComponent);
|
|
18
18
|
const namespace = await getProjectNamespace(envComponent);
|
|
File without changes
|
|
@@ -8,22 +8,22 @@ import {
|
|
|
8
8
|
GOOGLE_PROJECT,
|
|
9
9
|
} from "../../../../config/constants";
|
|
10
10
|
import {
|
|
11
|
-
getEnvComponentChoices,
|
|
12
11
|
getEnvVars,
|
|
13
12
|
getPipelineContextByChoice,
|
|
14
13
|
getProjectConfig,
|
|
15
14
|
parseChoice,
|
|
16
15
|
} from "../../../../config/getProjectConfig";
|
|
17
16
|
import { readPass } from "../../../../utils/passwordstore";
|
|
17
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
18
18
|
|
|
19
|
-
export default (vorpal: Vorpal) =>
|
|
19
|
+
export default async (vorpal: Vorpal) =>
|
|
20
20
|
vorpal
|
|
21
21
|
.command("project-cloud-sql-proxy <envComponent>", "proxy to cloud sql db")
|
|
22
|
-
.autocomplete(
|
|
22
|
+
.autocomplete(await envAndComponents())
|
|
23
23
|
.action(async function ({ envComponent }) {
|
|
24
|
-
const { env } = parseChoice(envComponent);
|
|
24
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
25
25
|
|
|
26
|
-
const config = getProjectConfig();
|
|
26
|
+
const config = await getProjectConfig();
|
|
27
27
|
// skynet-164509:europe-west6:pvl-cyclomania-review=tcp:5432
|
|
28
28
|
|
|
29
29
|
const { localPort } = await this.prompt({
|
|
@@ -33,10 +33,10 @@ export default (vorpal: Vorpal) =>
|
|
|
33
33
|
message: "Local port: ",
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
const POSTGRESQL_PASSWORD = (await getEnvVars(this,
|
|
36
|
+
const POSTGRESQL_PASSWORD = (await getEnvVars(this, env, componentName))
|
|
37
37
|
?.POSTGRESQL_PASSWORD;
|
|
38
38
|
|
|
39
|
-
const context = await getPipelineContextByChoice(
|
|
39
|
+
const context = await getPipelineContextByChoice(env, componentName);
|
|
40
40
|
if (!isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
|
|
41
41
|
throw new Error("currently only supported for kubernetes deployment");
|
|
42
42
|
}
|
|
@@ -0,0 +1,161 @@
|
|
|
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 {
|
|
6
|
+
getEnvironment,
|
|
7
|
+
getEnvVars,
|
|
8
|
+
getProjectComponents,
|
|
9
|
+
parseChoice,
|
|
10
|
+
} from "../../../../config/getProjectConfig";
|
|
11
|
+
import { editAsFile } from "../../../../utils/editAsFile";
|
|
12
|
+
import { upsertAllVariables } from "../../../../utils/gitlab";
|
|
13
|
+
import { delay } from "../../../../utils/promise";
|
|
14
|
+
import { allEnvsAndAllComponents } from "./utils/autocompletions";
|
|
15
|
+
|
|
16
|
+
const getEnvVarsToEdit = async (env: string, componentName: string) => {
|
|
17
|
+
const { secretEnvVarKeys } = await getEnvironment(env, componentName);
|
|
18
|
+
|
|
19
|
+
const allEnvVars = await getEnvVars(this, env, componentName);
|
|
20
|
+
return Object.fromEntries(
|
|
21
|
+
secretEnvVarKeys.map((key) => [key, allEnvVars[key]])
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
const doItFor = async (
|
|
25
|
+
instance: CommandInstance,
|
|
26
|
+
env: string,
|
|
27
|
+
components: string[]
|
|
28
|
+
) => {
|
|
29
|
+
let valuesToEdit = Object.fromEntries(
|
|
30
|
+
await Promise.all(
|
|
31
|
+
components.map(async (componentName) => [
|
|
32
|
+
componentName,
|
|
33
|
+
await getEnvVarsToEdit(env, componentName),
|
|
34
|
+
])
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
let hasErrors = true;
|
|
38
|
+
while (hasErrors) {
|
|
39
|
+
valuesToEdit = await editAsFile(
|
|
40
|
+
valuesToEdit,
|
|
41
|
+
stripIndents`
|
|
42
|
+
Please fill in all secrets for: ${components.join(", ")}
|
|
43
|
+
|
|
44
|
+
`
|
|
45
|
+
);
|
|
46
|
+
// check for errors
|
|
47
|
+
hasErrors = false;
|
|
48
|
+
for (const componentName of components) {
|
|
49
|
+
const usedKeys = valuesToEdit[componentName]
|
|
50
|
+
? Object.keys(valuesToEdit[componentName])
|
|
51
|
+
: [];
|
|
52
|
+
// check whether newValues have the exact number of keys
|
|
53
|
+
const { secretEnvVarKeys } = await getEnvironment(env, componentName);
|
|
54
|
+
const extranous = difference(usedKeys, secretEnvVarKeys);
|
|
55
|
+
const missing = difference(secretEnvVarKeys, usedKeys);
|
|
56
|
+
|
|
57
|
+
if (extranous.length > 0 || missing.length > 0) {
|
|
58
|
+
instance.log("");
|
|
59
|
+
instance.log(
|
|
60
|
+
`😿 Oh no! There is something wrong with "${componentName}"`
|
|
61
|
+
);
|
|
62
|
+
instance.log("");
|
|
63
|
+
if (extranous.length > 0) {
|
|
64
|
+
instance.log("these secrets are not declared in the config");
|
|
65
|
+
extranous.forEach((key) => instance.log(key));
|
|
66
|
+
instance.log("");
|
|
67
|
+
}
|
|
68
|
+
if (missing.length > 0) {
|
|
69
|
+
instance.log("these secrets have not been provided:");
|
|
70
|
+
missing.forEach((key) => instance.log(key));
|
|
71
|
+
instance.log("");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
await delay(1000);
|
|
75
|
+
const { shouldContinue } = await instance.prompt({
|
|
76
|
+
default: true,
|
|
77
|
+
message: "Try again? 🤔",
|
|
78
|
+
name: "shouldContinue",
|
|
79
|
+
type: "confirm",
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
if (!shouldContinue) {
|
|
83
|
+
throw new Error("abort");
|
|
84
|
+
}
|
|
85
|
+
hasErrors = true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
for (const componentName of components) {
|
|
91
|
+
await upsertAllVariables(
|
|
92
|
+
this,
|
|
93
|
+
valuesToEdit[componentName],
|
|
94
|
+
env,
|
|
95
|
+
componentName
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default async (vorpal: Vorpal) => {
|
|
101
|
+
vorpal
|
|
102
|
+
.command(
|
|
103
|
+
"project-config-secrets <envComponent>",
|
|
104
|
+
"setup/update secrets stored in pass"
|
|
105
|
+
)
|
|
106
|
+
.autocomplete(await allEnvsAndAllComponents())
|
|
107
|
+
.action(async function ({ envComponent }) {
|
|
108
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
109
|
+
|
|
110
|
+
// componentName can be null. in this case, iterate over all components
|
|
111
|
+
if (!componentName) {
|
|
112
|
+
const components = await getProjectComponents();
|
|
113
|
+
await doItFor(this, env, components);
|
|
114
|
+
}
|
|
115
|
+
if (componentName) {
|
|
116
|
+
await doItFor(this, env, [componentName]);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/*
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
// adding gcloud sql proxy secret
|
|
123
|
+
const cloudsqlCredentials = await readPass(GOOGLE_CLOUD_SQL_PASS_PATH);
|
|
124
|
+
await createKubernetesSecret.call(
|
|
125
|
+
this,
|
|
126
|
+
namespace,
|
|
127
|
+
"cloudsql-instance-credentials",
|
|
128
|
+
{
|
|
129
|
+
"credentials.json": cloudsqlCredentials,
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
this.log("");
|
|
133
|
+
this.log(
|
|
134
|
+
"⚠️ You need to delete/restart pods in order to make them pick up the new config"
|
|
135
|
+
);
|
|
136
|
+
this.log(`you can use project-delete-pods ${env} to do that`);
|
|
137
|
+
this.log("");
|
|
138
|
+
this.log("");
|
|
139
|
+
await delay(1000);
|
|
140
|
+
}
|
|
141
|
+
this.log("");
|
|
142
|
+
this.log("😻 success!!!!!");
|
|
143
|
+
this.log("");
|
|
144
|
+
*/
|
|
145
|
+
});
|
|
146
|
+
}; /*
|
|
147
|
+
async function createNewEnvInPass(env: any, secretEnvVarsMapping: ISecrets) {
|
|
148
|
+
// const passPath = await getPassPath(env);
|
|
149
|
+
this.log(
|
|
150
|
+
"Your selected env is not yet in pass. Do you want to copy it from another env? "
|
|
151
|
+
);
|
|
152
|
+
const noAnswer = "No, I will create a new one from scratch.";
|
|
153
|
+
const { sourceEnv } = await this.prompt({
|
|
154
|
+
type: "list",
|
|
155
|
+
name: "sourceEnv",
|
|
156
|
+
choices: [...(await envAndComponents()).filter((e) => e !== env), noAnswer],
|
|
157
|
+
message: "Do you want to copy an env?",
|
|
158
|
+
});
|
|
159
|
+
// TODO: reimplenent
|
|
160
|
+
}
|
|
161
|
+
*/
|
|
@@ -10,18 +10,18 @@ import {
|
|
|
10
10
|
parseChoice,
|
|
11
11
|
} from "../../../../config/getProjectConfig";
|
|
12
12
|
import { readPass } from "../../../../utils/passwordstore";
|
|
13
|
-
import {
|
|
13
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
14
14
|
|
|
15
|
-
export default (vorpal: Vorpal) =>
|
|
15
|
+
export default async (vorpal: Vorpal) =>
|
|
16
16
|
vorpal
|
|
17
17
|
.command(
|
|
18
18
|
"copy-db <envComponent>",
|
|
19
19
|
"replace local db with the one from an env"
|
|
20
20
|
)
|
|
21
|
-
.autocomplete(
|
|
21
|
+
.autocomplete(await envAndComponents())
|
|
22
22
|
.action(async function copyDB({ envComponent }) {
|
|
23
23
|
const { env, componentName } = parseChoice(envComponent);
|
|
24
|
-
const { customerName, appName } = getProjectConfig();
|
|
24
|
+
const { customerName, appName } = await getProjectConfig();
|
|
25
25
|
|
|
26
26
|
const { shouldContinue } = await this.prompt({
|
|
27
27
|
type: "confirm",
|
|
@@ -35,7 +35,11 @@ export default (vorpal: Vorpal) =>
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const GOOGLE_CLOUD_SQL_REGION = "europe-west6"; // currently hardcoded
|
|
38
|
-
const { POSTGRESQL_PASSWORD } = await getEnvVars(
|
|
38
|
+
const { POSTGRESQL_PASSWORD } = await getEnvVars(
|
|
39
|
+
this,
|
|
40
|
+
env,
|
|
41
|
+
componentName
|
|
42
|
+
);
|
|
39
43
|
|
|
40
44
|
const LOCAL_PORT = 54321;
|
|
41
45
|
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
getProjectNamespace,
|
|
7
7
|
getProjectPodNames,
|
|
8
8
|
} from "../../../../utils/projects";
|
|
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("project-delete-pods <envComponent>", "delete / restart pods")
|
|
15
|
-
.autocomplete(
|
|
15
|
+
.autocomplete(await envAndComponents())
|
|
16
16
|
.action(async function ({ envComponent }) {
|
|
17
17
|
await ensureCluster.call(this, envComponent);
|
|
18
18
|
const namespace = await getProjectNamespace(envComponent);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import Vorpal from "vorpal";
|
|
2
2
|
import { exec } from "child-process-promise";
|
|
3
3
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
4
|
-
import {
|
|
4
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
5
5
|
|
|
6
|
-
export default (vorpal: Vorpal) =>
|
|
6
|
+
export default async (vorpal: Vorpal) =>
|
|
7
7
|
vorpal
|
|
8
8
|
.command(
|
|
9
9
|
"project-delete <envComponent>",
|
|
10
10
|
"deletes a environment of a project (it deletes the namespace)"
|
|
11
11
|
)
|
|
12
|
-
.autocomplete(
|
|
12
|
+
.autocomplete(await envAndComponents())
|
|
13
13
|
.action(async function ({ envComponent }) {
|
|
14
14
|
const namespace = await getProjectNamespace(envComponent);
|
|
15
15
|
const { shouldContinue } = await this.prompt({
|
|
@@ -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
|
});
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
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
15
|
"project-get-shell <envComponent>",
|
|
16
16
|
"get a shell to a pod in the environment"
|
|
17
17
|
)
|
|
18
|
-
.autocomplete(
|
|
18
|
+
.autocomplete(await envAndComponents())
|
|
19
19
|
.action(async function ({ envComponent }) {
|
|
20
20
|
await ensureCluster.call(this, envComponent);
|
|
21
21
|
const namespace = await getProjectNamespace(envComponent);
|