@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
package/tsconfig.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "@tsconfig/node14/tsconfig.json",
|
|
3
2
|
"compilerOptions": {
|
|
3
|
+
"lib": ["es2021", "DOM"],
|
|
4
4
|
"module": "CommonJS",
|
|
5
5
|
"declaration": true,
|
|
6
6
|
"noImplicitAny": true,
|
|
@@ -9,12 +9,8 @@
|
|
|
9
9
|
"sourceMap": true,
|
|
10
10
|
"outDir": "dist",
|
|
11
11
|
"strict": false,
|
|
12
|
-
"baseUrl": ".",
|
|
13
12
|
"incremental": true,
|
|
14
|
-
"resolveJsonModule": true
|
|
15
|
-
"paths": {
|
|
16
|
-
"*": ["node_modules/*", "src/types/*"]
|
|
17
|
-
}
|
|
13
|
+
"resolveJsonModule": true
|
|
18
14
|
},
|
|
19
|
-
"include": ["src/**/*"]
|
|
15
|
+
"include": ["./src/**/*"]
|
|
20
16
|
}
|
package/bin/catenv.sh
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
eval $(catladder --catenv )
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import Vorpal from "vorpal";
|
|
2
|
-
import { logError } from "../../../../utils/log";
|
|
3
|
-
import { startPortForward } from "../../../../utils/portForward";
|
|
4
|
-
import { getProjectNamespace } from "../../../../utils/projects";
|
|
5
|
-
import { envAutocompletion } from "../project/utils/autocompletions";
|
|
6
|
-
import ensureCluster from "../project/utils/ensureCluster";
|
|
7
|
-
import { getProjectMongodbAllPodsSortedWithLabel } from "./utils";
|
|
8
|
-
|
|
9
|
-
export default (vorpal: Vorpal) =>
|
|
10
|
-
vorpal
|
|
11
|
-
.command("project-mongo-port-forward <env>", "port foward to a mongodb")
|
|
12
|
-
.autocomplete(envAutocompletion)
|
|
13
|
-
.action(async function ({ env }) {
|
|
14
|
-
await ensureCluster.call(this);
|
|
15
|
-
const namespace = await getProjectNamespace(env);
|
|
16
|
-
const podNames = await getProjectMongodbAllPodsSortedWithLabel(env);
|
|
17
|
-
if (podNames.length === 0) {
|
|
18
|
-
logError(this, "sorry, no pods found");
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
let podName;
|
|
22
|
-
if (podNames.length === 1) {
|
|
23
|
-
podName = podNames[0].value;
|
|
24
|
-
} else {
|
|
25
|
-
podName = (
|
|
26
|
-
await this.prompt({
|
|
27
|
-
type: "list",
|
|
28
|
-
name: "podName",
|
|
29
|
-
choices: podNames,
|
|
30
|
-
message: "Which pod? 🤔",
|
|
31
|
-
})
|
|
32
|
-
).podName;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const { localPort } = await this.prompt({
|
|
36
|
-
type: "number",
|
|
37
|
-
name: "localPort",
|
|
38
|
-
default: "30000",
|
|
39
|
-
message: "Local port: ",
|
|
40
|
-
});
|
|
41
|
-
return startPortForward(podName, localPort, 27017, namespace);
|
|
42
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { spawn } from "child-process-promise";
|
|
2
|
-
import { writeFile } from "fs-extra";
|
|
3
|
-
import { withFile } from "tmp-promise";
|
|
4
|
-
import Vorpal from "vorpal";
|
|
5
|
-
import {
|
|
6
|
-
GOOGLE_CLOUD_SQL_PASS_PATH,
|
|
7
|
-
GOOGLE_PROJECT,
|
|
8
|
-
} from "../../../../config/constants";
|
|
9
|
-
import { readPass } from "../../../../utils/passwordstore";
|
|
10
|
-
import {
|
|
11
|
-
getAllEnvVars,
|
|
12
|
-
getLocalProjectVariables,
|
|
13
|
-
getProjectValues,
|
|
14
|
-
} from "../../../../utils/projects";
|
|
15
|
-
import { envAutocompletion } from "./utils/autocompletions";
|
|
16
|
-
import { promptForSubAppIfAny } from "./utils/monorepo";
|
|
17
|
-
|
|
18
|
-
export default (vorpal: Vorpal) =>
|
|
19
|
-
vorpal
|
|
20
|
-
.command("project-cloud-sql-proxy <env>", "proxy to cloud sql db")
|
|
21
|
-
.autocomplete(envAutocompletion)
|
|
22
|
-
.action(async function ({ env }) {
|
|
23
|
-
const { CUSTOMER_NAME, APP_NAME } = await getLocalProjectVariables();
|
|
24
|
-
// skynet-164509:europe-west6:pvl-cyclomania-review=tcp:5432
|
|
25
|
-
|
|
26
|
-
const { localPort } = await this.prompt({
|
|
27
|
-
type: "number",
|
|
28
|
-
name: "localPort",
|
|
29
|
-
default: "54320",
|
|
30
|
-
message: "Local port: ",
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const subapp = await promptForSubAppIfAny(this);
|
|
34
|
-
const POSTGRESQL_PASSWORD = (await getAllEnvVars(env, subapp))
|
|
35
|
-
?.POSTGRESQL_PASSWORD;
|
|
36
|
-
|
|
37
|
-
const values = await getProjectValues(env, subapp);
|
|
38
|
-
this.log("");
|
|
39
|
-
this.log(`postgres-PW: ${POSTGRESQL_PASSWORD}`);
|
|
40
|
-
this.log("");
|
|
41
|
-
|
|
42
|
-
const projectId = values?.cloudsql?.projectId || GOOGLE_PROJECT;
|
|
43
|
-
|
|
44
|
-
const defaultInstanceId = `${CUSTOMER_NAME}-${APP_NAME}-${env}`;
|
|
45
|
-
const instanceId = values?.cloudsql?.instanceId || defaultInstanceId;
|
|
46
|
-
|
|
47
|
-
const defaultRegion = "europe-west6"; // currently hardcoded
|
|
48
|
-
const region = values?.cloudsql?.region || defaultRegion;
|
|
49
|
-
|
|
50
|
-
const instanceName = `${projectId}:${region}:${instanceId}=tcp:${localPort}`;
|
|
51
|
-
|
|
52
|
-
const cloudsqlCredentials = await readPass(GOOGLE_CLOUD_SQL_PASS_PATH);
|
|
53
|
-
await withFile(async ({ path: tmpFilePath }) => {
|
|
54
|
-
await writeFile(tmpFilePath, cloudsqlCredentials);
|
|
55
|
-
|
|
56
|
-
await spawn(
|
|
57
|
-
"cloud_sql_proxy",
|
|
58
|
-
["-instances", instanceName, "-credential_file", tmpFilePath],
|
|
59
|
-
{
|
|
60
|
-
stdio: "inherit",
|
|
61
|
-
shell: true,
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { V1Secret } from "@kubernetes/client-node";
|
|
2
|
-
import yaml from "js-yaml";
|
|
3
|
-
import { difference, mapValues, pick } from "lodash";
|
|
4
|
-
import Vorpal from "vorpal";
|
|
5
|
-
import { GOOGLE_CLOUD_SQL_PASS_PATH } from "../../../../config/constants";
|
|
6
|
-
import k8sApi from "../../../../k8sApi";
|
|
7
|
-
import { ISecrets } from "../../../../types/types";
|
|
8
|
-
import { logError } from "../../../../utils/log";
|
|
9
|
-
import {
|
|
10
|
-
editPass,
|
|
11
|
-
insertPass,
|
|
12
|
-
readPass,
|
|
13
|
-
readPassEnvVars,
|
|
14
|
-
syncBitwarden,
|
|
15
|
-
} from "../../../../utils/passwordstore";
|
|
16
|
-
import {
|
|
17
|
-
getAllSecretsEnvVarsMapping,
|
|
18
|
-
getPassPath,
|
|
19
|
-
getProjectNamespace,
|
|
20
|
-
} from "../../../../utils/projects";
|
|
21
|
-
import { delay } from "../../../../utils/promise";
|
|
22
|
-
import { envAutocompletion } from "./utils/autocompletions";
|
|
23
|
-
import ensureCluster from "./utils/ensureCluster";
|
|
24
|
-
import ensureNamespace from "./utils/ensureNamespace";
|
|
25
|
-
import { promptForSubAppIfAny } from "./utils/monorepo";
|
|
26
|
-
|
|
27
|
-
export default (vorpal: Vorpal) => {
|
|
28
|
-
vorpal
|
|
29
|
-
.command(
|
|
30
|
-
"project-config-secrets <env>",
|
|
31
|
-
"setup/update secrets stored in pass"
|
|
32
|
-
)
|
|
33
|
-
.autocomplete(envAutocompletion)
|
|
34
|
-
.action(async function ({ env }) {
|
|
35
|
-
await ensureCluster.call(this);
|
|
36
|
-
|
|
37
|
-
const passPath = await getPassPath(env);
|
|
38
|
-
this.log("");
|
|
39
|
-
this.log(`😼 I will now open bitwarden @ '${passPath}'`);
|
|
40
|
-
this.log("");
|
|
41
|
-
|
|
42
|
-
const subapp = await promptForSubAppIfAny(this);
|
|
43
|
-
|
|
44
|
-
const secretEnvVarsMapping = await getAllSecretsEnvVarsMapping(
|
|
45
|
-
env,
|
|
46
|
-
subapp
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
await syncBitwarden();
|
|
50
|
-
|
|
51
|
-
// check if exist and fill in details if not
|
|
52
|
-
try {
|
|
53
|
-
await readPass(passPath);
|
|
54
|
-
} catch (e) {
|
|
55
|
-
// does not exist. create it
|
|
56
|
-
await createNewEnvInPass.call(this, env, secretEnvVarsMapping);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
let envConfigInPass: any = null;
|
|
60
|
-
// eslint-disable-next-line no-constant-condition
|
|
61
|
-
while (true) {
|
|
62
|
-
let hasError = false;
|
|
63
|
-
await editPass(passPath);
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
envConfigInPass = await readPassEnvVars(passPath);
|
|
67
|
-
|
|
68
|
-
const configuredKeysInPass = Object.keys(envConfigInPass);
|
|
69
|
-
|
|
70
|
-
const allSecretEnvKeysInValues = Object.keys(secretEnvVarsMapping);
|
|
71
|
-
const keysNotInValues = difference(
|
|
72
|
-
configuredKeysInPass,
|
|
73
|
-
allSecretEnvKeysInValues
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const keysNotInPass = difference(
|
|
77
|
-
allSecretEnvKeysInValues,
|
|
78
|
-
configuredKeysInPass
|
|
79
|
-
);
|
|
80
|
-
if (keysNotInValues.length > 0) {
|
|
81
|
-
this.log("");
|
|
82
|
-
this.log(
|
|
83
|
-
`☝️ Notice: the following keys are defined in pass, but not in values: ${keysNotInValues.join(
|
|
84
|
-
", "
|
|
85
|
-
)}`
|
|
86
|
-
);
|
|
87
|
-
this.log(
|
|
88
|
-
`These values are probably from another app that uses the same namespace.`
|
|
89
|
-
);
|
|
90
|
-
this.log("");
|
|
91
|
-
}
|
|
92
|
-
if (keysNotInPass.length > 0) {
|
|
93
|
-
await logError(
|
|
94
|
-
this,
|
|
95
|
-
`the following keys are defined in the values.yaml, but not in pass: ${keysNotInPass.join(
|
|
96
|
-
", "
|
|
97
|
-
)}`
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
hasError = true;
|
|
101
|
-
}
|
|
102
|
-
} catch (e) {
|
|
103
|
-
await logError(this, "failed to parse yaml", e.message);
|
|
104
|
-
hasError = true;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (hasError) {
|
|
108
|
-
this.log("");
|
|
109
|
-
this.log("🤦 You miserably failed to provide something useful 💩");
|
|
110
|
-
this.log("");
|
|
111
|
-
await delay(1000);
|
|
112
|
-
const { shouldContinue } = await this.prompt({
|
|
113
|
-
default: true,
|
|
114
|
-
message: "Try again? 🤔",
|
|
115
|
-
name: "shouldContinue",
|
|
116
|
-
type: "confirm",
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
if (!shouldContinue) {
|
|
120
|
-
throw new Error("abort");
|
|
121
|
-
}
|
|
122
|
-
} else {
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (env !== "env-local") {
|
|
128
|
-
await ensureNamespace.call(this, env);
|
|
129
|
-
|
|
130
|
-
this.log(
|
|
131
|
-
"😼 Please be patient while i am doing some complicated stuff... "
|
|
132
|
-
);
|
|
133
|
-
const namespace = await getProjectNamespace(env);
|
|
134
|
-
|
|
135
|
-
// secrets is object of [key]: secretName
|
|
136
|
-
const grouped = Object.keys(secretEnvVarsMapping).reduce<{
|
|
137
|
-
[secretName: string]: string[];
|
|
138
|
-
}>((acc, key) => {
|
|
139
|
-
const secretName = secretEnvVarsMapping[key];
|
|
140
|
-
return {
|
|
141
|
-
...acc,
|
|
142
|
-
[secretName]: [...(acc[secretName] || []), key],
|
|
143
|
-
};
|
|
144
|
-
}, {});
|
|
145
|
-
|
|
146
|
-
for (const secretName of Object.keys(grouped)) {
|
|
147
|
-
const valueKeysInGroup = grouped[secretName];
|
|
148
|
-
const valuesFromPassInGroup = pick(envConfigInPass, valueKeysInGroup);
|
|
149
|
-
|
|
150
|
-
let existingSecretValues = {};
|
|
151
|
-
try {
|
|
152
|
-
const existingSecretResult = await k8sApi.readNamespacedSecret(
|
|
153
|
-
secretName,
|
|
154
|
-
namespace
|
|
155
|
-
);
|
|
156
|
-
// tslint:disable-next-line:no-console
|
|
157
|
-
if (existingSecretResult && existingSecretResult.body.data) {
|
|
158
|
-
existingSecretValues = existingSecretResult.body.data;
|
|
159
|
-
}
|
|
160
|
-
} catch (e) {
|
|
161
|
-
// ignore
|
|
162
|
-
}
|
|
163
|
-
await createKubernetesSecret.call(
|
|
164
|
-
this,
|
|
165
|
-
namespace,
|
|
166
|
-
secretName,
|
|
167
|
-
|
|
168
|
-
valuesFromPassInGroup,
|
|
169
|
-
existingSecretValues
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
this.log("");
|
|
173
|
-
// adding gcloud sql proxy secret
|
|
174
|
-
const cloudsqlCredentials = await readPass(GOOGLE_CLOUD_SQL_PASS_PATH);
|
|
175
|
-
await createKubernetesSecret.call(
|
|
176
|
-
this,
|
|
177
|
-
namespace,
|
|
178
|
-
"cloudsql-instance-credentials",
|
|
179
|
-
{
|
|
180
|
-
"credentials.json": cloudsqlCredentials,
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
this.log("");
|
|
184
|
-
this.log(
|
|
185
|
-
"⚠️ You need to delete/restart pods in order to make them pick up the new config"
|
|
186
|
-
);
|
|
187
|
-
this.log(`you can use project-delete-pods ${env} to do that`);
|
|
188
|
-
this.log("");
|
|
189
|
-
this.log("");
|
|
190
|
-
await delay(1000);
|
|
191
|
-
}
|
|
192
|
-
this.log("");
|
|
193
|
-
this.log("😻 success!!!!!");
|
|
194
|
-
this.log("");
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
async function createKubernetesSecret(
|
|
198
|
-
namespace: string,
|
|
199
|
-
secretName: string,
|
|
200
|
-
stringData: Pick<any, string>,
|
|
201
|
-
existingSecretValues?: Record<string, string>
|
|
202
|
-
) {
|
|
203
|
-
const secret = new V1Secret();
|
|
204
|
-
secret.metadata = {
|
|
205
|
-
name: secretName,
|
|
206
|
-
};
|
|
207
|
-
secret.data = existingSecretValues;
|
|
208
|
-
secret.stringData = stringData;
|
|
209
|
-
this.log(`😼 upserting secret '${secretName}' (push it real good!)`);
|
|
210
|
-
try {
|
|
211
|
-
await k8sApi.deleteNamespacedSecret(secretName, namespace, "true");
|
|
212
|
-
} catch (e) {
|
|
213
|
-
// ignore
|
|
214
|
-
}
|
|
215
|
-
try {
|
|
216
|
-
await k8sApi.createNamespacedSecret(namespace, secret);
|
|
217
|
-
} catch (e) {
|
|
218
|
-
logError(this, "error pushing secrets", e.body.message);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
async function createNewEnvInPass(env: any, secretEnvVarsMapping: ISecrets) {
|
|
223
|
-
const passPath = await getPassPath(env);
|
|
224
|
-
this.log(
|
|
225
|
-
"Your selected env is not yet in pass. Do you want to copy it from another env? "
|
|
226
|
-
);
|
|
227
|
-
const noAnswer = "No, I will create a new one from scratch.";
|
|
228
|
-
const { sourceEnv } = await this.prompt({
|
|
229
|
-
type: "list",
|
|
230
|
-
name: "sourceEnv",
|
|
231
|
-
choices: [...envAutocompletion.filter((e) => e !== env), noAnswer],
|
|
232
|
-
message: "Do you want to copy an env?",
|
|
233
|
-
});
|
|
234
|
-
if (sourceEnv === noAnswer) {
|
|
235
|
-
await insertPass(
|
|
236
|
-
passPath,
|
|
237
|
-
yaml.safeDump(mapValues(secretEnvVarsMapping, (value, key) => "fillme"))
|
|
238
|
-
);
|
|
239
|
-
} else {
|
|
240
|
-
const sourceEnvPath = await getPassPath(sourceEnv);
|
|
241
|
-
const stdout = await readPass(sourceEnvPath);
|
|
242
|
-
|
|
243
|
-
await insertPass(passPath, stdout);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { spawn } from "child-process-promise";
|
|
2
|
-
import Vorpal from "vorpal";
|
|
3
|
-
import {
|
|
4
|
-
GOOGLE_CLOUD_SQL_PASS_PATH,
|
|
5
|
-
GOOGLE_PROJECT,
|
|
6
|
-
} from "../../../../config/constants";
|
|
7
|
-
import { readPass } from "../../../../utils/passwordstore";
|
|
8
|
-
import {
|
|
9
|
-
getAllEnvVars,
|
|
10
|
-
getLocalProjectVariables,
|
|
11
|
-
} from "../../../../utils/projects";
|
|
12
|
-
import { envAutocompletion } from "./utils/autocompletions";
|
|
13
|
-
import { promptForSubAppIfAny } from "./utils/monorepo";
|
|
14
|
-
|
|
15
|
-
export default (vorpal: Vorpal) =>
|
|
16
|
-
vorpal
|
|
17
|
-
.command("copy-db <env>", "replace local db with the one from an env")
|
|
18
|
-
.autocomplete(envAutocompletion)
|
|
19
|
-
.action(async function copyDB({ env }) {
|
|
20
|
-
const {
|
|
21
|
-
CUSTOMER_NAME,
|
|
22
|
-
APP_NAME,
|
|
23
|
-
COMPONENT_NAME = "web",
|
|
24
|
-
} = await getLocalProjectVariables();
|
|
25
|
-
|
|
26
|
-
const { shouldContinue } = await this.prompt({
|
|
27
|
-
type: "confirm",
|
|
28
|
-
name: "shouldContinue",
|
|
29
|
-
message:
|
|
30
|
-
"This will drop your local database and replace it with the remote one. Continue? 🤔 ",
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
if (!shouldContinue) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const subapp = await promptForSubAppIfAny(this);
|
|
38
|
-
|
|
39
|
-
const GOOGLE_CLOUD_SQL_REGION = "europe-west6"; // currently hardcoded
|
|
40
|
-
const POSTGRESQL_PASSWORD = (await getAllEnvVars(env, subapp))
|
|
41
|
-
?.POSTGRESQL_PASSWORD;
|
|
42
|
-
|
|
43
|
-
const LOCAL_PORT = 54321;
|
|
44
|
-
|
|
45
|
-
const instanceName = `${GOOGLE_PROJECT}:${GOOGLE_CLOUD_SQL_REGION}:${CUSTOMER_NAME}-${APP_NAME}-${env}=tcp:${LOCAL_PORT}`;
|
|
46
|
-
const cloudsqlCredentials = await readPass(GOOGLE_CLOUD_SQL_PASS_PATH);
|
|
47
|
-
|
|
48
|
-
const { POSTGRESQL_URL } = process.env;
|
|
49
|
-
const matches = new RegExp(/\w+:\/\/.*@.*\/(\w*)()/g).exec(
|
|
50
|
-
POSTGRESQL_URL
|
|
51
|
-
);
|
|
52
|
-
if (!matches) {
|
|
53
|
-
throw new Error("Could not determine db name.");
|
|
54
|
-
}
|
|
55
|
-
const localDBName = matches[1];
|
|
56
|
-
|
|
57
|
-
const copyDBScript = `
|
|
58
|
-
set -e
|
|
59
|
-
credtmp=$(mktemp /tmp/cred.XXXXXX)
|
|
60
|
-
echo '${cloudsqlCredentials}' > $credtmp
|
|
61
|
-
echo "Opening connection..."
|
|
62
|
-
cloud_sql_proxy -instances ${instanceName} -credential_file $credtmp &> /dev/null &
|
|
63
|
-
PROXY_PID=$!
|
|
64
|
-
|
|
65
|
-
echo -n "Waiting for proxy"
|
|
66
|
-
until echo > /dev/tcp/localhost/${LOCAL_PORT}; do
|
|
67
|
-
sleep 0.2
|
|
68
|
-
echo -n "."
|
|
69
|
-
done 2>/dev/null
|
|
70
|
-
echo
|
|
71
|
-
|
|
72
|
-
dumptmp=$(mktemp /tmp/dump.XXXXXX)
|
|
73
|
-
|
|
74
|
-
echo "Dumping file to $dumptmp"
|
|
75
|
-
pg_dump --dbname=postgres://postgres:${POSTGRESQL_PASSWORD}@localhost:${LOCAL_PORT}/${
|
|
76
|
-
subapp ?? COMPONENT_NAME
|
|
77
|
-
} --no-owner --no-privileges > $dumptmp
|
|
78
|
-
psql -q -c "drop database ${localDBName}" 1> /dev/null
|
|
79
|
-
psql -q -c "create database ${localDBName}" 1> /dev/null
|
|
80
|
-
echo "Restoring dump..."
|
|
81
|
-
psql -q ${localDBName} < $dumptmp 1> /dev/null
|
|
82
|
-
|
|
83
|
-
echo "Clean up..."
|
|
84
|
-
set +e
|
|
85
|
-
kill -9 $PROXY_PID
|
|
86
|
-
wait $PROXY_PID 2> /dev/null
|
|
87
|
-
rm $credtmp
|
|
88
|
-
rm $dumptmp
|
|
89
|
-
echo "\n🐱 Done!"
|
|
90
|
-
`;
|
|
91
|
-
|
|
92
|
-
await spawn(copyDBScript, [], { shell: "bash", stdio: "inherit" });
|
|
93
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import Vorpal from "vorpal";
|
|
2
|
-
import { getAllEnvVars } from "../../../../utils/projects";
|
|
3
|
-
import { envAutocompletion } from "./utils/autocompletions";
|
|
4
|
-
import { promptForSubAppIfAny } from "./utils/monorepo";
|
|
5
|
-
|
|
6
|
-
export default (vorpal: Vorpal) =>
|
|
7
|
-
vorpal
|
|
8
|
-
.command("project-env-vars <env>", "list env vars")
|
|
9
|
-
.autocomplete(envAutocompletion)
|
|
10
|
-
.action(async function ({ env }) {
|
|
11
|
-
const subApp = await promptForSubAppIfAny(this);
|
|
12
|
-
|
|
13
|
-
const envvars = await getAllEnvVars(env, subApp);
|
|
14
|
-
Object.keys(envvars).forEach((key) =>
|
|
15
|
-
this.log(`${key}: ${envvars[key]}`)
|
|
16
|
-
);
|
|
17
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import Vorpal from "vorpal";
|
|
2
|
-
import { logError } from "../../../../utils/log";
|
|
3
|
-
import {
|
|
4
|
-
getProjectNamespace,
|
|
5
|
-
getProjectPodNames
|
|
6
|
-
} from "../../../../utils/projects";
|
|
7
|
-
import { getShell } from "../../../../utils/shell";
|
|
8
|
-
|
|
9
|
-
import { envAutocompletion } from "./utils/autocompletions";
|
|
10
|
-
import ensureCluster from "./utils/ensureCluster";
|
|
11
|
-
|
|
12
|
-
export default (vorpal: Vorpal) =>
|
|
13
|
-
vorpal
|
|
14
|
-
.command(
|
|
15
|
-
"project-get-shell <env>",
|
|
16
|
-
"get a shell to a pod in the environment"
|
|
17
|
-
)
|
|
18
|
-
.autocomplete(envAutocompletion)
|
|
19
|
-
.action(async function({ env }) {
|
|
20
|
-
await ensureCluster.call(this);
|
|
21
|
-
const namespace = await getProjectNamespace(env);
|
|
22
|
-
const podNames = await getProjectPodNames(env);
|
|
23
|
-
if (podNames.length === 0) {
|
|
24
|
-
logError(this, "sorry, no pods found");
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const { podName } = await this.prompt({
|
|
28
|
-
type: "list",
|
|
29
|
-
name: "podName",
|
|
30
|
-
choices: podNames,
|
|
31
|
-
message: "Which pod? 🤔"
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return getShell(namespace, podName);
|
|
35
|
-
});
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import open from "open";
|
|
2
|
-
import Vorpal from "vorpal";
|
|
3
|
-
import { getClusterByName } from "../../../../utils/cluster";
|
|
4
|
-
import { doGitlabRequest, getProjectInfo } from "../../../../utils/gitlab";
|
|
5
|
-
import { readPass, syncBitwarden } from "../../../../utils/passwordstore/";
|
|
6
|
-
import {
|
|
7
|
-
getLocalProjectVariables,
|
|
8
|
-
getProjectNamespace,
|
|
9
|
-
} from "../../../../utils/projects";
|
|
10
|
-
|
|
11
|
-
export default (vorpal: Vorpal) =>
|
|
12
|
-
vorpal
|
|
13
|
-
.command(
|
|
14
|
-
"project-init-gitlab",
|
|
15
|
-
"Initializes the gitlab repo, e.g. connects the cluster to it"
|
|
16
|
-
)
|
|
17
|
-
.action(async function () {
|
|
18
|
-
const { id: projectId, web_url: projectWebUrl } = await getProjectInfo(
|
|
19
|
-
this
|
|
20
|
-
);
|
|
21
|
-
await syncBitwarden();
|
|
22
|
-
const clusters = await doGitlabRequest(
|
|
23
|
-
this,
|
|
24
|
-
`projects/${projectId}/clusters`
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
if (clusters.length === 0) {
|
|
28
|
-
this.log("");
|
|
29
|
-
this.log("there is no cluster on the current project?");
|
|
30
|
-
} else {
|
|
31
|
-
this.log("there are already these clusters on the gitlab: ");
|
|
32
|
-
this.log("");
|
|
33
|
-
clusters.forEach((cluster: any) => this.log(` - ${cluster.name}`));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
this.log("");
|
|
37
|
-
this.log("your project specifies the following cluster:");
|
|
38
|
-
this.log("");
|
|
39
|
-
const { CLUSTER_NAME } = await getLocalProjectVariables();
|
|
40
|
-
const configuredCluster = await getClusterByName(CLUSTER_NAME);
|
|
41
|
-
if (!configuredCluster) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
`there exist no cluster with the name '${CLUSTER_NAME}'`
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
this.log(`${CLUSTER_NAME} (${configuredCluster.fullName})`);
|
|
47
|
-
this.log("");
|
|
48
|
-
const { shouldContinue } = await this.prompt({
|
|
49
|
-
type: "confirm",
|
|
50
|
-
name: "shouldContinue",
|
|
51
|
-
message: "Should I add the this cluster ? 🤔 ",
|
|
52
|
-
});
|
|
53
|
-
this.log("");
|
|
54
|
-
if (shouldContinue) {
|
|
55
|
-
const { api_url, passCredentials } = configuredCluster;
|
|
56
|
-
if (!api_url) {
|
|
57
|
-
throw new Error("no api_url on this cluster!");
|
|
58
|
-
}
|
|
59
|
-
if (!passCredentials) {
|
|
60
|
-
throw new Error("no passCredentials on this cluster!");
|
|
61
|
-
}
|
|
62
|
-
const token = await readPass(passCredentials.token);
|
|
63
|
-
const ca_cert = await readPass(passCredentials.ca_cert);
|
|
64
|
-
|
|
65
|
-
const postResult = await doGitlabRequest(
|
|
66
|
-
this,
|
|
67
|
-
`projects/${projectId}/clusters/user`,
|
|
68
|
-
{
|
|
69
|
-
name: configuredCluster.fullName,
|
|
70
|
-
managed: false,
|
|
71
|
-
platform_kubernetes_attributes: {
|
|
72
|
-
api_url,
|
|
73
|
-
ca_cert,
|
|
74
|
-
token,
|
|
75
|
-
namespace: await getProjectNamespace("prod"),
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
const { message } = postResult;
|
|
80
|
-
if (message) {
|
|
81
|
-
this.log(`Message from gitlab: ${message}`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const variables = await doGitlabRequest(
|
|
86
|
-
this,
|
|
87
|
-
`projects/${projectId}/variables`
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
if (!variables.find((v: any) => v.key === "GL_TOKEN")) {
|
|
91
|
-
this.log(
|
|
92
|
-
"I need add a GL_TOKEN to the project, so that semantic release will work\n"
|
|
93
|
-
);
|
|
94
|
-
this.log(
|
|
95
|
-
"👉 Please please create a project access token in gitlab and copy its value into clipboard\n\n - name: something like 'semantic-release'\n - expires: leave empty\n - scopes: api, read_repository"
|
|
96
|
-
);
|
|
97
|
-
this.log("\n");
|
|
98
|
-
|
|
99
|
-
const { understood } = await this.prompt({
|
|
100
|
-
default: true,
|
|
101
|
-
message: "Understood and open gitlab now? 🤔",
|
|
102
|
-
name: "understood",
|
|
103
|
-
type: "confirm",
|
|
104
|
-
});
|
|
105
|
-
if (!understood) {
|
|
106
|
-
this.log("continuing anyway...");
|
|
107
|
-
}
|
|
108
|
-
open(`${projectWebUrl}/-/settings/access_tokens`);
|
|
109
|
-
|
|
110
|
-
this.log("\n");
|
|
111
|
-
|
|
112
|
-
this.log("Enter your copied token now: ");
|
|
113
|
-
|
|
114
|
-
this.log("\n");
|
|
115
|
-
const { GL_TOKEN } = await this.prompt({
|
|
116
|
-
type: "password",
|
|
117
|
-
name: "GL_TOKEN",
|
|
118
|
-
message: "Access Token: ",
|
|
119
|
-
});
|
|
120
|
-
await doGitlabRequest(this, `projects/${projectId}/variables`, {
|
|
121
|
-
key: "GL_TOKEN",
|
|
122
|
-
value: GL_TOKEN,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const deploy_tokens = await doGitlabRequest(
|
|
127
|
-
this,
|
|
128
|
-
`projects/${projectId}/deploy_tokens`
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
if (
|
|
132
|
-
!deploy_tokens.find(
|
|
133
|
-
(v: { name: string }) => v.name === "gitlab-deploy-token"
|
|
134
|
-
)
|
|
135
|
-
) {
|
|
136
|
-
this.log(
|
|
137
|
-
"I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project."
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
await doGitlabRequest(this, `projects/${projectId}/deploy_tokens`, {
|
|
141
|
-
id: projectId,
|
|
142
|
-
name: "gitlab-deploy-token",
|
|
143
|
-
scopes: ["read_registry"],
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
this.log("gitlab is ready! 🥂");
|
|
147
|
-
this.log("\n");
|
|
148
|
-
this.log("do not forget to make sure that:");
|
|
149
|
-
[
|
|
150
|
-
"you have __health route in place",
|
|
151
|
-
"lint and test are defined",
|
|
152
|
-
"eat your vegetables",
|
|
153
|
-
"be awesome 🤩",
|
|
154
|
-
].forEach((tip) => this.log(` - ${tip}`));
|
|
155
|
-
this.log("\n");
|
|
156
|
-
this.log("\n");
|
|
157
|
-
});
|