@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,84 @@
|
|
|
1
|
+
import type { Context } from "@catladder/pipeline";
|
|
2
|
+
import {
|
|
3
|
+
GCLOUD_DEPLOY_CREDENTIALS_KEY,
|
|
4
|
+
GCLOUD_RUN_CANONICAL_HOST_SUFFIX,
|
|
5
|
+
isOfDeployType,
|
|
6
|
+
} from "@catladder/pipeline";
|
|
7
|
+
|
|
8
|
+
import type { CommandInstance } from "vorpal";
|
|
9
|
+
import { upsertGcloudArtifactsRegistry } from "../../../../../gcloud/artifactsRegistry";
|
|
10
|
+
import { getCloudRunDomainSuffix } from "../../../../../gcloud/cloudRun/getCloudRunDomainSuffix";
|
|
11
|
+
import { enableGCloudServices } from "../../../../../gcloud/enableServices";
|
|
12
|
+
import { upsertGcloudServiceAccountAndSaveSecret } from "../../../../../gcloud/serviceAccounts";
|
|
13
|
+
import { upsertAllVariables } from "../../../../../utils/gitlab";
|
|
14
|
+
|
|
15
|
+
export const setupCloudRun = async (
|
|
16
|
+
instance: CommandInstance,
|
|
17
|
+
context: Context
|
|
18
|
+
) => {
|
|
19
|
+
if (!isOfDeployType(context.componentConfig.deploy, "google-cloudrun")) {
|
|
20
|
+
throw new Error("deploy config is not of type 'google-cloudrun'");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const config = context.componentConfig.deploy;
|
|
24
|
+
|
|
25
|
+
// enable services
|
|
26
|
+
|
|
27
|
+
instance.log("enable required servies...");
|
|
28
|
+
await enableGCloudServices(
|
|
29
|
+
[
|
|
30
|
+
"run.googleapis.com",
|
|
31
|
+
"artifactregistry.googleapis.com",
|
|
32
|
+
"cloudscheduler.googleapis.com", // for scheduling jobs
|
|
33
|
+
"cloudresourcemanager.googleapis.com", // only required to get google cloud project number
|
|
34
|
+
...(config.cloudSql
|
|
35
|
+
? ["sqladmin.googleapis.com", "sql-component.googleapis.com"]
|
|
36
|
+
: []),
|
|
37
|
+
],
|
|
38
|
+
config
|
|
39
|
+
);
|
|
40
|
+
instance.log("upsert artifacts registry...");
|
|
41
|
+
await upsertGcloudArtifactsRegistry(config);
|
|
42
|
+
|
|
43
|
+
instance.log("upsert deploy service account...");
|
|
44
|
+
await upsertGcloudServiceAccountAndSaveSecret(
|
|
45
|
+
instance,
|
|
46
|
+
context,
|
|
47
|
+
{
|
|
48
|
+
projectId: config.projectId,
|
|
49
|
+
displayName: "Catladder gcloud deploy",
|
|
50
|
+
description: "This service account deploys to google cloud",
|
|
51
|
+
name: "cl-d",
|
|
52
|
+
// TODO: run.admin is a bit much, would be better to follow https://stackoverflow.com/questions/55788714/deploying-to-cloud-run-with-a-custom-service-account-failed-with-iam-serviceacco
|
|
53
|
+
roles: [
|
|
54
|
+
"roles/artifactregistry.repoAdmin",
|
|
55
|
+
"roles/run.admin",
|
|
56
|
+
"roles/iam.serviceAccountUser",
|
|
57
|
+
"roles/cloudscheduler.admin", // for scheduling
|
|
58
|
+
...(config.cloudSql ? ["roles/cloudsql.admin"] : []),
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
GCLOUD_DEPLOY_CREDENTIALS_KEY
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
// gcloud run automatically gives us a hostname
|
|
65
|
+
// but the pipeline need to know it before deployment
|
|
66
|
+
// so we get this through some magic and add this as a ci/cd variable
|
|
67
|
+
// the pipeline than can use this to construct the canonical host
|
|
68
|
+
instance.log(
|
|
69
|
+
"get service domain suffix... that might take a while initially"
|
|
70
|
+
);
|
|
71
|
+
const suffix = await getCloudRunDomainSuffix(config);
|
|
72
|
+
instance.log("domain suffix: " + suffix);
|
|
73
|
+
|
|
74
|
+
await upsertAllVariables(
|
|
75
|
+
instance,
|
|
76
|
+
{
|
|
77
|
+
[GCLOUD_RUN_CANONICAL_HOST_SUFFIX]: suffix,
|
|
78
|
+
},
|
|
79
|
+
context.environment.shortName,
|
|
80
|
+
context.componentName,
|
|
81
|
+
false, // backup
|
|
82
|
+
false // masked
|
|
83
|
+
);
|
|
84
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Context } from "@catladder/pipeline";
|
|
2
|
+
import { isOfDeployType } from "@catladder/pipeline";
|
|
3
|
+
import type { CommandInstance } from "vorpal";
|
|
4
|
+
import { setupCloudRun } from "./setupCloudRun";
|
|
5
|
+
|
|
6
|
+
import { setupKubernetes } from "./setupKubernetes";
|
|
7
|
+
|
|
8
|
+
export const setupContext = async (
|
|
9
|
+
instance: CommandInstance,
|
|
10
|
+
context: Context
|
|
11
|
+
) => {
|
|
12
|
+
instance.log("");
|
|
13
|
+
instance.log(
|
|
14
|
+
"=================================================================================="
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
instance.log(
|
|
18
|
+
"🐱 🔧 setting up " +
|
|
19
|
+
context.environment.shortName +
|
|
20
|
+
":" +
|
|
21
|
+
context.componentName +
|
|
22
|
+
"..."
|
|
23
|
+
);
|
|
24
|
+
instance.log("");
|
|
25
|
+
if (isOfDeployType(context.componentConfig.deploy, "google-cloudrun")) {
|
|
26
|
+
await setupCloudRun(instance, context);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const deployConfig = context.componentConfig.deploy;
|
|
30
|
+
if (isOfDeployType(deployConfig, "kubernetes")) {
|
|
31
|
+
await setupKubernetes(instance, context);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
instance.log("");
|
|
35
|
+
instance.log(
|
|
36
|
+
"✅ " +
|
|
37
|
+
context.environment.shortName +
|
|
38
|
+
":" +
|
|
39
|
+
context.componentName +
|
|
40
|
+
" done!"
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
instance.log("");
|
|
44
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { Context } from "@catladder/pipeline";
|
|
2
|
+
import {
|
|
3
|
+
getFullKubernetesClusterName,
|
|
4
|
+
isOfDeployType,
|
|
5
|
+
} from "@catladder/pipeline";
|
|
6
|
+
import type { CommandInstance } from "vorpal";
|
|
7
|
+
import { exec } from "child-process-promise";
|
|
8
|
+
import { connectToCluster } from "../../../../../utils/cluster";
|
|
9
|
+
import { upsertAllVariables } from "../../../../../utils/gitlab";
|
|
10
|
+
import ensureNamespace from "../utils/ensureNamespace";
|
|
11
|
+
|
|
12
|
+
export const setupKubernetes = async (
|
|
13
|
+
instance: CommandInstance,
|
|
14
|
+
context: Context
|
|
15
|
+
) => {
|
|
16
|
+
const deployConfig = context.componentConfig.deploy;
|
|
17
|
+
if (!isOfDeployType(deployConfig, "kubernetes")) {
|
|
18
|
+
throw new Error("cannot run setupKubernetes on non-kubernetes deployments");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const fullName = getFullKubernetesClusterName(deployConfig.cluster);
|
|
22
|
+
instance.log(`cluster: ${fullName}`);
|
|
23
|
+
|
|
24
|
+
await connectToCluster(fullName);
|
|
25
|
+
instance.log("");
|
|
26
|
+
instance.log("ensuring namespace ...");
|
|
27
|
+
const namespace = await ensureNamespace(context);
|
|
28
|
+
instance.log("Namespace " + namespace + " created / updated!");
|
|
29
|
+
instance.log("");
|
|
30
|
+
//$.verbose = true;
|
|
31
|
+
|
|
32
|
+
// we name the service account and the role and the role binding with the same name
|
|
33
|
+
// we currently create one per component to better separate them
|
|
34
|
+
instance.log("ensuring service accounts...");
|
|
35
|
+
const serviceAccountName = `cl-${context.componentName}-deploy`;
|
|
36
|
+
const KUBE_URL = await exec(
|
|
37
|
+
`TERM=dumb kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'`
|
|
38
|
+
).then((s) => s.stdout.trim());
|
|
39
|
+
|
|
40
|
+
// first upsert service acount in the ns
|
|
41
|
+
try {
|
|
42
|
+
await exec(
|
|
43
|
+
`kubectl delete serviceaccount --namespace ${namespace} ${serviceAccountName}`
|
|
44
|
+
);
|
|
45
|
+
await exec(
|
|
46
|
+
`kubectl delete rolebinding --namespace ${namespace} ${serviceAccountName}`
|
|
47
|
+
);
|
|
48
|
+
await exec(
|
|
49
|
+
`kubectl delete role --namespace ${namespace} ${serviceAccountName}`
|
|
50
|
+
);
|
|
51
|
+
} catch (e) {
|
|
52
|
+
// ignore
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
await exec(
|
|
56
|
+
`kubectl create serviceaccount --namespace ${namespace} ${serviceAccountName}`
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// upsert role in the ns
|
|
60
|
+
|
|
61
|
+
await exec(`cat <<EOF | kubectl apply -f -
|
|
62
|
+
kind: Role
|
|
63
|
+
apiVersion: rbac.authorization.k8s.io/v1
|
|
64
|
+
metadata:
|
|
65
|
+
namespace: ${namespace}
|
|
66
|
+
name: ${serviceAccountName}
|
|
67
|
+
rules:
|
|
68
|
+
- apiGroups: ["", "extensions", "apps", "networking.k8s.io", "batch", "autoscaling", "rbac.authorization.k8s.io","snapshot.storage.k8s.io"]
|
|
69
|
+
resources: ["deployments", "replicasets", "statefulsets", "pods", "secrets", "configmaps", "services", "ingresses", "serviceaccounts", "roles", "rolebindings", "jobs", "cronjobs", "horizontalpodautoscalers", "persistentvolumeclaims", "volumesnapshots"]
|
|
70
|
+
verbs: ["*"]
|
|
71
|
+
---
|
|
72
|
+
kind: RoleBinding
|
|
73
|
+
apiVersion: rbac.authorization.k8s.io/v1
|
|
74
|
+
metadata:
|
|
75
|
+
name: ${serviceAccountName}
|
|
76
|
+
namespace: ${namespace}
|
|
77
|
+
subjects:
|
|
78
|
+
- kind: ServiceAccount
|
|
79
|
+
name: ${serviceAccountName}
|
|
80
|
+
namespace: ${namespace}
|
|
81
|
+
roleRef:
|
|
82
|
+
kind: Role
|
|
83
|
+
name: ${serviceAccountName}
|
|
84
|
+
apiGroup: rbac.authorization.k8s.io
|
|
85
|
+
EOF
|
|
86
|
+
`);
|
|
87
|
+
|
|
88
|
+
const secretName = `${serviceAccountName}-secret`;
|
|
89
|
+
// create token for the service account
|
|
90
|
+
await exec(`
|
|
91
|
+
kubectl apply -f - <<EOF
|
|
92
|
+
apiVersion: v1
|
|
93
|
+
kind: Secret
|
|
94
|
+
metadata:
|
|
95
|
+
name: ${secretName}
|
|
96
|
+
namespace: ${namespace}
|
|
97
|
+
annotations:
|
|
98
|
+
kubernetes.io/service-account.name: ${serviceAccountName}
|
|
99
|
+
type: kubernetes.io/service-account-token
|
|
100
|
+
EOF
|
|
101
|
+
`);
|
|
102
|
+
|
|
103
|
+
const KUBE_CA_PEM = await exec(
|
|
104
|
+
`kubectl get secret ${secretName} --namespace ${namespace} -o jsonpath="{['data']['ca\\.crt']}"`
|
|
105
|
+
).then((c) => c.stdout.trim());
|
|
106
|
+
const KUBE_TOKEN = await exec(
|
|
107
|
+
`kubectl get secret ${secretName} --namespace ${namespace} -o jsonpath="{['data']['token']}" | base64 --decode`
|
|
108
|
+
).then((c) => c.stdout.trim());
|
|
109
|
+
|
|
110
|
+
const vars = {
|
|
111
|
+
KUBE_TOKEN,
|
|
112
|
+
KUBE_CA_PEM,
|
|
113
|
+
KUBE_URL,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const missing = Object.entries(vars).filter((e) => !e[1]);
|
|
117
|
+
if (missing.length > 0) {
|
|
118
|
+
throw new Error(
|
|
119
|
+
"could not setup credentials. Missing vars: " +
|
|
120
|
+
missing.map((m) => m[0]).join(", ") +
|
|
121
|
+
". Check whether your local kubectl is still working for '" +
|
|
122
|
+
fullName +
|
|
123
|
+
"'"
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
instance.log("service accounts created / updated!");
|
|
128
|
+
|
|
129
|
+
instance.log("");
|
|
130
|
+
instance.log("pusing secrets to gitlab...");
|
|
131
|
+
|
|
132
|
+
await upsertAllVariables(
|
|
133
|
+
instance,
|
|
134
|
+
vars,
|
|
135
|
+
context.environment.shortName,
|
|
136
|
+
context.componentName,
|
|
137
|
+
false // no backup
|
|
138
|
+
);
|
|
139
|
+
instance.log("done!");
|
|
140
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CommandInstance } from "vorpal";
|
|
2
|
+
import { doGitlabRequest, getProjectInfo } from "../../../../../utils/gitlab";
|
|
3
|
+
|
|
4
|
+
const catladderTopic = "catladder"
|
|
5
|
+
|
|
6
|
+
export const setupTopic = async (instance: CommandInstance) => {
|
|
7
|
+
const { id: projectId } = await getProjectInfo(
|
|
8
|
+
instance
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
const { topics } = await doGitlabRequest(
|
|
12
|
+
instance,
|
|
13
|
+
`projects/${projectId}`
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
await doGitlabRequest(
|
|
17
|
+
instance,
|
|
18
|
+
`projects/${projectId}`,
|
|
19
|
+
{ topics: [catladderTopic, ...topics] },
|
|
20
|
+
"PUT"
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getAllEnvs, getAllEnvsInAllComponents } from "@catladder/pipeline";
|
|
2
|
+
import {
|
|
3
|
+
getAllComponentsWithAllEnvsFlat,
|
|
4
|
+
getProjectConfig,
|
|
5
|
+
} from "../../../../../config/getProjectConfig";
|
|
6
|
+
|
|
7
|
+
export const allEnvs = async () => {
|
|
8
|
+
const config = await getProjectConfig();
|
|
9
|
+
if (!config) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
return getAllEnvsInAllComponents(config);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const envAndComponents = async () => {
|
|
16
|
+
const allEnvAndcomponents = await getAllComponentsWithAllEnvsFlat();
|
|
17
|
+
|
|
18
|
+
return allEnvAndcomponents.reduce<string[]>(
|
|
19
|
+
(acc, { env, componentName }) => [...acc, env + ":" + componentName],
|
|
20
|
+
[]
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const allEnvsAndAllComponents = async () => {
|
|
25
|
+
return [...(await allEnvs()), ...(await envAndComponents())];
|
|
26
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isOfDeployType,
|
|
3
|
+
getFullKubernetesClusterName,
|
|
4
|
+
} from "@catladder/pipeline";
|
|
5
|
+
import {
|
|
6
|
+
getPipelineContextByChoice,
|
|
7
|
+
parseChoice,
|
|
8
|
+
} from "../../../../../config/getProjectConfig";
|
|
9
|
+
import {
|
|
10
|
+
connectToCluster,
|
|
11
|
+
getCurrentConnectedClusterName,
|
|
12
|
+
} from "../../../../../utils/cluster";
|
|
13
|
+
export default async function (envComponent: string) {
|
|
14
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
15
|
+
const context = await getPipelineContextByChoice(env, componentName);
|
|
16
|
+
if (!isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
|
|
17
|
+
throw new Error("can't ensure cluster for non-kubernetes deployments");
|
|
18
|
+
}
|
|
19
|
+
const cluster = getFullKubernetesClusterName(
|
|
20
|
+
context.componentConfig.deploy.cluster
|
|
21
|
+
);
|
|
22
|
+
const connectedClusterName = await getCurrentConnectedClusterName();
|
|
23
|
+
|
|
24
|
+
if (cluster !== connectedClusterName) {
|
|
25
|
+
this.log(
|
|
26
|
+
`you are currently connected to cluster '${connectedClusterName}'`
|
|
27
|
+
);
|
|
28
|
+
this.log(`but the project requires cluster '${cluster}'`);
|
|
29
|
+
const { shouldContinue } = await this.prompt({
|
|
30
|
+
type: "confirm",
|
|
31
|
+
name: "shouldContinue",
|
|
32
|
+
default: true,
|
|
33
|
+
message: `Do you want to connect to '${cluster}'?`,
|
|
34
|
+
});
|
|
35
|
+
if (!shouldContinue) {
|
|
36
|
+
this.log("abort");
|
|
37
|
+
} else {
|
|
38
|
+
await connectToCluster(cluster);
|
|
39
|
+
this.log(`connected to cluster '${cluster}'`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Context} from "@catladder/pipeline";
|
|
2
|
+
import { getKubernetesNamespace } from "@catladder/pipeline";
|
|
3
|
+
import type { V1ObjectMeta } from "@kubernetes/client-node";
|
|
4
|
+
import { V1Namespace } from "@kubernetes/client-node";
|
|
5
|
+
import { getk8sApi } from "../../../../../k8sApi";
|
|
6
|
+
|
|
7
|
+
export default async function (context: Context) {
|
|
8
|
+
const namespace = getKubernetesNamespace(
|
|
9
|
+
context.fullConfig,
|
|
10
|
+
context.environment.shortName
|
|
11
|
+
);
|
|
12
|
+
const namespaceBody = new V1Namespace();
|
|
13
|
+
const metadata: V1ObjectMeta = {
|
|
14
|
+
name: namespace,
|
|
15
|
+
labels: {
|
|
16
|
+
customerName: context.fullConfig.customerName,
|
|
17
|
+
appName: context.fullConfig.appName,
|
|
18
|
+
environment: context.environment.shortName,
|
|
19
|
+
components: Object.keys(context.fullConfig.components).join("_"), // limited chars available...
|
|
20
|
+
buildTypes: Object.values(context.fullConfig.components)
|
|
21
|
+
.map((config) => config.build.type)
|
|
22
|
+
.join("_"), // limited chars available...
|
|
23
|
+
...Object.fromEntries(
|
|
24
|
+
Object.entries(context.fullConfig.components).map(
|
|
25
|
+
([componentName, config]) => [
|
|
26
|
+
"buildType_" + componentName,
|
|
27
|
+
config.build.type,
|
|
28
|
+
]
|
|
29
|
+
)
|
|
30
|
+
),
|
|
31
|
+
...(context.fullConfig.meta?.labels ?? {}),
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
namespaceBody.metadata = metadata;
|
|
36
|
+
const k8sApi = getk8sApi();
|
|
37
|
+
try {
|
|
38
|
+
await k8sApi.readNamespace(namespace);
|
|
39
|
+
|
|
40
|
+
await k8sApi.patchNamespace(
|
|
41
|
+
namespace,
|
|
42
|
+
namespaceBody,
|
|
43
|
+
undefined,
|
|
44
|
+
undefined,
|
|
45
|
+
undefined,
|
|
46
|
+
undefined,
|
|
47
|
+
{ headers: { "content-type": "application/merge-patch+json" } } // see https://github.com/kubernetes-client/javascript/issues/443
|
|
48
|
+
); // update meta data
|
|
49
|
+
} catch (e) {
|
|
50
|
+
if (e.response?.body?.reason === "NotFound") {
|
|
51
|
+
await k8sApi.createNamespace(namespaceBody);
|
|
52
|
+
} else {
|
|
53
|
+
console.error(e.response?.body);
|
|
54
|
+
throw e;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return namespace;
|
|
58
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type Vorpal from "vorpal";
|
|
2
|
+
import { getProjectConfig } from "../../../../../config/getProjectConfig";
|
|
3
|
+
|
|
4
|
+
export const showProjectBanner = async (vorpal: Vorpal) => {
|
|
5
|
+
const projectConfig = await getProjectConfig();
|
|
6
|
+
if (projectConfig) {
|
|
7
|
+
vorpal.log("project: " + projectConfig.appName);
|
|
8
|
+
vorpal.log("customer: " + projectConfig.customerName);
|
|
9
|
+
vorpal.log("");
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { spawn } from "child-process-promise";
|
|
2
|
+
import fetch from "node-fetch";
|
|
3
|
+
import type Vorpal from "vorpal";
|
|
4
|
+
|
|
5
|
+
export default async (vorpal: Vorpal) => {
|
|
6
|
+
vorpal.command("dadjoke", "something for jonas.").action(async function () {
|
|
7
|
+
const result = await fetch("https://icanhazdadjoke.com/", {
|
|
8
|
+
headers: {
|
|
9
|
+
Accept: "text/plain",
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
const text = await result.text();
|
|
13
|
+
this.log("");
|
|
14
|
+
this.log(text);
|
|
15
|
+
this.log("");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
let starwarsPromise: any;
|
|
19
|
+
vorpal
|
|
20
|
+
.command("starwars", "Long time ago... in a galaxy far far away...")
|
|
21
|
+
.action(async function () {
|
|
22
|
+
starwarsPromise = spawn("telnet", ["2001:7b8:666:ffff::1:42"], {
|
|
23
|
+
stdio: ["pipe", "inherit", "pipe"],
|
|
24
|
+
});
|
|
25
|
+
await starwarsPromise;
|
|
26
|
+
})
|
|
27
|
+
// we need to close it properly, because telnet towel.blinkenlights.nl has no way to cancel and stop itself
|
|
28
|
+
// this is also why we need to only inherit the stdout and not the stdin
|
|
29
|
+
.cancel(async function () {
|
|
30
|
+
starwarsPromise.childProcess.kill();
|
|
31
|
+
});
|
|
32
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Config } from "@catladder/pipeline";
|
|
2
|
+
import { spawn, exec } from "child-process-promise";
|
|
3
|
+
import { writeFile } from "fs-extra";
|
|
4
|
+
import { dump } from "js-yaml";
|
|
5
|
+
import { format } from "prettier";
|
|
6
|
+
import type { CommandInstance } from "vorpal";
|
|
7
|
+
import { getGitRoot } from "../../../utils/projects";
|
|
8
|
+
|
|
9
|
+
export const writeConfig = async (
|
|
10
|
+
vorpal: CommandInstance,
|
|
11
|
+
config: Config,
|
|
12
|
+
options?: {
|
|
13
|
+
endComment?: string;
|
|
14
|
+
}
|
|
15
|
+
) => {
|
|
16
|
+
const gitRoot = await getGitRoot();
|
|
17
|
+
const TS = "typescript (recommended)";
|
|
18
|
+
const { configType } = await vorpal.prompt({
|
|
19
|
+
type: "list",
|
|
20
|
+
name: "configType",
|
|
21
|
+
choices: [TS, "yaml"],
|
|
22
|
+
message: "In which format do you want the config? 🤔",
|
|
23
|
+
});
|
|
24
|
+
vorpal.log("");
|
|
25
|
+
if (configType === TS) {
|
|
26
|
+
const file = gitRoot + "/catladder.ts";
|
|
27
|
+
const content = format(
|
|
28
|
+
`
|
|
29
|
+
import type { Config } from "@catladder/pipeline";
|
|
30
|
+
|
|
31
|
+
const config: Config = ${JSON.stringify(config)};
|
|
32
|
+
|
|
33
|
+
export default config;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
${options?.endComment ? `/*${options.endComment}*/` : ""}
|
|
37
|
+
|
|
38
|
+
`,
|
|
39
|
+
{
|
|
40
|
+
parser: "babel",
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
await writeFile(file, content, {
|
|
45
|
+
encoding: "utf-8",
|
|
46
|
+
});
|
|
47
|
+
vorpal.log("adding type @catladder/pipeline....");
|
|
48
|
+
await spawn("yarn add --non-interactive @catladder/pipeline -DW", {
|
|
49
|
+
shell: true,
|
|
50
|
+
});
|
|
51
|
+
await exec("git add " + file);
|
|
52
|
+
} else {
|
|
53
|
+
const file = gitRoot + "/catladder.yml";
|
|
54
|
+
const content = dump(config);
|
|
55
|
+
|
|
56
|
+
await writeFile(
|
|
57
|
+
file,
|
|
58
|
+
content +
|
|
59
|
+
"\n\n" +
|
|
60
|
+
(options.endComment
|
|
61
|
+
? "# " + options.endComment.split("\n").join("\n# ")
|
|
62
|
+
: ""),
|
|
63
|
+
{
|
|
64
|
+
encoding: "utf-8",
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
await exec("git add " + file);
|
|
68
|
+
}
|
|
69
|
+
vorpal.log("done!");
|
|
70
|
+
vorpal.log("");
|
|
71
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type Vorpal from "vorpal";
|
|
2
|
+
import {
|
|
3
|
+
getGitlabCi,
|
|
4
|
+
getProjectConfig,
|
|
5
|
+
} from "../../../config/getProjectConfig";
|
|
6
|
+
import { hasGitlabToken, setupGitlabToken } from "../../../utils/gitlab";
|
|
7
|
+
import { isV2, migrateV2 } from "./migration/fromv2";
|
|
8
|
+
|
|
9
|
+
export const verify = async (vorpal: Vorpal) => {
|
|
10
|
+
// check if has all settings
|
|
11
|
+
|
|
12
|
+
if (!(await hasGitlabToken())) {
|
|
13
|
+
vorpal.command("setup-gitlab-token").action(async function () {
|
|
14
|
+
await setupGitlabToken(this);
|
|
15
|
+
});
|
|
16
|
+
vorpal.exec("setup-gitlab-token");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const projectConfig = await getProjectConfig();
|
|
20
|
+
try {
|
|
21
|
+
const gitlabCi = getGitlabCi();
|
|
22
|
+
|
|
23
|
+
if (gitlabCi && !projectConfig && (await isV2())) {
|
|
24
|
+
vorpal.log("no project config, needs migration");
|
|
25
|
+
await migrateV2(vorpal);
|
|
26
|
+
}
|
|
27
|
+
} catch (e) {
|
|
28
|
+
// no gitroot, ignore
|
|
29
|
+
}
|
|
30
|
+
};
|