@catladder/cli 0.0.0-test7 → 0.0.0-update-meteor-53480fed
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -1
- package/README.md +6 -3
- package/bin/catenv +3 -0
- package/bin/catenv-dev +3 -0
- package/bin/catladder +1 -1
- package/bin/catladder-dev +3 -0
- package/dist/apps/catenv/catenv.d.ts +3 -0
- package/dist/apps/catenv/catenv.js +66 -0
- package/dist/apps/catenv/catenv.js.map +1 -0
- package/dist/apps/catenv/printVariables.d.ts +3 -0
- package/dist/apps/catenv/printVariables.js +115 -0
- package/dist/apps/catenv/printVariables.js.map +1 -0
- package/dist/apps/catenv/types.d.ts +5 -0
- package/dist/apps/catenv/types.js +3 -0
- package/dist/apps/catenv/types.js.map +1 -0
- package/dist/apps/catenv/utils.d.ts +12 -0
- package/dist/apps/catenv/utils.js +108 -0
- package/dist/apps/catenv/utils.js.map +1 -0
- package/dist/apps/catenv/writeDotEnvFiles.d.ts +3 -0
- package/dist/apps/catenv/writeDotEnvFiles.js +94 -0
- package/dist/apps/catenv/writeDotEnvFiles.js.map +1 -0
- package/dist/apps/catenv/writeEnvDTs.d.ts +3 -0
- package/dist/apps/catenv/writeEnvDTs.js +114 -0
- package/dist/apps/catenv/writeEnvDTs.js.map +1 -0
- package/dist/apps/cli/cli.d.ts +2 -0
- package/dist/apps/cli/cli.js +83 -0
- package/dist/apps/cli/cli.js.map +1 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.d.ts +3 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js +180 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +1 -0
- package/dist/apps/cli/commands/cloudSQL/index.d.ts +3 -0
- package/dist/apps/cli/commands/cloudSQL/index.js +50 -0
- package/dist/apps/cli/commands/cloudSQL/index.js.map +1 -0
- package/dist/apps/cli/commands/general/index.d.ts +4 -0
- package/dist/apps/cli/commands/general/index.js +216 -0
- package/dist/apps/cli/commands/general/index.js.map +1 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.d.ts +3 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +56 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -0
- package/dist/apps/cli/commands/general/portForward.d.ts +3 -0
- package/dist/apps/cli/commands/general/portForward.js +97 -0
- package/dist/apps/cli/commands/general/portForward.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/index.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/index.js +53 -0
- package/dist/apps/cli/commands/mongodb/index.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +191 -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 +121 -0
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/utils/index.d.ts +13 -0
- package/dist/apps/cli/commands/mongodb/utils/index.js +179 -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 +164 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +5 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js +334 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
- package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandDeletePods.js +121 -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 +96 -0
- package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.js +185 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -0
- package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandInitProject.old.js +345 -0
- package/dist/apps/cli/commands/project/commandInitProject.old.js.map +1 -0
- package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandListPods.js +78 -0
- package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
- package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js +112 -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 +84 -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 +100 -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 +74 -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 +168 -0
- package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
- package/dist/apps/cli/commands/project/commandSecretsClearBackups.d.ts +5 -0
- package/dist/apps/cli/commands/project/commandSecretsClearBackups.js +90 -0
- package/dist/apps/cli/commands/project/commandSecretsClearBackups.js.map +1 -0
- package/dist/apps/cli/commands/project/commandSetup.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandSetup.js +58 -0
- package/dist/apps/cli/commands/project/commandSetup.js.map +1 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
- package/dist/apps/cli/commands/project/index.d.ts +3 -0
- package/dist/apps/cli/commands/project/index.js +94 -0
- package/dist/apps/cli/commands/project/index.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/index.d.ts +2 -0
- package/dist/apps/cli/commands/project/setup/index.js +107 -0
- package/dist/apps/cli/commands/project/setup/index.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +2 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +116 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupCloudRun.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupCloudRun.js +118 -0
- package/dist/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupContext.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupContext.js +81 -0
- package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js +139 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupTopic.d.ts +2 -0
- package/dist/apps/cli/commands/project/setup/setupTopic.js +69 -0
- package/dist/apps/cli/commands/project/setup/setupTopic.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js +104 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +101 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
- package/dist/apps/cli/config/writeConfig.d.ts +5 -0
- package/dist/apps/cli/config/writeConfig.js +106 -0
- package/dist/apps/cli/config/writeConfig.js.map +1 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
- package/dist/apps/cli/verify/index.d.ts +2 -0
- package/dist/apps/cli/verify/index.js +94 -0
- package/dist/apps/cli/verify/index.js.map +1 -0
- package/dist/apps/cli/verify/migration/fromv2.d.ts +4 -0
- package/dist/apps/cli/verify/migration/fromv2.js +349 -0
- package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.js +91 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +18 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.js +30 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
- package/dist/bundles/catenv/index.js +46512 -0
- package/dist/bundles/catenv/xdg-open +1066 -0
- package/dist/bundles/cli/clipboard_i686.exe +0 -0
- package/dist/bundles/cli/clipboard_x86_64.exe +0 -0
- package/dist/bundles/cli/exec-child.js +39 -0
- package/dist/bundles/cli/index.js +363134 -0
- package/dist/bundles/cli/xdg-open +1066 -0
- package/dist/bundles/cli/xsel +0 -0
- package/dist/catenv.d.ts +1 -0
- package/dist/catenv.js +13 -0
- package/dist/catenv.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/constants.d.ts +2 -0
- package/dist/config/constants.js +6 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/getProjectConfig.d.ts +24 -0
- package/dist/config/getProjectConfig.js +313 -0
- package/dist/config/getProjectConfig.js.map +1 -0
- package/dist/config/parseChoice.d.ts +4 -0
- package/dist/config/parseChoice.js +9 -0
- package/dist/config/parseChoice.js.map +1 -0
- package/dist/gcloud/artifactsRegistry.d.ts +5 -0
- package/dist/gcloud/artifactsRegistry.js +59 -0
- package/dist/gcloud/artifactsRegistry.js.map +1 -0
- package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.d.ts +2 -0
- package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js +67 -0
- package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js.map +1 -0
- package/dist/gcloud/cloudRun/openCloudRunDashboards.d.ts +3 -0
- package/dist/gcloud/cloudRun/openCloudRunDashboards.js +62 -0
- package/dist/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -0
- package/dist/gcloud/cloudSql/startProxy.d.ts +10 -0
- package/dist/gcloud/cloudSql/startProxy.js +121 -0
- package/dist/gcloud/cloudSql/startProxy.js.map +1 -0
- package/dist/gcloud/enableServices.d.ts +3 -0
- package/dist/gcloud/enableServices.js +63 -0
- package/dist/gcloud/enableServices.js.map +1 -0
- package/dist/gcloud/openDashboard.d.ts +2 -0
- package/dist/gcloud/openDashboard.js +66 -0
- package/dist/gcloud/openDashboard.js.map +1 -0
- package/dist/gcloud/serviceAccounts.d.ts +12 -0
- package/dist/gcloud/serviceAccounts.js +144 -0
- package/dist/gcloud/serviceAccounts.js.map +1 -0
- package/dist/k8sApi/index.d.ts +8 -0
- package/dist/k8sApi/index.js +29 -0
- package/dist/k8sApi/index.js.map +1 -0
- package/dist/kubernetes/index.d.ts +3 -0
- package/dist/kubernetes/index.js +88 -0
- package/dist/kubernetes/index.js.map +1 -0
- package/dist/kubernetes/openKubernetesDashboards.d.ts +4 -0
- package/dist/kubernetes/openKubernetesDashboards.js +94 -0
- package/dist/kubernetes/openKubernetesDashboards.js.map +1 -0
- package/dist/kubernetes/portForward.d.ts +1 -0
- package/dist/kubernetes/portForward.js +55 -0
- package/dist/kubernetes/portForward.js.map +1 -0
- package/dist/packageInfos.d.ts +2 -0
- package/dist/packageInfos.js +6 -0
- package/dist/packageInfos.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/types.d.ts +18 -0
- package/dist/types/types.js +3 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils/cluster.d.ts +3 -0
- package/dist/utils/cluster.js +68 -0
- package/dist/utils/cluster.js.map +1 -0
- package/dist/utils/editAsFile.d.ts +1 -0
- package/dist/utils/editAsFile.js +85 -0
- package/dist/utils/editAsFile.js.map +1 -0
- package/dist/utils/files.d.ts +2 -0
- package/dist/utils/files.js +83 -0
- package/dist/utils/files.js.map +1 -0
- package/dist/utils/getEditor.d.ts +4 -0
- package/dist/utils/getEditor.js +70 -0
- package/dist/utils/getEditor.js.map +1 -0
- package/dist/utils/gitlab.d.ts +24 -0
- package/dist/utils/gitlab.js +397 -0
- package/dist/utils/gitlab.js.map +1 -0
- package/dist/utils/log.d.ts +1 -0
- package/dist/utils/log.js +14 -0
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/passwordstore/index.d.ts +7 -0
- package/dist/utils/passwordstore/index.js +315 -0
- package/dist/utils/passwordstore/index.js.map +1 -0
- package/dist/utils/portForwards.d.ts +12 -0
- package/dist/utils/portForwards.js +120 -0
- package/dist/utils/portForwards.js.map +1 -0
- package/dist/utils/preferences/index.d.ts +3 -0
- package/dist/utils/preferences/index.js +119 -0
- package/dist/utils/preferences/index.js.map +1 -0
- package/dist/utils/projects/index.d.ts +5 -0
- package/dist/utils/projects/index.js +103 -0
- package/dist/utils/projects/index.js.map +1 -0
- package/dist/utils/promise.d.ts +2 -0
- package/dist/utils/promise.js +62 -0
- package/dist/utils/promise.js.map +1 -0
- package/dist/utils/shell.d.ts +1 -0
- package/dist/utils/shell.js +81 -0
- package/dist/utils/shell.js.map +1 -0
- package/package.json +32 -35
- package/scripts/bundle +4 -0
- package/src/apps/catenv/catenv.ts +14 -37
- package/src/apps/catenv/printVariables.ts +58 -0
- package/src/apps/catenv/types.ts +6 -0
- package/src/apps/catenv/utils.ts +49 -0
- package/src/apps/catenv/writeDotEnvFiles.ts +44 -0
- package/src/apps/catenv/writeEnvDTs.ts +71 -0
- package/src/apps/{shell/shell.ts → cli/cli.ts} +13 -3
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +154 -0
- package/src/apps/cli/commands/cloudSQL/index.ts +8 -0
- package/src/apps/{shell → cli}/commands/general/index.ts +16 -52
- package/src/apps/{shell → cli}/commands/general/portForward.ts +7 -6
- package/src/apps/{shell → cli}/commands/mongodb/index.ts +2 -2
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +20 -22
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +13 -11
- package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +65 -0
- package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +28 -19
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +139 -0
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +234 -0
- package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +13 -15
- package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +8 -9
- package/src/apps/cli/commands/project/commandEnvVars.ts +18 -0
- package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +4 -4
- package/src/apps/cli/commands/project/commandGetShell.ts +36 -0
- package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +3 -2
- package/src/apps/{shell/commands/project/commandInitProject.ts → cli/commands/project/commandInitProject.old.ts} +15 -7
- package/src/apps/cli/commands/project/commandListPods.ts +18 -0
- package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +18 -8
- package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
- package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +32 -0
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +28 -0
- package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
- package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +2 -2
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +10 -10
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +14 -17
- package/src/apps/cli/commands/project/commandOpenLogs.ts +21 -0
- package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +10 -8
- package/src/apps/cli/commands/project/commandPortForward.ts +86 -0
- package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +27 -0
- package/src/apps/cli/commands/project/commandSetup.ts +12 -0
- package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +13 -12
- package/src/apps/{shell → cli}/commands/project/index.ts +10 -10
- package/src/apps/cli/commands/project/setup/index.ts +44 -0
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +84 -0
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +84 -0
- package/src/apps/cli/commands/project/setup/setupContext.ts +44 -0
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +140 -0
- package/src/apps/cli/commands/project/setup/setupTopic.ts +22 -0
- package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
- package/src/apps/cli/commands/project/utils/ensureCluster.ts +42 -0
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +58 -0
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
- package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +32 -0
- package/src/apps/cli/config/writeConfig.ts +71 -0
- package/src/apps/cli/verify/index.ts +30 -0
- package/src/apps/cli/verify/migration/fromv2.ts +262 -0
- package/src/apps/cli/verify/migration/migrateSecrets.ts +47 -0
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
- package/src/catenv.ts +10 -0
- package/src/cli.ts +3 -0
- package/src/config/constants.ts +0 -3
- package/src/config/getProjectConfig.ts +200 -0
- package/src/config/parseChoice.ts +4 -0
- package/src/gcloud/artifactsRegistry.ts +16 -0
- package/src/gcloud/cloudRun/getCloudRunDomainSuffix.ts +35 -0
- package/src/gcloud/cloudRun/openCloudRunDashboards.ts +22 -0
- package/src/gcloud/cloudSql/startProxy.ts +74 -0
- package/src/gcloud/enableServices.ts +14 -0
- package/src/gcloud/openDashboard.ts +19 -0
- package/src/gcloud/serviceAccounts.ts +101 -0
- package/src/k8sApi/index.ts +22 -6
- package/src/kubernetes/index.ts +27 -0
- package/src/kubernetes/openKubernetesDashboards.ts +52 -0
- package/src/kubernetes/portForward.ts +15 -0
- package/src/types/child-process-promise.d.ts +37 -1
- package/src/types/types.ts +0 -2
- package/src/utils/cluster.ts +5 -14
- package/src/utils/editAsFile.ts +31 -0
- package/src/utils/files.ts +6 -2
- package/src/utils/gitlab.ts +263 -42
- package/src/utils/passwordstore/index.ts +6 -36
- package/src/utils/{portForward.ts → portForwards.ts} +27 -22
- package/src/utils/preferences/index.ts +6 -3
- package/src/utils/projects/index.ts +9 -149
- package/tsconfig.json +3 -7
- package/bin/catenv.sh +0 -1
- package/src/apps/shell/commands/mongodb/projectMongoPortForward.ts +0 -42
- package/src/apps/shell/commands/project/commandCloudSqlProxy.ts +0 -65
- package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
- package/src/apps/shell/commands/project/commandCopyDB.ts +0 -93
- package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
- package/src/apps/shell/commands/project/commandGetShell.ts +0 -35
- package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
- package/src/apps/shell/commands/project/commandListPods.ts +0 -21
- package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
- package/src/apps/shell/commands/project/commandOpenCostDashboard.ts +0 -29
- package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
- package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
- package/src/apps/shell/commands/project/commandOpenLogs.ts +0 -23
- package/src/apps/shell/commands/project/commandPortForward.ts +0 -45
- package/src/apps/shell/commands/project/commandVariables.ts +0 -13
- package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
- package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
- package/src/apps/shell/commands/project/utils/ensureNamespace.ts +0 -32
- package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
- package/src/apps/shell/commands/shared/index.ts +0 -31
- package/src/apps/shell/commands/theStuffThatReallyMatters/index.ts +0 -51
- package/src/config/clusters.ts +0 -45
- package/src/index.ts +0 -17
- package/src/types/git-repo-name.d.ts +0 -1
- package/src/types/yawn-yaml.d.ts +0 -1
- package/src/utils/dashboardToken.ts +0 -20
- package/src/utils/formatEnvVars.ts +0 -7
- /package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
- /package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { Context } from "@catladder/pipeline";
|
|
2
|
+
import {
|
|
3
|
+
createKubernetesCloudsqlBaseValues,
|
|
4
|
+
isOfDeployType,
|
|
5
|
+
} from "@catladder/pipeline";
|
|
6
|
+
import type Vorpal from "vorpal";
|
|
7
|
+
import type { CommandInstance } from "vorpal";
|
|
8
|
+
import {
|
|
9
|
+
getEnvVarsResolved,
|
|
10
|
+
getPipelineContextByChoice,
|
|
11
|
+
parseChoice,
|
|
12
|
+
} from "../../../../config/getProjectConfig";
|
|
13
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
14
|
+
import { startCloudSqlProxyInCurrentShell } from "../../../../gcloud/cloudSql/startProxy";
|
|
15
|
+
|
|
16
|
+
type ProxyInfo = {
|
|
17
|
+
instanceName: string;
|
|
18
|
+
DB_NAME: string;
|
|
19
|
+
DB_PASSWORD: string;
|
|
20
|
+
DB_USER: string;
|
|
21
|
+
};
|
|
22
|
+
export default async (vorpal: Vorpal) =>
|
|
23
|
+
vorpal
|
|
24
|
+
.command("project-cloud-sql-proxy <envComponent>", "proxy to cloud sql db")
|
|
25
|
+
.autocomplete(await envAndComponents())
|
|
26
|
+
.action(async function ({ envComponent }) {
|
|
27
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
28
|
+
if (!componentName) {
|
|
29
|
+
this.log("need componentName");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const context = await getPipelineContextByChoice(env, componentName);
|
|
34
|
+
let proxyInfo: ProxyInfo;
|
|
35
|
+
|
|
36
|
+
if (env === "review") {
|
|
37
|
+
vorpal.log(
|
|
38
|
+
"⚠️ connection string does not include mr information on review environments"
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
if (isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
|
|
42
|
+
proxyInfo = await getProxyInfoForKubernetes(this, context);
|
|
43
|
+
} else if (
|
|
44
|
+
isOfDeployType(context.componentConfig.deploy, "google-cloudrun")
|
|
45
|
+
) {
|
|
46
|
+
proxyInfo = await getProxyInfoForCloudRun(this, context);
|
|
47
|
+
} else {
|
|
48
|
+
throw new Error("unsupported environment");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// skynet-164509:europe-west6:pvl-cyclomania-review=tcp:5432
|
|
52
|
+
const { DB_PASSWORD, DB_NAME, DB_USER, instanceName } = proxyInfo;
|
|
53
|
+
const { localPort } = await this.prompt({
|
|
54
|
+
type: "number",
|
|
55
|
+
name: "localPort",
|
|
56
|
+
default: "54320",
|
|
57
|
+
message: "Local port: ",
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
this.log("");
|
|
61
|
+
this.log(`postgres-PW: ${DB_PASSWORD}`);
|
|
62
|
+
this.log("");
|
|
63
|
+
this.log("connection strings:");
|
|
64
|
+
this.log("");
|
|
65
|
+
this.log(
|
|
66
|
+
`DATABASE_URL=postgresql://${DB_USER}:${DB_PASSWORD}@localhost:${localPort}/${DB_NAME}?schema=public`
|
|
67
|
+
);
|
|
68
|
+
this.log("");
|
|
69
|
+
this.log(
|
|
70
|
+
`DATABASE_JDBC_URL=jdbc:postgresql://localhost:${localPort}/${DB_NAME}?schema=public&user=${DB_USER}&password=${DB_PASSWORD}`
|
|
71
|
+
);
|
|
72
|
+
this.log("");
|
|
73
|
+
|
|
74
|
+
await startCloudSqlProxyInCurrentShell({
|
|
75
|
+
instanceName,
|
|
76
|
+
localPort,
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const getProxyInfoForKubernetes = async (
|
|
81
|
+
vorpal: CommandInstance,
|
|
82
|
+
context: Context
|
|
83
|
+
): Promise<ProxyInfo> => {
|
|
84
|
+
if (!isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
|
|
85
|
+
throw new Error("unsupported");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const envVars = await getEnvVarsResolved(
|
|
89
|
+
vorpal,
|
|
90
|
+
context.environment.shortName,
|
|
91
|
+
context.componentName
|
|
92
|
+
);
|
|
93
|
+
// bit hacky, would be nicer if we would also declare this through env vars
|
|
94
|
+
const cloudSqlValues = createKubernetesCloudsqlBaseValues(context);
|
|
95
|
+
|
|
96
|
+
const DB_PASSWORD = envVars?.DB_PASSWORD || envVars?.POSTGRESQL_PASSWORD;
|
|
97
|
+
|
|
98
|
+
const DB_NAME = cloudSqlValues.cloudsql.fullDbName;
|
|
99
|
+
|
|
100
|
+
const instanceName = cloudSqlValues.cloudsql.instanceConnectionName;
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
instanceName,
|
|
104
|
+
DB_PASSWORD,
|
|
105
|
+
DB_NAME,
|
|
106
|
+
DB_USER: "postgres",
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const getProxyInfoForCloudRun = async (
|
|
111
|
+
vorpal: CommandInstance,
|
|
112
|
+
context: Context
|
|
113
|
+
): Promise<ProxyInfo> => {
|
|
114
|
+
if (
|
|
115
|
+
!isOfDeployType(context.componentConfig.deploy, "google-cloudrun") ||
|
|
116
|
+
!context.componentConfig.deploy.cloudSql
|
|
117
|
+
) {
|
|
118
|
+
throw new Error("unsupported");
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const envVars = await getEnvVarsResolved(
|
|
122
|
+
vorpal,
|
|
123
|
+
context.environment.shortName,
|
|
124
|
+
context.componentName
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const DB_PASSWORD = envVars?.DB_PASSWORD;
|
|
128
|
+
const DB_USER = envVars?.DB_USER;
|
|
129
|
+
|
|
130
|
+
const DB_NAME = context.environment.envVars.DB_NAME;
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
instanceName:
|
|
134
|
+
context.componentConfig.deploy.cloudSql.instanceConnectionName,
|
|
135
|
+
DB_PASSWORD,
|
|
136
|
+
DB_NAME,
|
|
137
|
+
DB_USER,
|
|
138
|
+
};
|
|
139
|
+
};
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/* eslint-disable no-constant-condition */
|
|
2
|
+
import { getSecretVarName } from "@catladder/pipeline";
|
|
3
|
+
import { stripIndents } from "common-tags";
|
|
4
|
+
import { difference } from "lodash";
|
|
5
|
+
import type { CommandInstance } from "vorpal";
|
|
6
|
+
import type Vorpal from "vorpal";
|
|
7
|
+
import {
|
|
8
|
+
getAllComponentsWithAllEnvsHierarchical,
|
|
9
|
+
getEnvironment,
|
|
10
|
+
getEnvVarsResolved,
|
|
11
|
+
getJobOnlyEnvVarsResolved,
|
|
12
|
+
getProjectComponents,
|
|
13
|
+
parseChoice,
|
|
14
|
+
} from "../../../../config/getProjectConfig";
|
|
15
|
+
import { editAsFile } from "../../../../utils/editAsFile";
|
|
16
|
+
import { upsertAllVariables } from "../../../../utils/gitlab";
|
|
17
|
+
import { delay } from "../../../../utils/promise";
|
|
18
|
+
import { allEnvsAndAllComponents } from "./utils/autocompletions";
|
|
19
|
+
|
|
20
|
+
type Vars = {
|
|
21
|
+
[env: string]: {
|
|
22
|
+
[componentName: string]: Record<string, string>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/* for convenience, parse json objects. that makes it easier to edit secrets that are object */
|
|
26
|
+
const resolveJson = (v: Vars) =>
|
|
27
|
+
Object.fromEntries(
|
|
28
|
+
Object.entries(v).map(([componentName, envs]) => {
|
|
29
|
+
return [
|
|
30
|
+
componentName,
|
|
31
|
+
Object.fromEntries(
|
|
32
|
+
Object.entries(envs).map(([env, secrets]) => [
|
|
33
|
+
env,
|
|
34
|
+
Object.fromEntries(
|
|
35
|
+
Object.entries(secrets).map(([key, value]) => {
|
|
36
|
+
try {
|
|
37
|
+
return [key, JSON.parse(value)];
|
|
38
|
+
} catch (e) {
|
|
39
|
+
return [key, value];
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
),
|
|
43
|
+
])
|
|
44
|
+
),
|
|
45
|
+
];
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const getSecretEnvVarKeysToConfigure = async (
|
|
50
|
+
env: string,
|
|
51
|
+
componentName: string
|
|
52
|
+
) => {
|
|
53
|
+
const { secretEnvVarKeys, jobOnlyVars } = await getEnvironment(
|
|
54
|
+
env,
|
|
55
|
+
componentName
|
|
56
|
+
);
|
|
57
|
+
return [
|
|
58
|
+
...jobOnlyVars.build.secretEnvVarKeys,
|
|
59
|
+
...jobOnlyVars.deploy.secretEnvVarKeys,
|
|
60
|
+
...secretEnvVarKeys,
|
|
61
|
+
]
|
|
62
|
+
.filter((k) => !k.hidden)
|
|
63
|
+
.map((k) => k.key);
|
|
64
|
+
};
|
|
65
|
+
const getEnvVarsToEdit = async (
|
|
66
|
+
instance: CommandInstance,
|
|
67
|
+
env: string,
|
|
68
|
+
componentName: string
|
|
69
|
+
) => {
|
|
70
|
+
const secretEnvVarKeys = await getSecretEnvVarKeysToConfigure(
|
|
71
|
+
env,
|
|
72
|
+
componentName
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const normalEnvVars = await getEnvVarsResolved(instance, env, componentName);
|
|
76
|
+
const jobOnlyEnvVars = await getJobOnlyEnvVarsResolved(
|
|
77
|
+
instance,
|
|
78
|
+
env,
|
|
79
|
+
componentName
|
|
80
|
+
);
|
|
81
|
+
const allEnvVars = {
|
|
82
|
+
...normalEnvVars,
|
|
83
|
+
...jobOnlyEnvVars,
|
|
84
|
+
};
|
|
85
|
+
return Object.fromEntries(
|
|
86
|
+
secretEnvVarKeys.map((key) => {
|
|
87
|
+
const value = allEnvVars[key];
|
|
88
|
+
// due to some quirky way to resolve these variables, unset variables have the $CL_ prefix, so we remove thouse here
|
|
89
|
+
const variableIsNotSet =
|
|
90
|
+
value === "$" + getSecretVarName(env, componentName, key);
|
|
91
|
+
return [key, variableIsNotSet ? "🚨 FILL ME" : value];
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
const doItFor = async (
|
|
96
|
+
instance: CommandInstance,
|
|
97
|
+
envAndComponents: {
|
|
98
|
+
[componentName: string]: string[];
|
|
99
|
+
}
|
|
100
|
+
) => {
|
|
101
|
+
let valuesToEdit: Vars = Object.fromEntries(
|
|
102
|
+
await Promise.all(
|
|
103
|
+
Object.entries(envAndComponents).map(async ([componentName, envs]) => [
|
|
104
|
+
componentName,
|
|
105
|
+
Object.fromEntries(
|
|
106
|
+
await Promise.all(
|
|
107
|
+
envs.map(async (env) => [
|
|
108
|
+
env,
|
|
109
|
+
await getEnvVarsToEdit(instance, env, componentName),
|
|
110
|
+
])
|
|
111
|
+
)
|
|
112
|
+
),
|
|
113
|
+
])
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
let hasErrors = true;
|
|
117
|
+
while (hasErrors) {
|
|
118
|
+
valuesToEdit = await editAsFile(
|
|
119
|
+
resolveJson(valuesToEdit),
|
|
120
|
+
stripIndents`
|
|
121
|
+
Please fill in all secrets for:
|
|
122
|
+
|
|
123
|
+
${Object.entries(envAndComponents)
|
|
124
|
+
.map(
|
|
125
|
+
([componentName, envs]) => `- ${componentName}: ${envs.join(", ")}`
|
|
126
|
+
)
|
|
127
|
+
.join("\n")}
|
|
128
|
+
|
|
129
|
+
`
|
|
130
|
+
);
|
|
131
|
+
// check for errors
|
|
132
|
+
hasErrors = false;
|
|
133
|
+
for (const [componentName, envs] of Object.entries(envAndComponents)) {
|
|
134
|
+
for (const env of envs) {
|
|
135
|
+
const usedKeys = valuesToEdit[componentName][env]
|
|
136
|
+
? Object.keys(valuesToEdit[componentName][env])
|
|
137
|
+
: [];
|
|
138
|
+
// check whether newValues have the exact number of keys
|
|
139
|
+
const secretEnvVarKeys = await getSecretEnvVarKeysToConfigure(
|
|
140
|
+
env,
|
|
141
|
+
componentName
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const extranous = difference(usedKeys, secretEnvVarKeys);
|
|
145
|
+
const missing = difference(secretEnvVarKeys, usedKeys);
|
|
146
|
+
|
|
147
|
+
if (extranous.length > 0 || missing.length > 0) {
|
|
148
|
+
instance.log("");
|
|
149
|
+
instance.log(
|
|
150
|
+
`😿 Oh no! There is something wrong with "${componentName}"`
|
|
151
|
+
);
|
|
152
|
+
instance.log("");
|
|
153
|
+
if (extranous.length > 0) {
|
|
154
|
+
instance.log("these secrets are not declared in the config");
|
|
155
|
+
extranous.forEach((key) => instance.log(key));
|
|
156
|
+
instance.log("");
|
|
157
|
+
}
|
|
158
|
+
if (missing.length > 0) {
|
|
159
|
+
instance.log("these secrets have not been provided:");
|
|
160
|
+
missing.forEach((key) => instance.log(key));
|
|
161
|
+
instance.log("");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
await delay(1000);
|
|
165
|
+
const { shouldContinue } = await instance.prompt({
|
|
166
|
+
default: true,
|
|
167
|
+
message: "Try again? 🤔",
|
|
168
|
+
name: "shouldContinue",
|
|
169
|
+
type: "confirm",
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
if (!shouldContinue) {
|
|
173
|
+
throw new Error("abort");
|
|
174
|
+
}
|
|
175
|
+
hasErrors = true;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
instance.log("upserting all variables, please wait...");
|
|
181
|
+
instance.log("");
|
|
182
|
+
for (const [componentName, envs] of Object.entries(envAndComponents)) {
|
|
183
|
+
for (const env of envs) {
|
|
184
|
+
await upsertAllVariables(
|
|
185
|
+
instance,
|
|
186
|
+
valuesToEdit[componentName][env],
|
|
187
|
+
env,
|
|
188
|
+
componentName
|
|
189
|
+
);
|
|
190
|
+
instance.log("");
|
|
191
|
+
instance.log("✅ " + env + ":" + componentName);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
instance.log("done! 😻");
|
|
195
|
+
instance.log("");
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export const projectConfigSecrets = async (
|
|
199
|
+
vorpal: CommandInstance,
|
|
200
|
+
envComponent?: string
|
|
201
|
+
) => {
|
|
202
|
+
if (!envComponent) {
|
|
203
|
+
const allEnvAndcomponents = await getAllComponentsWithAllEnvsHierarchical();
|
|
204
|
+
await doItFor(vorpal, allEnvAndcomponents);
|
|
205
|
+
} else {
|
|
206
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
207
|
+
|
|
208
|
+
// componentName can be null. in this case, iterate over all components
|
|
209
|
+
if (!componentName) {
|
|
210
|
+
const components = await getProjectComponents();
|
|
211
|
+
await doItFor(
|
|
212
|
+
vorpal,
|
|
213
|
+
Object.fromEntries(components.map((c) => [c, [env]]))
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
if (componentName) {
|
|
217
|
+
await doItFor(vorpal, {
|
|
218
|
+
[componentName]: [env],
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export default async (vorpal: Vorpal) => {
|
|
225
|
+
vorpal
|
|
226
|
+
.command(
|
|
227
|
+
"project-config-secrets [envComponent]",
|
|
228
|
+
"setup/update secrets stored in pass"
|
|
229
|
+
)
|
|
230
|
+
.autocomplete(await allEnvsAndAllComponents())
|
|
231
|
+
.action(async function ({ envComponent }) {
|
|
232
|
+
return await projectConfigSecrets(this, envComponent);
|
|
233
|
+
});
|
|
234
|
+
};
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import type Vorpal from "vorpal";
|
|
2
|
+
import { getk8sApi } from "../../../../k8sApi";
|
|
3
|
+
import { getProjectPodNames } from "../../../../kubernetes";
|
|
4
4
|
|
|
5
5
|
import { logError } from "../../../../utils/log";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
getProjectPodNames,
|
|
9
|
-
} from "../../../../utils/projects";
|
|
10
|
-
import { envAutocompletion } from "./utils/autocompletions";
|
|
6
|
+
import { getProjectNamespace } from "../../../../utils/projects";
|
|
7
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
11
8
|
import ensureCluster from "./utils/ensureCluster";
|
|
12
9
|
|
|
13
|
-
export default (vorpal: Vorpal) =>
|
|
10
|
+
export default async (vorpal: Vorpal) =>
|
|
14
11
|
vorpal
|
|
15
|
-
.command("project-delete-pods <
|
|
16
|
-
.autocomplete(
|
|
17
|
-
.action(async function ({
|
|
18
|
-
await ensureCluster.call(this);
|
|
19
|
-
const namespace = await getProjectNamespace(
|
|
20
|
-
const podNames = await getProjectPodNames(
|
|
12
|
+
.command("project-delete-pods <envComponent>", "delete / restart pods")
|
|
13
|
+
.autocomplete(await envAndComponents())
|
|
14
|
+
.action(async function ({ envComponent }) {
|
|
15
|
+
await ensureCluster.call(this, envComponent);
|
|
16
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
17
|
+
const podNames = await getProjectPodNames(envComponent);
|
|
21
18
|
if (podNames.length === 0) {
|
|
22
19
|
logError(this, "sorry, no pods found");
|
|
23
20
|
return;
|
|
@@ -41,6 +38,7 @@ export default (vorpal: Vorpal) =>
|
|
|
41
38
|
message: "Continue ? 🤔 ",
|
|
42
39
|
});
|
|
43
40
|
this.log("");
|
|
41
|
+
const k8sApi = getk8sApi();
|
|
44
42
|
if (shouldContinue) {
|
|
45
43
|
for (const podName of selectedPodNames) {
|
|
46
44
|
await k8sApi.deleteNamespacedPod(podName, namespace, "true");
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import Vorpal from "vorpal";
|
|
2
|
-
import { exec
|
|
3
|
-
import { Env } from "../../../../types/types";
|
|
1
|
+
import type Vorpal from "vorpal";
|
|
2
|
+
import { exec } from "child-process-promise";
|
|
4
3
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
5
|
-
import {
|
|
4
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
6
5
|
|
|
7
|
-
export default (vorpal: Vorpal) =>
|
|
6
|
+
export default async (vorpal: Vorpal) =>
|
|
8
7
|
vorpal
|
|
9
8
|
.command(
|
|
10
|
-
"project-delete <
|
|
9
|
+
"project-delete <envComponent>",
|
|
11
10
|
"deletes a environment of a project (it deletes the namespace)"
|
|
12
11
|
)
|
|
13
|
-
.autocomplete(
|
|
14
|
-
.action(async function ({
|
|
15
|
-
const namespace = await getProjectNamespace(
|
|
12
|
+
.autocomplete(await envAndComponents())
|
|
13
|
+
.action(async function ({ envComponent }) {
|
|
14
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
16
15
|
const { shouldContinue } = await this.prompt({
|
|
17
16
|
type: "confirm",
|
|
18
17
|
name: "shouldContinue",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type Vorpal from "vorpal";
|
|
2
|
+
import {
|
|
3
|
+
getEnvVarsResolved,
|
|
4
|
+
parseChoice,
|
|
5
|
+
} from "../../../../config/getProjectConfig";
|
|
6
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
7
|
+
|
|
8
|
+
export default async (vorpal: Vorpal) =>
|
|
9
|
+
vorpal
|
|
10
|
+
.command("project-env-vars <envComponent>", "list env vars")
|
|
11
|
+
.autocomplete(await envAndComponents())
|
|
12
|
+
.action(async function ({ envComponent }) {
|
|
13
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
14
|
+
const envvars = await getEnvVarsResolved(this, env, componentName);
|
|
15
|
+
Object.keys(envvars).forEach((key) =>
|
|
16
|
+
this.log(`${key}: ${envvars[key]}`)
|
|
17
|
+
);
|
|
18
|
+
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { spawn } from "child-process-promise";
|
|
2
|
-
import Vorpal from "vorpal";
|
|
2
|
+
import type 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",
|
|
8
8
|
"show the total worktime that you spent on a project"
|
|
9
9
|
)
|
|
10
10
|
.action(async () => {
|
|
11
|
-
await spawn("sh", ["-c", "curl -L http://bit.ly/
|
|
12
|
-
stdio: ["pipe", "inherit", "pipe"]
|
|
11
|
+
await spawn("sh", ["-c", "curl -s -L http://bit.ly/3VQEKNq | bash"], {
|
|
12
|
+
stdio: ["pipe", "inherit", "pipe"],
|
|
13
13
|
});
|
|
14
14
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type Vorpal from "vorpal";
|
|
2
|
+
import { getProjectPods } from "../../../../kubernetes";
|
|
3
|
+
import { logError } from "../../../../utils/log";
|
|
4
|
+
import { getProjectNamespace } from "../../../../utils/projects";
|
|
5
|
+
import { getShell } from "../../../../utils/shell";
|
|
6
|
+
|
|
7
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
8
|
+
import ensureCluster from "./utils/ensureCluster";
|
|
9
|
+
|
|
10
|
+
export default async (vorpal: Vorpal) =>
|
|
11
|
+
vorpal
|
|
12
|
+
.command(
|
|
13
|
+
"project-get-shell <envComponent>",
|
|
14
|
+
"get a shell to a pod in the environment"
|
|
15
|
+
)
|
|
16
|
+
.autocomplete(await envAndComponents())
|
|
17
|
+
.action(async function ({ envComponent }) {
|
|
18
|
+
await ensureCluster.call(this, envComponent);
|
|
19
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
20
|
+
const pods = await getProjectPods(envComponent);
|
|
21
|
+
const runningPodNames = pods
|
|
22
|
+
.filter((p) => p.status.phase == "Running")
|
|
23
|
+
.map((r) => r.metadata.name);
|
|
24
|
+
if (runningPodNames.length === 0) {
|
|
25
|
+
logError(this, "sorry, no running pods found");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const { podName } = await this.prompt({
|
|
29
|
+
type: "list",
|
|
30
|
+
name: "podName",
|
|
31
|
+
choices: runningPodNames,
|
|
32
|
+
message: "Which pod? 🤔",
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return getShell(namespace, podName);
|
|
36
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { exec } from "child-process-promise";
|
|
2
2
|
import { last } from "lodash";
|
|
3
3
|
import open from "open";
|
|
4
|
-
import
|
|
4
|
+
import type { CommandInstance } from "vorpal";
|
|
5
|
+
import type Vorpal from "vorpal";
|
|
5
6
|
import {
|
|
6
7
|
doGitlabRequest,
|
|
7
8
|
getGitlabToken,
|
|
@@ -64,7 +65,7 @@ const promptJob = async (vorpal: CommandInstance, projectId: any, ctx: any) => {
|
|
|
64
65
|
return jobs.find((j: any) => j.id === jobId);
|
|
65
66
|
};
|
|
66
67
|
|
|
67
|
-
export default (vorpal: Vorpal) => {
|
|
68
|
+
export default async (vorpal: Vorpal) => {
|
|
68
69
|
vorpal.command("project-ci-job-open", "Open a Job").action(async function () {
|
|
69
70
|
const { id: projectId } = await getProjectInfo(this);
|
|
70
71
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFile, writeFile } from "fs-extra";
|
|
2
|
-
import {
|
|
2
|
+
import { dump } from "js-yaml";
|
|
3
3
|
import { mapKeys, snakeCase, toUpper } from "lodash";
|
|
4
4
|
import path from "path";
|
|
5
|
-
import Vorpal from "vorpal";
|
|
5
|
+
import type Vorpal from "vorpal";
|
|
6
6
|
import { hasGitlabCiFile } from "../../../../utils/projects";
|
|
7
7
|
|
|
8
8
|
const transformVar = (key: string) => toUpper(snakeCase(key));
|
|
@@ -29,7 +29,7 @@ const DEFAULT_VARIABLES = {
|
|
|
29
29
|
clusterName: "production",
|
|
30
30
|
};
|
|
31
31
|
// TODO: we should find a way how to fetch the variables of the inclues directly from gitlab
|
|
32
|
-
const
|
|
32
|
+
const DEFAULT_NODE_asdfAPPLICATION = {};
|
|
33
33
|
|
|
34
34
|
const DEFAULT_FILES_TO_CREATE: FileToCreate[] = [
|
|
35
35
|
{
|
|
@@ -38,6 +38,9 @@ const DEFAULT_FILES_TO_CREATE: FileToCreate[] = [
|
|
|
38
38
|
readFile(path.resolve(__dirname, "../includes/envrc"), "utf8"),
|
|
39
39
|
},
|
|
40
40
|
];
|
|
41
|
+
/*
|
|
42
|
+
|
|
43
|
+
TODO: reimplement as PRESETS ?
|
|
41
44
|
const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
|
|
42
45
|
nextJS: {
|
|
43
46
|
variables: {},
|
|
@@ -154,7 +157,7 @@ const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
|
|
|
154
157
|
{
|
|
155
158
|
filename: "values-review.yml",
|
|
156
159
|
content: async () =>
|
|
157
|
-
|
|
160
|
+
dump({
|
|
158
161
|
jobs: {
|
|
159
162
|
"db-prepare-seed": {
|
|
160
163
|
hook: "post-install",
|
|
@@ -180,10 +183,15 @@ const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
|
|
|
180
183
|
values: {},
|
|
181
184
|
},
|
|
182
185
|
};
|
|
183
|
-
|
|
186
|
+
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
const PLATFORMS: any = {};
|
|
190
|
+
export default async (vorpal: Vorpal) =>
|
|
184
191
|
vorpal
|
|
185
192
|
.command("project-init", "Inits a new project")
|
|
186
193
|
.action(async function () {
|
|
194
|
+
throw new Error("needs reimplementation");
|
|
187
195
|
const hasGitlabFile = await hasGitlabCiFile();
|
|
188
196
|
if (hasGitlabFile) {
|
|
189
197
|
this.log("there is already a gitlab-ci.yml file. Skipping");
|
|
@@ -251,7 +259,7 @@ export default (vorpal: Vorpal) =>
|
|
|
251
259
|
variables: transformedVariables,
|
|
252
260
|
};
|
|
253
261
|
|
|
254
|
-
const gitlabCiContent =
|
|
262
|
+
const gitlabCiContent = dump(gitlabCiContentObj);
|
|
255
263
|
await writeFile(".gitlab-ci.yml", gitlabCiContent);
|
|
256
264
|
|
|
257
265
|
allFilesToCreate.forEach(async ({ filename, content }) => {
|
|
@@ -260,7 +268,7 @@ export default (vorpal: Vorpal) =>
|
|
|
260
268
|
await writeFile(filename, theContent);
|
|
261
269
|
});
|
|
262
270
|
|
|
263
|
-
await writeFile("values.yml",
|
|
271
|
+
await writeFile("values.yml", dump(values));
|
|
264
272
|
|
|
265
273
|
this.log("");
|
|
266
274
|
this.log("gitlab-ci created! 💪😻");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { dump } from "js-yaml";
|
|
2
|
+
import { pick } from "lodash";
|
|
3
|
+
import type Vorpal from "vorpal";
|
|
4
|
+
import { getProjectPods } from "../../../../kubernetes";
|
|
5
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
6
|
+
import ensureCluster from "./utils/ensureCluster";
|
|
7
|
+
|
|
8
|
+
export default async (vorpal: Vorpal) =>
|
|
9
|
+
vorpal
|
|
10
|
+
.command("project-list-pods <envComponent>", "list pods of local project")
|
|
11
|
+
.autocomplete(await envAndComponents())
|
|
12
|
+
.action(async function ({ envComponent }) {
|
|
13
|
+
await ensureCluster.call(this, envComponent);
|
|
14
|
+
const pods = await getProjectPods(envComponent);
|
|
15
|
+
this.log(
|
|
16
|
+
dump(pods.map((p) => pick(p, ["metadata.name", "status.startTime"])))
|
|
17
|
+
);
|
|
18
|
+
});
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { exec } from "child-process-promise";
|
|
2
|
-
import Vorpal from "vorpal";
|
|
2
|
+
import type Vorpal from "vorpal";
|
|
3
|
+
import {
|
|
4
|
+
getEnvironment,
|
|
5
|
+
parseChoice,
|
|
6
|
+
} from "../../../../config/getProjectConfig";
|
|
3
7
|
import { logError } from "../../../../utils/log";
|
|
4
|
-
|
|
5
|
-
import {
|
|
8
|
+
|
|
9
|
+
import { envAndComponents } from "./utils/autocompletions";
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Error: rendered manifests contain a resource that already exists.
|
|
9
13
|
* Unable to continue with install: ConfigMap "web-app-env" in namespace "pvl-bike2school-dev" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "pvl-bike2school-dev-web"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "pvl-bike2school-dev"
|
|
10
14
|
*/
|
|
11
|
-
export default (vorpal: Vorpal) =>
|
|
15
|
+
export default async (vorpal: Vorpal) =>
|
|
12
16
|
vorpal
|
|
13
17
|
.command(
|
|
14
|
-
"project-migrate-helm3 <
|
|
18
|
+
"project-migrate-helm3 <envComponent>",
|
|
15
19
|
"Do manual step for helm2 to helm3 migration"
|
|
16
20
|
)
|
|
17
21
|
.autocomplete(
|
|
18
|
-
|
|
22
|
+
(await envAndComponents()).filter(
|
|
23
|
+
(e) => !e.startsWith("local") && !e.startsWith("review")
|
|
24
|
+
)
|
|
19
25
|
)
|
|
20
|
-
.action(async function ({
|
|
26
|
+
.action(async function ({ envComponent }) {
|
|
21
27
|
try {
|
|
28
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
22
29
|
const result = await exec("helm version --short");
|
|
23
30
|
const version = result.stdout as string;
|
|
24
31
|
this.log(`your helm version: ${version}`);
|
|
@@ -35,7 +42,10 @@ export default (vorpal: Vorpal) =>
|
|
|
35
42
|
} catch (e) {
|
|
36
43
|
// ignore
|
|
37
44
|
}
|
|
38
|
-
|
|
45
|
+
|
|
46
|
+
// we use the app full name as the release name
|
|
47
|
+
const releaseName = (await getEnvironment(env, componentName)).fullName;
|
|
48
|
+
|
|
39
49
|
this.log(`helm release name: ${releaseName}`);
|
|
40
50
|
this.log("");
|
|
41
51
|
this.log("migrating now... 😼. This may take a moment");
|