@catladder/cli 0.0.0-main-d74691dd → 0.0.0-main-b29ca0c2
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
|
@@ -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
|
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
getClusterByName,
|
|
8
8
|
} from "../../../../utils/cluster";
|
|
9
9
|
import { doGitlabRequest, getProjectInfo } from "../../../../utils/gitlab";
|
|
10
|
-
import { readPass } from "../../../../utils/passwordstore
|
|
10
|
+
import { readPass } from "../../../../utils/passwordstore";
|
|
11
11
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
12
12
|
|
|
13
|
-
export default (vorpal: Vorpal) =>
|
|
13
|
+
export default async (vorpal: Vorpal) =>
|
|
14
14
|
vorpal
|
|
15
15
|
.command(
|
|
16
16
|
"project-init-gitlab",
|
|
@@ -50,7 +50,7 @@ export default (vorpal: Vorpal) =>
|
|
|
50
50
|
this.log("");
|
|
51
51
|
this.log("your project specifies the following clusters:");
|
|
52
52
|
this.log("");
|
|
53
|
-
const allContext = getAllPipelineContexts();
|
|
53
|
+
const allContext = await getAllPipelineContexts();
|
|
54
54
|
const allDeployments = allContext.map((c) => c.componentConfig.deploy);
|
|
55
55
|
|
|
56
56
|
const configuredClusterNames = allDeployments.reduce<string[]>(
|
|
@@ -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
|
{
|
|
@@ -187,7 +187,7 @@ const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
|
|
|
187
187
|
*/
|
|
188
188
|
|
|
189
189
|
const PLATFORMS: any = {};
|
|
190
|
-
export default (vorpal: Vorpal) =>
|
|
190
|
+
export default async (vorpal: Vorpal) =>
|
|
191
191
|
vorpal
|
|
192
192
|
.command("project-init", "Inits a new project")
|
|
193
193
|
.action(async function () {
|
|
@@ -2,13 +2,13 @@ import yaml from "js-yaml";
|
|
|
2
2
|
import { pick } from "lodash";
|
|
3
3
|
import Vorpal from "vorpal";
|
|
4
4
|
import { getProjectPods } from "../../../../utils/projects";
|
|
5
|
-
import {
|
|
5
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
6
6
|
import ensureCluster from "./utils/ensureCluster";
|
|
7
7
|
|
|
8
|
-
export default (vorpal: Vorpal) =>
|
|
8
|
+
export default async (vorpal: Vorpal) =>
|
|
9
9
|
vorpal
|
|
10
10
|
.command("project-list-pods <envComponent>", "list pods of local project")
|
|
11
|
-
.autocomplete(
|
|
11
|
+
.autocomplete(await envAndComponents())
|
|
12
12
|
.action(async function ({ envComponent }) {
|
|
13
13
|
await ensureCluster.call(this, envComponent);
|
|
14
14
|
const pods = await getProjectPods(envComponent);
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import { exec } from "child-process-promise";
|
|
2
2
|
import Vorpal from "vorpal";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
getEnvironment,
|
|
5
|
+
parseChoice,
|
|
6
|
+
} from "../../../../config/getProjectConfig";
|
|
4
7
|
import { logError } from "../../../../utils/log";
|
|
5
8
|
|
|
6
|
-
import {
|
|
9
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* Error: rendered manifests contain a resource that already exists.
|
|
10
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"
|
|
11
14
|
*/
|
|
12
|
-
export default (vorpal: Vorpal) =>
|
|
15
|
+
export default async (vorpal: Vorpal) =>
|
|
13
16
|
vorpal
|
|
14
17
|
.command(
|
|
15
18
|
"project-migrate-helm3 <envComponent>",
|
|
16
19
|
"Do manual step for helm2 to helm3 migration"
|
|
17
20
|
)
|
|
18
21
|
.autocomplete(
|
|
19
|
-
|
|
22
|
+
(await envAndComponents()).filter(
|
|
23
|
+
(e) => !e.startsWith("local") && !e.startsWith("review")
|
|
24
|
+
)
|
|
20
25
|
)
|
|
21
26
|
.action(async function ({ envComponent }) {
|
|
22
27
|
try {
|
|
28
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
23
29
|
const result = await exec("helm version --short");
|
|
24
30
|
const version = result.stdout as string;
|
|
25
31
|
this.log(`your helm version: ${version}`);
|
|
@@ -37,7 +43,7 @@ export default (vorpal: Vorpal) =>
|
|
|
37
43
|
// ignore
|
|
38
44
|
}
|
|
39
45
|
|
|
40
|
-
const releaseName = await
|
|
46
|
+
const releaseName = (await getEnvironment(env, componentName)).envVars
|
|
41
47
|
.RELEASE_NAME; // TODO: maybe its own function would be better
|
|
42
48
|
this.log(`helm release name: ${releaseName}`);
|
|
43
49
|
this.log("");
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import Vorpal from "vorpal";
|
|
2
2
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
3
|
-
import {
|
|
3
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
4
4
|
|
|
5
|
-
export default (vorpal: Vorpal) =>
|
|
5
|
+
export default async (vorpal: Vorpal) =>
|
|
6
6
|
vorpal
|
|
7
7
|
.command(
|
|
8
8
|
"project-namespace <envComponent>",
|
|
9
9
|
"show namespace of local project"
|
|
10
10
|
)
|
|
11
|
-
.autocomplete(
|
|
11
|
+
.autocomplete(await envAndComponents())
|
|
12
12
|
.action(async function ({ envComponent }) {
|
|
13
13
|
this.log(await getProjectNamespace(envComponent));
|
|
14
14
|
});
|
|
@@ -9,15 +9,15 @@ 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
16
|
.command(
|
|
17
17
|
"project-check-costs <envComponent>",
|
|
18
18
|
"Shows you how much you're spending"
|
|
19
19
|
)
|
|
20
|
-
.autocomplete(
|
|
20
|
+
.autocomplete(await envAndComponents())
|
|
21
21
|
.action(async function ({ envComponent }) {
|
|
22
22
|
await ensureCluster.call(this, envComponent);
|
|
23
23
|
const namespace = await getProjectNamespace(envComponent);
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import Vorpal from "vorpal";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getPipelineContextByChoice,
|
|
4
|
+
parseChoice,
|
|
5
|
+
} from "../../../../config/getProjectConfig";
|
|
3
6
|
import { getCurrentConnectedClusterName } from "../../../../utils/cluster";
|
|
4
7
|
import { getGoogleAuthUserNumber } from "../../utils/getGoogleAuthUserNumber";
|
|
5
8
|
import { openGoogleCloudKubernetesDashboard } from "../shared";
|
|
6
|
-
import {
|
|
9
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
7
10
|
import ensureCluster from "./utils/ensureCluster";
|
|
8
|
-
export default (vorpal: Vorpal) =>
|
|
11
|
+
export default async (vorpal: Vorpal) =>
|
|
9
12
|
vorpal
|
|
10
13
|
.command(
|
|
11
14
|
"project-open-dashboard <envComponent>",
|
|
12
15
|
"open kubernetes dashboard on google"
|
|
13
16
|
)
|
|
14
|
-
.autocomplete(
|
|
17
|
+
.autocomplete(await envAndComponents())
|
|
15
18
|
.action(async function ({ envComponent }) {
|
|
16
|
-
const {
|
|
17
|
-
|
|
19
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
20
|
+
const { componentConfig, environment } = await getPipelineContextByChoice(
|
|
21
|
+
env,
|
|
22
|
+
componentName
|
|
23
|
+
);
|
|
18
24
|
|
|
19
25
|
if (
|
|
20
26
|
!componentConfig.deploy ||
|
|
@@ -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
|
+
});
|
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
12
12
|
import ensureCluster from "./utils/ensureCluster";
|
|
13
|
-
export default (vorpal: Vorpal) =>
|
|
13
|
+
export default async (vorpal: Vorpal) =>
|
|
14
14
|
vorpal
|
|
15
15
|
.command(
|
|
16
16
|
"project-open-grafana <envComponent>",
|
|
17
17
|
"open Grafana dashboard for your namespace"
|
|
18
18
|
)
|
|
19
|
-
.autocomplete(
|
|
19
|
+
.autocomplete(await envAndComponents())
|
|
20
20
|
.action(async function ({ envComponent }) {
|
|
21
21
|
await ensureCluster.call(this, envComponent);
|
|
22
22
|
const namespace = await getProjectNamespace(envComponent);
|
|
@@ -6,21 +6,20 @@ import {
|
|
|
6
6
|
} from "../../../../config/constants";
|
|
7
7
|
import { logError } from "../../../../utils/log";
|
|
8
8
|
import { startPortForward } from "../../../../utils/portForward";
|
|
9
|
-
|
|
10
9
|
import {
|
|
11
10
|
getProjectNamespace,
|
|
12
11
|
getProjectPodNames,
|
|
13
12
|
} from "../../../../utils/projects";
|
|
14
|
-
|
|
15
|
-
import { envAutocompletion } from "./utils/autocompletions";
|
|
13
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
16
14
|
import ensureCluster from "./utils/ensureCluster";
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
export default async (vorpal: Vorpal) =>
|
|
18
17
|
vorpal
|
|
19
18
|
.command(
|
|
20
19
|
"project-open-grafana-pod <envComponent>",
|
|
21
20
|
"open Grafana dashboard for a specific pod"
|
|
22
21
|
)
|
|
23
|
-
.autocomplete(
|
|
22
|
+
.autocomplete(await envAndComponents())
|
|
24
23
|
.action(async function ({ envComponent }) {
|
|
25
24
|
await ensureCluster.call(this, envComponent);
|
|
26
25
|
const podNames = await getProjectPodNames(envComponent);
|
|
@@ -3,16 +3,16 @@ import { getCurrentConnectedClusterName } from "../../../../utils/cluster";
|
|
|
3
3
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
4
4
|
import { getGoogleAuthUserNumber } from "../../utils/getGoogleAuthUserNumber";
|
|
5
5
|
import { openGoogleCloudLogs } from "../shared";
|
|
6
|
-
import {
|
|
6
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
7
7
|
import ensureCluster from "./utils/ensureCluster";
|
|
8
8
|
|
|
9
|
-
export default (vorpal: Vorpal) =>
|
|
9
|
+
export default async (vorpal: Vorpal) =>
|
|
10
10
|
vorpal
|
|
11
11
|
.command(
|
|
12
12
|
"project-open-logs <envComponent>",
|
|
13
13
|
"open google cloud logs (stackdriver logs)"
|
|
14
14
|
)
|
|
15
|
-
.autocomplete(
|
|
15
|
+
.autocomplete(await envAndComponents())
|
|
16
16
|
.action(async function ({ envComponent }) {
|
|
17
17
|
await ensureCluster.call(this, envComponent);
|
|
18
18
|
const clustername = await getCurrentConnectedClusterName();
|
|
@@ -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-pause <envComponent>",
|
|
10
10
|
"halts all running pods (scales to 0)"
|
|
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({
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
getProjectNamespace,
|
|
6
6
|
getProjectPodNames,
|
|
7
7
|
} from "../../../../utils/projects";
|
|
8
|
-
import {
|
|
8
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
9
9
|
import ensureCluster from "./utils/ensureCluster";
|
|
10
10
|
|
|
11
|
-
export default (vorpal: Vorpal) =>
|
|
11
|
+
export default async (vorpal: Vorpal) =>
|
|
12
12
|
vorpal
|
|
13
13
|
.command("project-port-forward <envComponent>", "start port-forwarding")
|
|
14
|
-
.autocomplete(
|
|
14
|
+
.autocomplete(await envAndComponents())
|
|
15
15
|
.action(async function ({ envComponent }) {
|
|
16
16
|
await ensureCluster.call(this, envComponent);
|
|
17
17
|
const namespace = await getProjectNamespace(envComponent);
|
|
@@ -6,7 +6,7 @@ import { logError } from "../../../../utils/log";
|
|
|
6
6
|
import { namespaceAutoCompletion } from "../general/namespaceAutoCompletion";
|
|
7
7
|
|
|
8
8
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
9
|
-
import {
|
|
9
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
10
10
|
import ensureCluster from "./utils/ensureCluster";
|
|
11
11
|
|
|
12
12
|
async function triggerCronjob(namespace: string) {
|
|
@@ -43,7 +43,7 @@ async function triggerCronjob(namespace: string) {
|
|
|
43
43
|
logError(this, "command failed", e.body);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
export default (vorpal: Vorpal) => {
|
|
46
|
+
export default async (vorpal: Vorpal) => {
|
|
47
47
|
vorpal
|
|
48
48
|
.command("trigger-cronjob <namespace>", "trigger cronjob")
|
|
49
49
|
.autocomplete(namespaceAutoCompletion)
|
|
@@ -52,7 +52,7 @@ export default (vorpal: Vorpal) => {
|
|
|
52
52
|
});
|
|
53
53
|
vorpal
|
|
54
54
|
.command("project-trigger-cronjob <envComponent>", "trigger cronjob")
|
|
55
|
-
.autocomplete(
|
|
55
|
+
.autocomplete(await envAndComponents())
|
|
56
56
|
.action(async function ({ envComponent }) {
|
|
57
57
|
await ensureCluster.call(this, envComponent);
|
|
58
58
|
const namespace = await getProjectNamespace(envComponent);
|
|
@@ -25,7 +25,7 @@ import commandTriggerCronjob from "./commandTriggerCronjob";
|
|
|
25
25
|
|
|
26
26
|
import commandOpenGrafanaPod from "./commandOpenGrafanaPod";
|
|
27
27
|
|
|
28
|
-
export default (vorpal: Vorpal) => {
|
|
28
|
+
export default async (vorpal: Vorpal) => {
|
|
29
29
|
commandInitProject(vorpal);
|
|
30
30
|
commandInitGitlab(vorpal);
|
|
31
31
|
commandEnvVars(vorpal);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getAllEnvs, getAllEnvsInAllComponents } from "@catladder/pipeline";
|
|
2
|
+
import {
|
|
3
|
+
getAllComponentsWithAllEnvs,
|
|
4
|
+
getProjectConfig,
|
|
5
|
+
} from "../../../../../config/getProjectConfig";
|
|
6
|
+
|
|
7
|
+
export const allEnvs = async () => {
|
|
8
|
+
const config = await getProjectConfig();
|
|
9
|
+
if (!config) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
return getAllEnvsInAllComponents(config);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const envAndComponents = async () => {
|
|
16
|
+
const allEnvAndcomponents = await getAllComponentsWithAllEnvs();
|
|
17
|
+
|
|
18
|
+
return allEnvAndcomponents.reduce<string[]>(
|
|
19
|
+
(acc, { env, componentName }) => [...acc, env + ":" + componentName],
|
|
20
|
+
[]
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const allEnvsAndAllComponents = async () => {
|
|
25
|
+
return [...(await allEnvs()), ...(await envAndComponents())];
|
|
26
|
+
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { isOfDeployType } from "@catladder/pipeline";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getPipelineContextByChoice,
|
|
4
|
+
parseChoice,
|
|
5
|
+
} from "../../../../../config/getProjectConfig";
|
|
3
6
|
import {
|
|
4
7
|
connectToCluster,
|
|
5
8
|
getCurrentConnectedClusterName,
|
|
6
9
|
} from "../../../../../utils/cluster";
|
|
7
10
|
export default async function (envComponent: string) {
|
|
8
|
-
const
|
|
11
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
12
|
+
const context = await getPipelineContextByChoice(env, componentName);
|
|
9
13
|
if (!isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
|
|
10
14
|
throw new Error("can't ensure cluster for non-kubernetes deployments");
|
|
11
15
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -2,31 +2,31 @@ import { spawn } from "child-process-promise";
|
|
|
2
2
|
import fetch from "node-fetch";
|
|
3
3
|
import Vorpal from "vorpal";
|
|
4
4
|
|
|
5
|
-
export default (vorpal: Vorpal) => {
|
|
6
|
-
vorpal.command("dadjoke", "something for jonas.").action(async function() {
|
|
5
|
+
export default async (vorpal: Vorpal) => {
|
|
6
|
+
vorpal.command("dadjoke", "something for jonas.").action(async function () {
|
|
7
7
|
const result = await fetch("https://icanhazdadjoke.com/", {
|
|
8
8
|
headers: {
|
|
9
|
-
Accept: "text/plain"
|
|
10
|
-
}
|
|
9
|
+
Accept: "text/plain",
|
|
10
|
+
},
|
|
11
11
|
});
|
|
12
12
|
const text = await result.text();
|
|
13
13
|
this.log("");
|
|
14
14
|
this.log(text);
|
|
15
15
|
this.log("");
|
|
16
16
|
});
|
|
17
|
-
vorpal.command("pantobot", "the allknowing oracle").action(async function() {
|
|
17
|
+
vorpal.command("pantobot", "the allknowing oracle").action(async function () {
|
|
18
18
|
const { message } = await this.prompt({
|
|
19
19
|
type: "string",
|
|
20
20
|
name: "message",
|
|
21
21
|
|
|
22
|
-
message: "Your question, unworthy?: "
|
|
22
|
+
message: "Your question, unworthy?: ",
|
|
23
23
|
});
|
|
24
24
|
const result = await fetch(
|
|
25
25
|
`https://paas.panter.cloud/api/pantobot/${message}`,
|
|
26
26
|
{
|
|
27
27
|
headers: {
|
|
28
|
-
Accept: "text/plain"
|
|
29
|
-
}
|
|
28
|
+
Accept: "text/plain",
|
|
29
|
+
},
|
|
30
30
|
}
|
|
31
31
|
);
|
|
32
32
|
const text = await result.text();
|
|
@@ -37,15 +37,15 @@ export default (vorpal: Vorpal) => {
|
|
|
37
37
|
let starwarsPromise: any;
|
|
38
38
|
vorpal
|
|
39
39
|
.command("starwars", "Long time ago... in a galaxy far far away...")
|
|
40
|
-
.action(async function() {
|
|
40
|
+
.action(async function () {
|
|
41
41
|
starwarsPromise = spawn("telnet", ["towel.blinkenlights.nl"], {
|
|
42
|
-
stdio: ["pipe", "inherit", "pipe"]
|
|
42
|
+
stdio: ["pipe", "inherit", "pipe"],
|
|
43
43
|
});
|
|
44
44
|
await starwarsPromise;
|
|
45
45
|
})
|
|
46
46
|
// we need to close it properly, because telnet towel.blinkenlights.nl has no way to cancel and stop itself
|
|
47
47
|
// this is also why we need to only inherit the stdout and not the stdin
|
|
48
|
-
.cancel(async function() {
|
|
48
|
+
.cancel(async function () {
|
|
49
49
|
starwarsPromise.childProcess.kill();
|
|
50
50
|
});
|
|
51
51
|
};
|
|
File without changes
|
package/src/catenv.ts
ADDED
package/src/cli.ts
ADDED
|
@@ -7,67 +7,78 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import { CommandInstance } from "vorpal";
|
|
9
9
|
import { getAllVariables } from "../utils/gitlab";
|
|
10
|
-
|
|
10
|
+
import memoizee from "memoizee";
|
|
11
|
+
import { getGitRoot } from "../utils/projects";
|
|
11
12
|
// currently cant change
|
|
12
|
-
const projectConfig = readConfigSync();
|
|
13
13
|
|
|
14
|
-
export const getProjectConfig = (
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export const getProjectConfig = memoizee(
|
|
15
|
+
async () => {
|
|
16
|
+
try {
|
|
17
|
+
const gitRoot = await getGitRoot();
|
|
18
|
+
return readConfigSync(gitRoot);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
// ignore
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{ promise: true }
|
|
24
|
+
);
|
|
17
25
|
|
|
18
|
-
export const getProjectComponents = () => {
|
|
19
|
-
const config = getProjectConfig();
|
|
26
|
+
export const getProjectComponents = async () => {
|
|
27
|
+
const config = await getProjectConfig();
|
|
28
|
+
if (!config) return [];
|
|
20
29
|
return Object.keys(config.components);
|
|
21
30
|
};
|
|
22
31
|
|
|
23
|
-
export const getEnvComponentChoices = () => {
|
|
24
|
-
const config = getProjectConfig();
|
|
25
|
-
return Object.keys(config.components).reduce<string[]>(
|
|
26
|
-
(acc, componentName) => [
|
|
27
|
-
...acc,
|
|
28
|
-
...getAllEnvs(config, componentName).map((e) => e + ":" + componentName),
|
|
29
|
-
],
|
|
30
|
-
[]
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
32
|
export const parseChoice = (envComponent: string) => {
|
|
35
33
|
const [env, componentName] = envComponent.split(":");
|
|
36
34
|
return { env, componentName };
|
|
37
35
|
};
|
|
38
36
|
|
|
39
|
-
export const getPipelineContextByChoice = (
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
export const getPipelineContextByChoice = async (
|
|
38
|
+
env: string,
|
|
39
|
+
componentName: string
|
|
40
|
+
) => {
|
|
41
|
+
const config = await getProjectConfig();
|
|
42
42
|
return createContext(config, componentName, env);
|
|
43
43
|
};
|
|
44
|
+
export const getAllComponentsWithAllEnvs = async () => {
|
|
45
|
+
const config = await getProjectConfig();
|
|
46
|
+
if (!config) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
return Promise.all(
|
|
50
|
+
Object.keys(config.components).flatMap((componentName) =>
|
|
51
|
+
getAllEnvs(config, componentName).map((env) => ({ env, componentName }))
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
};
|
|
44
55
|
|
|
45
|
-
export const getAllPipelineContexts = () => {
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
export const getAllPipelineContexts = async () => {
|
|
57
|
+
return Promise.all(
|
|
58
|
+
(await getAllComponentsWithAllEnvs()).map(({ env, componentName }) =>
|
|
59
|
+
getPipelineContextByChoice(env, componentName)
|
|
60
|
+
)
|
|
61
|
+
);
|
|
48
62
|
};
|
|
49
63
|
|
|
50
|
-
export const
|
|
51
|
-
const
|
|
52
|
-
const config = getProjectConfig();
|
|
64
|
+
export const getEnvironment = async (env: string, componentName: string) => {
|
|
65
|
+
const config = await getProjectConfig();
|
|
53
66
|
return _getEnvironment(config, componentName, env);
|
|
54
67
|
};
|
|
55
68
|
|
|
56
69
|
const resolveSecrets = async (
|
|
57
70
|
vorpal: CommandInstance,
|
|
58
|
-
allEnvVars: Record<string, string
|
|
59
|
-
secretEnvVarKeys: string[]
|
|
71
|
+
allEnvVars: Record<string, string>
|
|
60
72
|
) => {
|
|
61
73
|
const allVariablesInGitlab = await getAllVariables(vorpal);
|
|
62
|
-
|
|
74
|
+
|
|
63
75
|
return Object.fromEntries(
|
|
64
76
|
Object.entries(allEnvVars).map(([key, value]) => {
|
|
65
|
-
const isSecret =
|
|
66
|
-
console.log({ key, value, isSecret, allVariablesInGitlab });
|
|
77
|
+
const isSecret = value?.startsWith("$CL_");
|
|
67
78
|
if (isSecret) {
|
|
68
79
|
// secrets have CL_XXXX structure
|
|
69
80
|
const found = allVariablesInGitlab.find((v) => "$" + v.key === value);
|
|
70
|
-
|
|
81
|
+
|
|
71
82
|
if (found) {
|
|
72
83
|
return [key, found.value];
|
|
73
84
|
} else {
|
|
@@ -81,12 +92,9 @@ const resolveSecrets = async (
|
|
|
81
92
|
|
|
82
93
|
export const getEnvVars = async (
|
|
83
94
|
vorpal: CommandInstance,
|
|
84
|
-
|
|
95
|
+
env: string,
|
|
96
|
+
componentName: string
|
|
85
97
|
) => {
|
|
86
|
-
const envionment =
|
|
87
|
-
return resolveSecrets(
|
|
88
|
-
vorpal,
|
|
89
|
-
envionment.envVars,
|
|
90
|
-
envionment.secretEnvVarKeys
|
|
91
|
-
);
|
|
98
|
+
const envionment = await getEnvironment(env, componentName);
|
|
99
|
+
return resolveSecrets(vorpal, envionment.envVars);
|
|
92
100
|
};
|
package/src/utils/editAsFile.ts
CHANGED
|
@@ -4,8 +4,18 @@ import yaml from "js-yaml";
|
|
|
4
4
|
import { readFile, writeFile } from "fs-extra";
|
|
5
5
|
import getEditor from "./getEditor";
|
|
6
6
|
|
|
7
|
-
export const editAsFile = async <T>(
|
|
8
|
-
|
|
7
|
+
export const editAsFile = async <T>(
|
|
8
|
+
inObject: T,
|
|
9
|
+
preamble?: string
|
|
10
|
+
): Promise<T> => {
|
|
11
|
+
const fullPreamble = preamble
|
|
12
|
+
? `#
|
|
13
|
+
# ${preamble.split("\n").join("\n# ")}
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
`
|
|
17
|
+
: "\n";
|
|
18
|
+
const asString = fullPreamble + yaml.safeDump(inObject, { noRefs: true });
|
|
9
19
|
let newContent;
|
|
10
20
|
|
|
11
21
|
await withFile(
|