@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.
Files changed (398) hide show
  1. package/.nvmrc +1 -1
  2. package/README.md +6 -3
  3. package/bin/catenv +3 -0
  4. package/bin/catenv-dev +3 -0
  5. package/bin/catladder +1 -1
  6. package/bin/catladder-dev +3 -0
  7. package/dist/apps/catenv/catenv.d.ts +3 -0
  8. package/dist/apps/catenv/catenv.js +66 -0
  9. package/dist/apps/catenv/catenv.js.map +1 -0
  10. package/dist/apps/catenv/printVariables.d.ts +3 -0
  11. package/dist/apps/catenv/printVariables.js +115 -0
  12. package/dist/apps/catenv/printVariables.js.map +1 -0
  13. package/dist/apps/catenv/types.d.ts +5 -0
  14. package/dist/apps/catenv/types.js +3 -0
  15. package/dist/apps/catenv/types.js.map +1 -0
  16. package/dist/apps/catenv/utils.d.ts +12 -0
  17. package/dist/apps/catenv/utils.js +108 -0
  18. package/dist/apps/catenv/utils.js.map +1 -0
  19. package/dist/apps/catenv/writeDotEnvFiles.d.ts +3 -0
  20. package/dist/apps/catenv/writeDotEnvFiles.js +94 -0
  21. package/dist/apps/catenv/writeDotEnvFiles.js.map +1 -0
  22. package/dist/apps/catenv/writeEnvDTs.d.ts +3 -0
  23. package/dist/apps/catenv/writeEnvDTs.js +114 -0
  24. package/dist/apps/catenv/writeEnvDTs.js.map +1 -0
  25. package/dist/apps/cli/cli.d.ts +2 -0
  26. package/dist/apps/cli/cli.js +83 -0
  27. package/dist/apps/cli/cli.js.map +1 -0
  28. package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.d.ts +3 -0
  29. package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js +180 -0
  30. package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +1 -0
  31. package/dist/apps/cli/commands/cloudSQL/index.d.ts +3 -0
  32. package/dist/apps/cli/commands/cloudSQL/index.js +50 -0
  33. package/dist/apps/cli/commands/cloudSQL/index.js.map +1 -0
  34. package/dist/apps/cli/commands/general/index.d.ts +4 -0
  35. package/dist/apps/cli/commands/general/index.js +216 -0
  36. package/dist/apps/cli/commands/general/index.js.map +1 -0
  37. package/dist/apps/cli/commands/general/namespaceAutoCompletion.d.ts +3 -0
  38. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +56 -0
  39. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -0
  40. package/dist/apps/cli/commands/general/portForward.d.ts +3 -0
  41. package/dist/apps/cli/commands/general/portForward.js +97 -0
  42. package/dist/apps/cli/commands/general/portForward.js.map +1 -0
  43. package/dist/apps/cli/commands/mongodb/index.d.ts +3 -0
  44. package/dist/apps/cli/commands/mongodb/index.js +53 -0
  45. package/dist/apps/cli/commands/mongodb/index.js.map +1 -0
  46. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +3 -0
  47. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +191 -0
  48. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -0
  49. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +3 -0
  50. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js +96 -0
  51. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -0
  52. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +3 -0
  53. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +121 -0
  54. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -0
  55. package/dist/apps/cli/commands/mongodb/utils/index.d.ts +13 -0
  56. package/dist/apps/cli/commands/mongodb/utils/index.js +179 -0
  57. package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -0
  58. package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +3 -0
  59. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +164 -0
  60. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
  61. package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +5 -0
  62. package/dist/apps/cli/commands/project/commandConfigSecrets.js +334 -0
  63. package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
  64. package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
  65. package/dist/apps/cli/commands/project/commandDeletePods.js +121 -0
  66. package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -0
  67. package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +3 -0
  68. package/dist/apps/cli/commands/project/commandDeleteProject.js +97 -0
  69. package/dist/apps/cli/commands/project/commandDeleteProject.js.map +1 -0
  70. package/dist/apps/cli/commands/project/commandEnvVars.d.ts +3 -0
  71. package/dist/apps/cli/commands/project/commandEnvVars.js +74 -0
  72. package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -0
  73. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +3 -0
  74. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +58 -0
  75. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -0
  76. package/dist/apps/cli/commands/project/commandGetShell.d.ts +3 -0
  77. package/dist/apps/cli/commands/project/commandGetShell.js +96 -0
  78. package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -0
  79. package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +3 -0
  80. package/dist/apps/cli/commands/project/commandGitlabCi.js +185 -0
  81. package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -0
  82. package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +3 -0
  83. package/dist/apps/cli/commands/project/commandInitProject.old.js +345 -0
  84. package/dist/apps/cli/commands/project/commandInitProject.old.js.map +1 -0
  85. package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
  86. package/dist/apps/cli/commands/project/commandListPods.js +78 -0
  87. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
  88. package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
  89. package/dist/apps/cli/commands/project/commandMigrateHelm3.js +112 -0
  90. package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
  91. package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
  92. package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
  93. package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
  94. package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
  95. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
  96. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
  97. package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
  98. package/dist/apps/cli/commands/project/commandOpenDashboard.js +84 -0
  99. package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
  100. package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
  101. package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
  102. package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
  103. package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
  104. package/dist/apps/cli/commands/project/commandOpenGit.js +56 -0
  105. package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
  106. package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
  107. package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
  108. package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
  109. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
  110. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +100 -0
  111. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
  112. package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
  113. package/dist/apps/cli/commands/project/commandOpenLogs.js +74 -0
  114. package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
  115. package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
  116. package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
  117. package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
  118. package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
  119. package/dist/apps/cli/commands/project/commandPortForward.js +168 -0
  120. package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
  121. package/dist/apps/cli/commands/project/commandSecretsClearBackups.d.ts +5 -0
  122. package/dist/apps/cli/commands/project/commandSecretsClearBackups.js +90 -0
  123. package/dist/apps/cli/commands/project/commandSecretsClearBackups.js.map +1 -0
  124. package/dist/apps/cli/commands/project/commandSetup.d.ts +3 -0
  125. package/dist/apps/cli/commands/project/commandSetup.js +58 -0
  126. package/dist/apps/cli/commands/project/commandSetup.js.map +1 -0
  127. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
  128. package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
  129. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
  130. package/dist/apps/cli/commands/project/index.d.ts +3 -0
  131. package/dist/apps/cli/commands/project/index.js +94 -0
  132. package/dist/apps/cli/commands/project/index.js.map +1 -0
  133. package/dist/apps/cli/commands/project/setup/index.d.ts +2 -0
  134. package/dist/apps/cli/commands/project/setup/index.js +107 -0
  135. package/dist/apps/cli/commands/project/setup/index.js.map +1 -0
  136. package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +2 -0
  137. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +116 -0
  138. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -0
  139. package/dist/apps/cli/commands/project/setup/setupCloudRun.d.ts +3 -0
  140. package/dist/apps/cli/commands/project/setup/setupCloudRun.js +118 -0
  141. package/dist/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -0
  142. package/dist/apps/cli/commands/project/setup/setupContext.d.ts +3 -0
  143. package/dist/apps/cli/commands/project/setup/setupContext.js +81 -0
  144. package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -0
  145. package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +3 -0
  146. package/dist/apps/cli/commands/project/setup/setupKubernetes.js +139 -0
  147. package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -0
  148. package/dist/apps/cli/commands/project/setup/setupTopic.d.ts +2 -0
  149. package/dist/apps/cli/commands/project/setup/setupTopic.js +69 -0
  150. package/dist/apps/cli/commands/project/setup/setupTopic.js.map +1 -0
  151. package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
  152. package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
  153. package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
  154. package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
  155. package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
  156. package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
  157. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -0
  158. package/dist/apps/cli/commands/project/utils/ensureNamespace.js +104 -0
  159. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
  160. package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
  161. package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
  162. package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
  163. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
  164. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +101 -0
  165. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
  166. package/dist/apps/cli/config/writeConfig.d.ts +5 -0
  167. package/dist/apps/cli/config/writeConfig.js +106 -0
  168. package/dist/apps/cli/config/writeConfig.js.map +1 -0
  169. package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
  170. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
  171. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
  172. package/dist/apps/cli/verify/index.d.ts +2 -0
  173. package/dist/apps/cli/verify/index.js +94 -0
  174. package/dist/apps/cli/verify/index.js.map +1 -0
  175. package/dist/apps/cli/verify/migration/fromv2.d.ts +4 -0
  176. package/dist/apps/cli/verify/migration/fromv2.js +349 -0
  177. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
  178. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
  179. package/dist/apps/cli/verify/migration/migrateSecrets.js +91 -0
  180. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
  181. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +18 -0
  182. package/dist/apps/cli/verify/migration/oldGitlabCi.js +30 -0
  183. package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
  184. package/dist/bundles/catenv/index.js +46512 -0
  185. package/dist/bundles/catenv/xdg-open +1066 -0
  186. package/dist/bundles/cli/clipboard_i686.exe +0 -0
  187. package/dist/bundles/cli/clipboard_x86_64.exe +0 -0
  188. package/dist/bundles/cli/exec-child.js +39 -0
  189. package/dist/bundles/cli/index.js +363134 -0
  190. package/dist/bundles/cli/xdg-open +1066 -0
  191. package/dist/bundles/cli/xsel +0 -0
  192. package/dist/catenv.d.ts +1 -0
  193. package/dist/catenv.js +13 -0
  194. package/dist/catenv.js.map +1 -0
  195. package/dist/cli.d.ts +1 -0
  196. package/dist/cli.js +8 -0
  197. package/dist/cli.js.map +1 -0
  198. package/dist/config/constants.d.ts +2 -0
  199. package/dist/config/constants.js +6 -0
  200. package/dist/config/constants.js.map +1 -0
  201. package/dist/config/getProjectConfig.d.ts +24 -0
  202. package/dist/config/getProjectConfig.js +313 -0
  203. package/dist/config/getProjectConfig.js.map +1 -0
  204. package/dist/config/parseChoice.d.ts +4 -0
  205. package/dist/config/parseChoice.js +9 -0
  206. package/dist/config/parseChoice.js.map +1 -0
  207. package/dist/gcloud/artifactsRegistry.d.ts +5 -0
  208. package/dist/gcloud/artifactsRegistry.js +59 -0
  209. package/dist/gcloud/artifactsRegistry.js.map +1 -0
  210. package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.d.ts +2 -0
  211. package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js +67 -0
  212. package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js.map +1 -0
  213. package/dist/gcloud/cloudRun/openCloudRunDashboards.d.ts +3 -0
  214. package/dist/gcloud/cloudRun/openCloudRunDashboards.js +62 -0
  215. package/dist/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -0
  216. package/dist/gcloud/cloudSql/startProxy.d.ts +10 -0
  217. package/dist/gcloud/cloudSql/startProxy.js +121 -0
  218. package/dist/gcloud/cloudSql/startProxy.js.map +1 -0
  219. package/dist/gcloud/enableServices.d.ts +3 -0
  220. package/dist/gcloud/enableServices.js +63 -0
  221. package/dist/gcloud/enableServices.js.map +1 -0
  222. package/dist/gcloud/openDashboard.d.ts +2 -0
  223. package/dist/gcloud/openDashboard.js +66 -0
  224. package/dist/gcloud/openDashboard.js.map +1 -0
  225. package/dist/gcloud/serviceAccounts.d.ts +12 -0
  226. package/dist/gcloud/serviceAccounts.js +144 -0
  227. package/dist/gcloud/serviceAccounts.js.map +1 -0
  228. package/dist/k8sApi/index.d.ts +8 -0
  229. package/dist/k8sApi/index.js +29 -0
  230. package/dist/k8sApi/index.js.map +1 -0
  231. package/dist/kubernetes/index.d.ts +3 -0
  232. package/dist/kubernetes/index.js +88 -0
  233. package/dist/kubernetes/index.js.map +1 -0
  234. package/dist/kubernetes/openKubernetesDashboards.d.ts +4 -0
  235. package/dist/kubernetes/openKubernetesDashboards.js +94 -0
  236. package/dist/kubernetes/openKubernetesDashboards.js.map +1 -0
  237. package/dist/kubernetes/portForward.d.ts +1 -0
  238. package/dist/kubernetes/portForward.js +55 -0
  239. package/dist/kubernetes/portForward.js.map +1 -0
  240. package/dist/packageInfos.d.ts +2 -0
  241. package/dist/packageInfos.js +6 -0
  242. package/dist/packageInfos.js.map +1 -0
  243. package/dist/tsconfig.tsbuildinfo +1 -0
  244. package/dist/types/types.d.ts +18 -0
  245. package/dist/types/types.js +3 -0
  246. package/dist/types/types.js.map +1 -0
  247. package/dist/utils/cluster.d.ts +3 -0
  248. package/dist/utils/cluster.js +68 -0
  249. package/dist/utils/cluster.js.map +1 -0
  250. package/dist/utils/editAsFile.d.ts +1 -0
  251. package/dist/utils/editAsFile.js +85 -0
  252. package/dist/utils/editAsFile.js.map +1 -0
  253. package/dist/utils/files.d.ts +2 -0
  254. package/dist/utils/files.js +83 -0
  255. package/dist/utils/files.js.map +1 -0
  256. package/dist/utils/getEditor.d.ts +4 -0
  257. package/dist/utils/getEditor.js +70 -0
  258. package/dist/utils/getEditor.js.map +1 -0
  259. package/dist/utils/gitlab.d.ts +24 -0
  260. package/dist/utils/gitlab.js +397 -0
  261. package/dist/utils/gitlab.js.map +1 -0
  262. package/dist/utils/log.d.ts +1 -0
  263. package/dist/utils/log.js +14 -0
  264. package/dist/utils/log.js.map +1 -0
  265. package/dist/utils/passwordstore/index.d.ts +7 -0
  266. package/dist/utils/passwordstore/index.js +315 -0
  267. package/dist/utils/passwordstore/index.js.map +1 -0
  268. package/dist/utils/portForwards.d.ts +12 -0
  269. package/dist/utils/portForwards.js +120 -0
  270. package/dist/utils/portForwards.js.map +1 -0
  271. package/dist/utils/preferences/index.d.ts +3 -0
  272. package/dist/utils/preferences/index.js +119 -0
  273. package/dist/utils/preferences/index.js.map +1 -0
  274. package/dist/utils/projects/index.d.ts +5 -0
  275. package/dist/utils/projects/index.js +103 -0
  276. package/dist/utils/projects/index.js.map +1 -0
  277. package/dist/utils/promise.d.ts +2 -0
  278. package/dist/utils/promise.js +62 -0
  279. package/dist/utils/promise.js.map +1 -0
  280. package/dist/utils/shell.d.ts +1 -0
  281. package/dist/utils/shell.js +81 -0
  282. package/dist/utils/shell.js.map +1 -0
  283. package/package.json +32 -35
  284. package/scripts/bundle +4 -0
  285. package/src/apps/catenv/catenv.ts +14 -37
  286. package/src/apps/catenv/printVariables.ts +58 -0
  287. package/src/apps/catenv/types.ts +6 -0
  288. package/src/apps/catenv/utils.ts +49 -0
  289. package/src/apps/catenv/writeDotEnvFiles.ts +44 -0
  290. package/src/apps/catenv/writeEnvDTs.ts +71 -0
  291. package/src/apps/{shell/shell.ts → cli/cli.ts} +13 -3
  292. package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +154 -0
  293. package/src/apps/cli/commands/cloudSQL/index.ts +8 -0
  294. package/src/apps/{shell → cli}/commands/general/index.ts +16 -52
  295. package/src/apps/{shell → cli}/commands/general/portForward.ts +7 -6
  296. package/src/apps/{shell → cli}/commands/mongodb/index.ts +2 -2
  297. package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +20 -22
  298. package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +13 -11
  299. package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +65 -0
  300. package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +28 -19
  301. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +139 -0
  302. package/src/apps/cli/commands/project/commandConfigSecrets.ts +234 -0
  303. package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +13 -15
  304. package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +8 -9
  305. package/src/apps/cli/commands/project/commandEnvVars.ts +18 -0
  306. package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +4 -4
  307. package/src/apps/cli/commands/project/commandGetShell.ts +36 -0
  308. package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +3 -2
  309. package/src/apps/{shell/commands/project/commandInitProject.ts → cli/commands/project/commandInitProject.old.ts} +15 -7
  310. package/src/apps/cli/commands/project/commandListPods.ts +18 -0
  311. package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +18 -8
  312. package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
  313. package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +32 -0
  314. package/src/apps/cli/commands/project/commandOpenDashboard.ts +28 -0
  315. package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
  316. package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +2 -2
  317. package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +10 -10
  318. package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +14 -17
  319. package/src/apps/cli/commands/project/commandOpenLogs.ts +21 -0
  320. package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +10 -8
  321. package/src/apps/cli/commands/project/commandPortForward.ts +86 -0
  322. package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +27 -0
  323. package/src/apps/cli/commands/project/commandSetup.ts +12 -0
  324. package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +13 -12
  325. package/src/apps/{shell → cli}/commands/project/index.ts +10 -10
  326. package/src/apps/cli/commands/project/setup/index.ts +44 -0
  327. package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +84 -0
  328. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +84 -0
  329. package/src/apps/cli/commands/project/setup/setupContext.ts +44 -0
  330. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +140 -0
  331. package/src/apps/cli/commands/project/setup/setupTopic.ts +22 -0
  332. package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
  333. package/src/apps/cli/commands/project/utils/ensureCluster.ts +42 -0
  334. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +58 -0
  335. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
  336. package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +32 -0
  337. package/src/apps/cli/config/writeConfig.ts +71 -0
  338. package/src/apps/cli/verify/index.ts +30 -0
  339. package/src/apps/cli/verify/migration/fromv2.ts +262 -0
  340. package/src/apps/cli/verify/migration/migrateSecrets.ts +47 -0
  341. package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
  342. package/src/catenv.ts +10 -0
  343. package/src/cli.ts +3 -0
  344. package/src/config/constants.ts +0 -3
  345. package/src/config/getProjectConfig.ts +200 -0
  346. package/src/config/parseChoice.ts +4 -0
  347. package/src/gcloud/artifactsRegistry.ts +16 -0
  348. package/src/gcloud/cloudRun/getCloudRunDomainSuffix.ts +35 -0
  349. package/src/gcloud/cloudRun/openCloudRunDashboards.ts +22 -0
  350. package/src/gcloud/cloudSql/startProxy.ts +74 -0
  351. package/src/gcloud/enableServices.ts +14 -0
  352. package/src/gcloud/openDashboard.ts +19 -0
  353. package/src/gcloud/serviceAccounts.ts +101 -0
  354. package/src/k8sApi/index.ts +22 -6
  355. package/src/kubernetes/index.ts +27 -0
  356. package/src/kubernetes/openKubernetesDashboards.ts +52 -0
  357. package/src/kubernetes/portForward.ts +15 -0
  358. package/src/types/child-process-promise.d.ts +37 -1
  359. package/src/types/types.ts +0 -2
  360. package/src/utils/cluster.ts +5 -14
  361. package/src/utils/editAsFile.ts +31 -0
  362. package/src/utils/files.ts +6 -2
  363. package/src/utils/gitlab.ts +263 -42
  364. package/src/utils/passwordstore/index.ts +6 -36
  365. package/src/utils/{portForward.ts → portForwards.ts} +27 -22
  366. package/src/utils/preferences/index.ts +6 -3
  367. package/src/utils/projects/index.ts +9 -149
  368. package/tsconfig.json +3 -7
  369. package/bin/catenv.sh +0 -1
  370. package/src/apps/shell/commands/mongodb/projectMongoPortForward.ts +0 -42
  371. package/src/apps/shell/commands/project/commandCloudSqlProxy.ts +0 -65
  372. package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
  373. package/src/apps/shell/commands/project/commandCopyDB.ts +0 -93
  374. package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
  375. package/src/apps/shell/commands/project/commandGetShell.ts +0 -35
  376. package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
  377. package/src/apps/shell/commands/project/commandListPods.ts +0 -21
  378. package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
  379. package/src/apps/shell/commands/project/commandOpenCostDashboard.ts +0 -29
  380. package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
  381. package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
  382. package/src/apps/shell/commands/project/commandOpenLogs.ts +0 -23
  383. package/src/apps/shell/commands/project/commandPortForward.ts +0 -45
  384. package/src/apps/shell/commands/project/commandVariables.ts +0 -13
  385. package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
  386. package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
  387. package/src/apps/shell/commands/project/utils/ensureNamespace.ts +0 -32
  388. package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
  389. package/src/apps/shell/commands/shared/index.ts +0 -31
  390. package/src/apps/shell/commands/theStuffThatReallyMatters/index.ts +0 -51
  391. package/src/config/clusters.ts +0 -45
  392. package/src/index.ts +0 -17
  393. package/src/types/git-repo-name.d.ts +0 -1
  394. package/src/types/yawn-yaml.d.ts +0 -1
  395. package/src/utils/dashboardToken.ts +0 -20
  396. package/src/utils/formatEnvVars.ts +0 -7
  397. /package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
  398. /package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
@@ -0,0 +1,14 @@
1
+ import type Vorpal from "vorpal";
2
+ import { getProjectNamespace } from "../../../../utils/projects";
3
+ import { envAndComponents } from "./utils/autocompletions";
4
+
5
+ export default async (vorpal: Vorpal) =>
6
+ vorpal
7
+ .command(
8
+ "project-namespace <envComponent>",
9
+ "show namespace of local project"
10
+ )
11
+ .autocomplete(await envAndComponents())
12
+ .action(async function ({ envComponent }) {
13
+ this.log(await getProjectNamespace(envComponent));
14
+ });
@@ -0,0 +1,32 @@
1
+ import open from "open";
2
+ import type Vorpal from "vorpal";
3
+ import {
4
+ GRAFANA_PROXY_LOCAL_PORT,
5
+ GRAFANA_PROXY_TARGET_PORT,
6
+ } from "../../../../config/constants";
7
+
8
+ import { startKubePortForward } from "../../../../kubernetes/portForward";
9
+
10
+ import { getProjectNamespace } from "../../../../utils/projects";
11
+
12
+ import { envAndComponents } from "./utils/autocompletions";
13
+ import ensureCluster from "./utils/ensureCluster";
14
+ export default async (vorpal: Vorpal) =>
15
+ vorpal
16
+ .command(
17
+ "project-check-costs <envComponent>",
18
+ "Shows you how much you're spending"
19
+ )
20
+ .autocomplete(await envAndComponents())
21
+ .action(async function ({ envComponent }) {
22
+ await ensureCluster.call(this, envComponent);
23
+ const namespace = await getProjectNamespace(envComponent);
24
+ const url = `http://localhost:${GRAFANA_PROXY_LOCAL_PORT}/namespace.html?name=${namespace}`;
25
+ await startKubePortForward(
26
+ "deployment/kubecost-cost-analyzer",
27
+ GRAFANA_PROXY_LOCAL_PORT,
28
+ GRAFANA_PROXY_TARGET_PORT,
29
+ "kubecost"
30
+ );
31
+ open(url);
32
+ });
@@ -0,0 +1,28 @@
1
+ import { isOfDeployType } from "@catladder/pipeline";
2
+ import type Vorpal from "vorpal";
3
+ import {
4
+ getPipelineContextByChoice,
5
+ parseChoice,
6
+ } from "../../../../config/getProjectConfig";
7
+ import { openGoogleCloudRunDashboard } from "../../../../gcloud/cloudRun/openCloudRunDashboards";
8
+ import { openGoogleCloudKubernetesDashboard } from "../../../../kubernetes/openKubernetesDashboards";
9
+
10
+ import { envAndComponents } from "./utils/autocompletions";
11
+
12
+ export default async (vorpal: Vorpal) =>
13
+ vorpal
14
+ .command(
15
+ "project-open-dashboard <envComponent>",
16
+ "open an apps dashboard (kubernetes or cloudrun)"
17
+ )
18
+ .autocomplete(await envAndComponents())
19
+ .action(async function ({ envComponent }) {
20
+ const { env, componentName } = parseChoice(envComponent);
21
+ const context = await getPipelineContextByChoice(env, componentName);
22
+ if (isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
23
+ await openGoogleCloudKubernetesDashboard(this, context);
24
+ }
25
+ if (isOfDeployType(context.componentConfig.deploy, "google-cloudrun")) {
26
+ await openGoogleCloudRunDashboard(this, context);
27
+ }
28
+ });
@@ -0,0 +1,22 @@
1
+ import open from "open";
2
+ import type Vorpal from "vorpal";
3
+ import {
4
+ getEnvironment,
5
+ parseChoice,
6
+ } from "../../../../config/getProjectConfig";
7
+
8
+ import { envAndComponents } from "./utils/autocompletions";
9
+ import ensureCluster from "./utils/ensureCluster";
10
+
11
+ export default async (vorpal: Vorpal) =>
12
+ vorpal
13
+ .command("project-open-env <envComponent>", "open the live environment")
14
+ .autocomplete(await envAndComponents())
15
+ .action(async function ({ envComponent }) {
16
+ const { env, componentName } = parseChoice(envComponent);
17
+ await ensureCluster.call(this, envComponent);
18
+ const environment = await getEnvironment(env, componentName);
19
+ const url = environment.url;
20
+
21
+ open(url);
22
+ });
@@ -1,7 +1,7 @@
1
+ import type Vorpal from "vorpal";
1
2
  import { exec } from "child-process-promise";
2
- import Vorpal from "vorpal";
3
3
 
4
- export default (vorpal: Vorpal) =>
4
+ export default async (vorpal: Vorpal) =>
5
5
  vorpal
6
6
  .command(
7
7
  "project-open-git",
@@ -1,6 +1,6 @@
1
1
  import open from "open";
2
- import { startPortForward } from "../../../../utils/portForward";
3
- import Vorpal from "vorpal";
2
+ import { startKubePortForward } from "../../../../kubernetes/portForward";
3
+ import type Vorpal from "vorpal";
4
4
  import {
5
5
  GRAFANA_PROXY_LOCAL_PORT,
6
6
  GRAFANA_PROXY_TARGET_PORT,
@@ -8,20 +8,20 @@ import {
8
8
 
9
9
  import { getProjectNamespace } from "../../../../utils/projects";
10
10
 
11
- import { envAutocompletion } from "./utils/autocompletions";
11
+ import { envAndComponents } from "./utils/autocompletions";
12
12
  import ensureCluster from "./utils/ensureCluster";
13
- export default (vorpal: Vorpal) =>
13
+ export default async (vorpal: Vorpal) =>
14
14
  vorpal
15
15
  .command(
16
- "project-open-grafana <env>",
16
+ "project-open-grafana <envComponent>",
17
17
  "open Grafana dashboard for your namespace"
18
18
  )
19
- .autocomplete(envAutocompletion)
20
- .action(async function ({ env }) {
21
- await ensureCluster.call(this);
22
- const namespace = await getProjectNamespace(env);
19
+ .autocomplete(await envAndComponents())
20
+ .action(async function ({ envComponent }) {
21
+ await ensureCluster.call(this, envComponent);
22
+ const namespace = await getProjectNamespace(envComponent);
23
23
  const url = `http://localhost:${GRAFANA_PROXY_LOCAL_PORT}/grafana/d/at-cost-analysis-namespace2/namespace-utilization-metrics?var-namespace=${namespace}`;
24
- await startPortForward(
24
+ await startKubePortForward(
25
25
  "deployment/kubecost-cost-analyzer",
26
26
  GRAFANA_PROXY_LOCAL_PORT,
27
27
  GRAFANA_PROXY_TARGET_PORT,
@@ -1,29 +1,26 @@
1
1
  import open from "open";
2
- import Vorpal from "vorpal";
2
+ import type Vorpal from "vorpal";
3
3
  import {
4
4
  GRAFANA_PROXY_LOCAL_PORT,
5
5
  GRAFANA_PROXY_TARGET_PORT,
6
6
  } from "../../../../config/constants";
7
+ import { getProjectPodNames } from "../../../../kubernetes";
7
8
  import { logError } from "../../../../utils/log";
8
- import { startPortForward } from "../../../../utils/portForward";
9
-
10
- import {
11
- getProjectNamespace,
12
- getProjectPodNames,
13
- } from "../../../../utils/projects";
14
-
15
- import { envAutocompletion } from "./utils/autocompletions";
9
+ import { startKubePortForward } from "../../../../kubernetes/portForward";
10
+ import { getProjectNamespace } from "../../../../utils/projects";
11
+ import { envAndComponents } from "./utils/autocompletions";
16
12
  import ensureCluster from "./utils/ensureCluster";
17
- export default (vorpal: Vorpal) =>
13
+
14
+ export default async (vorpal: Vorpal) =>
18
15
  vorpal
19
16
  .command(
20
- "project-open-grafana-pod <env>",
17
+ "project-open-grafana-pod <envComponent>",
21
18
  "open Grafana dashboard for a specific pod"
22
19
  )
23
- .autocomplete(envAutocompletion)
24
- .action(async function ({ env }) {
25
- await ensureCluster.call(this);
26
- const podNames = await getProjectPodNames(env);
20
+ .autocomplete(await envAndComponents())
21
+ .action(async function ({ envComponent }) {
22
+ await ensureCluster.call(this, envComponent);
23
+ const podNames = await getProjectPodNames(envComponent);
27
24
  if (podNames.length === 0) {
28
25
  logError(this, "sorry, no pods found");
29
26
  return;
@@ -34,9 +31,9 @@ export default (vorpal: Vorpal) =>
34
31
  choices: podNames,
35
32
  message: "Which pod? 🤔",
36
33
  });
37
- const namespace = await getProjectNamespace(env);
34
+ const namespace = await getProjectNamespace(envComponent);
38
35
  const url = `http://localhost:${GRAFANA_PROXY_LOCAL_PORT}/grafana/d/at-cost-analysis-pod/pod-cost-and-utilization-metrics?var-namespace=${namespace}&var-pod=${podName}`;
39
- await startPortForward(
36
+ await startKubePortForward(
40
37
  "deployment/kubecost-cost-analyzer",
41
38
  GRAFANA_PROXY_LOCAL_PORT,
42
39
  GRAFANA_PROXY_TARGET_PORT,
@@ -0,0 +1,21 @@
1
+ import type Vorpal from "vorpal";
2
+ import {
3
+ getPipelineContextByChoice,
4
+ parseChoice,
5
+ } from "../../../../config/getProjectConfig";
6
+ import { openGoogleCloudLogs } from "../../../../kubernetes/openKubernetesDashboards";
7
+ import { envAndComponents } from "./utils/autocompletions";
8
+
9
+ export default async (vorpal: Vorpal) =>
10
+ vorpal
11
+ .command(
12
+ "project-open-logs <envComponent>",
13
+ "open google cloud logs (stackdriver logs)"
14
+ )
15
+ .autocomplete(await envAndComponents())
16
+ .action(async function ({ envComponent }) {
17
+ const { env, componentName } = parseChoice(envComponent);
18
+ const context = await getPipelineContextByChoice(env, componentName);
19
+
20
+ await openGoogleCloudLogs(this, context);
21
+ });
@@ -1,15 +1,17 @@
1
- import Vorpal from "vorpal";
1
+ import type Vorpal from "vorpal";
2
2
  import { exec } from "child-process-promise";
3
- import { Env } from "../../../../types/types";
4
3
  import { getProjectNamespace } from "../../../../utils/projects";
5
- import { envAutocompletion } from "./utils/autocompletions";
4
+ import { envAndComponents } from "./utils/autocompletions";
6
5
 
7
- export default (vorpal: Vorpal) =>
6
+ export default async (vorpal: Vorpal) =>
8
7
  vorpal
9
- .command("project-pause <env>", "halts all running pods (scales to 0)")
10
- .autocomplete(envAutocompletion)
11
- .action(async function ({ env }) {
12
- const namespace = await getProjectNamespace(env as Env);
8
+ .command(
9
+ "project-pause <envComponent>",
10
+ "halts all running pods (scales to 0)"
11
+ )
12
+ .autocomplete(await envAndComponents())
13
+ .action(async function ({ envComponent }) {
14
+ const namespace = await getProjectNamespace(envComponent);
13
15
  const { shouldContinue } = await this.prompt({
14
16
  type: "confirm",
15
17
  name: "shouldContinue",
@@ -0,0 +1,86 @@
1
+ import type Vorpal from "vorpal";
2
+ import { getProjectPodNames } from "../../../../kubernetes";
3
+ import { logError } from "../../../../utils/log";
4
+ import { startKubePortForward } from "../../../../kubernetes/portForward";
5
+ import { getProjectNamespace } from "../../../../utils/projects";
6
+ import { envAndComponents } from "./utils/autocompletions";
7
+ import ensureCluster from "./utils/ensureCluster";
8
+ import type { CommandInstance } from "vorpal";
9
+ import { parseChoice } from "../../../../config/parseChoice";
10
+ import { getPipelineContextByChoice } from "../../../../config/getProjectConfig";
11
+ import type { Context } from "@catladder/pipeline";
12
+ import { isOfDeployType } from "@catladder/pipeline";
13
+ import { startPortForwardCommand } from "../../../../utils/portForwards";
14
+ import open from "open";
15
+ const kubePortForward = async (cmd: CommandInstance, envComponent: string) => {
16
+ await ensureCluster.call(cmd, envComponent);
17
+ const namespace = await getProjectNamespace(envComponent);
18
+ const podNames = await getProjectPodNames(envComponent);
19
+ if (podNames.length === 0) {
20
+ logError(cmd, "sorry, no pods found");
21
+ return;
22
+ }
23
+ const { podName } = await cmd.prompt({
24
+ type: "list",
25
+ name: "podName",
26
+ choices: podNames,
27
+ message: "Which pod? 🤔",
28
+ });
29
+
30
+ const { localPort } = await cmd.prompt({
31
+ type: "number",
32
+ name: "localPort",
33
+
34
+ message: "Local port: ",
35
+ });
36
+
37
+ const { remotePort } = await cmd.prompt({
38
+ type: "number",
39
+ name: "remotePort",
40
+
41
+ message: "Remote port: ",
42
+ });
43
+
44
+ return startKubePortForward(podName, localPort, remotePort, namespace);
45
+ };
46
+
47
+ const cloudRunPortForward = async (cmd: CommandInstance, context: Context) => {
48
+ if (!isOfDeployType(context.componentConfig.deploy, "google-cloudrun")) {
49
+ throw new Error("not cloud run");
50
+ }
51
+
52
+ const { fullName } = context.environment;
53
+ let serviceName = fullName;
54
+ if (context.environment.envType === "review") {
55
+ const { mr } = await cmd.prompt({
56
+ type: "number",
57
+ name: "mr",
58
+
59
+ message: "Which mr 🤔 ",
60
+ });
61
+ // poor mans solution
62
+ serviceName = serviceName.replace("-review-", "-review-mr" + mr + "-");
63
+ }
64
+
65
+ const { projectId, region } = context.componentConfig.deploy;
66
+
67
+ const command = `gcloud beta run services proxy ${serviceName} --project ${projectId} --region ${region}`;
68
+
69
+ await startPortForwardCommand(`cloudRun/${serviceName}`, command);
70
+ open("http://localhost:8080");
71
+ };
72
+ export default async (vorpal: Vorpal) =>
73
+ vorpal
74
+ .command("project-port-forward <envComponent>", "start port-forwarding")
75
+ .autocomplete(await envAndComponents())
76
+ .action(async function ({ envComponent }) {
77
+ const { env, componentName } = parseChoice(envComponent);
78
+ const context = await getPipelineContextByChoice(env, componentName);
79
+
80
+ if (isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
81
+ await kubePortForward(this, envComponent);
82
+ }
83
+ if (isOfDeployType(context.componentConfig.deploy, "google-cloudrun")) {
84
+ await cloudRunPortForward(this, context);
85
+ }
86
+ });
@@ -0,0 +1,27 @@
1
+ /* eslint-disable no-constant-condition */
2
+ import type Vorpal from "vorpal";
3
+ import type { CommandInstance } from "vorpal";
4
+ import { clearBackups } from "../../../../utils/gitlab";
5
+ import { allEnvsAndAllComponents } from "./utils/autocompletions";
6
+
7
+ export const projectSecretsClearBackups = async (
8
+ vorpal: CommandInstance,
9
+ keep = 3
10
+ ) => {
11
+ await clearBackups(vorpal, keep);
12
+ };
13
+
14
+ export default async (vorpal: Vorpal) => {
15
+ vorpal
16
+ .command("project-secrets-clear-backups", "clears all backups")
17
+ .autocomplete(await allEnvsAndAllComponents())
18
+ .action(async function () {
19
+ const { keep } = await this.prompt({
20
+ type: "number",
21
+ name: "keep",
22
+ default: 1,
23
+ message: "How many backups should we keep? 🤔",
24
+ });
25
+ return await projectSecretsClearBackups(this, keep);
26
+ });
27
+ };
@@ -0,0 +1,12 @@
1
+ import type Vorpal from "vorpal";
2
+ import { setupProject } from "./setup";
3
+
4
+ export default async (vorpal: Vorpal) =>
5
+ vorpal
6
+ .command(
7
+ "project-setup",
8
+ "Initializes all environments and creates requires resources, service accounts, etc."
9
+ )
10
+ .action(async function () {
11
+ await setupProject(this);
12
+ });
@@ -1,18 +1,19 @@
1
- import { V1Job, V1ObjectMeta } from "@kubernetes/client-node";
1
+ import type { V1ObjectMeta } from "@kubernetes/client-node";
2
+ import { V1Job } from "@kubernetes/client-node";
2
3
 
3
- import Vorpal from "vorpal";
4
- import { k8sApiBatch, k8sApiBatchBeta } from "../../../../k8sApi";
4
+ import type Vorpal from "vorpal";
5
+ import { getk8sApiBatch, getk8sApiBatchBeta } from "../../../../k8sApi";
5
6
  import { logError } from "../../../../utils/log";
6
7
  import { namespaceAutoCompletion } from "../general/namespaceAutoCompletion";
7
8
 
8
9
  import { getProjectNamespace } from "../../../../utils/projects";
9
- import { envAutocompletion } from "./utils/autocompletions";
10
+ import { envAndComponents } from "./utils/autocompletions";
10
11
  import ensureCluster from "./utils/ensureCluster";
11
12
 
12
13
  async function triggerCronjob(namespace: string) {
13
14
  const {
14
15
  body: { items: jobs },
15
- } = await k8sApiBatchBeta.listNamespacedCronJob(namespace);
16
+ } = await getk8sApiBatchBeta().listNamespacedCronJob(namespace);
16
17
 
17
18
  const jobNames = jobs.map((j) => j.metadata.name);
18
19
 
@@ -34,7 +35,7 @@ async function triggerCronjob(namespace: string) {
34
35
  job.metadata = metadata as V1ObjectMeta;
35
36
  job.spec = jobSpec;
36
37
  try {
37
- const result = await k8sApiBatch.createNamespacedJob(namespace, job);
38
+ const result = await getk8sApiBatch().createNamespacedJob(namespace, job);
38
39
 
39
40
  this.log("");
40
41
  this.log(`yeah, you got a job, man. 😺 ${result.body.metadata.name}`);
@@ -43,7 +44,7 @@ async function triggerCronjob(namespace: string) {
43
44
  logError(this, "command failed", e.body);
44
45
  }
45
46
  }
46
- export default (vorpal: Vorpal) => {
47
+ export default async (vorpal: Vorpal) => {
47
48
  vorpal
48
49
  .command("trigger-cronjob <namespace>", "trigger cronjob")
49
50
  .autocomplete(namespaceAutoCompletion)
@@ -51,11 +52,11 @@ export default (vorpal: Vorpal) => {
51
52
  await triggerCronjob.call(this, namespace);
52
53
  });
53
54
  vorpal
54
- .command("project-trigger-cronjob <env>", "trigger cronjob")
55
- .autocomplete(envAutocompletion)
56
- .action(async function ({ env }) {
57
- await ensureCluster.call(this);
58
- const namespace = await getProjectNamespace(env);
55
+ .command("project-trigger-cronjob <envComponent>", "trigger cronjob")
56
+ .autocomplete(await envAndComponents())
57
+ .action(async function ({ envComponent }) {
58
+ await ensureCluster.call(this, envComponent);
59
+ const namespace = await getProjectNamespace(envComponent);
59
60
  await triggerCronjob.call(this, namespace);
60
61
  });
61
62
  };
@@ -1,15 +1,15 @@
1
- import Vorpal from "vorpal";
1
+ import type Vorpal from "vorpal";
2
2
  import commandCloudSqlProxy from "./commandCloudSqlProxy";
3
3
  import commandConfigSecrets from "./commandConfigSecrets";
4
- import commandCopyDB from "./commandCopyDB";
4
+
5
5
  import commandDeletePods from "./commandDeletePods";
6
6
  import commandDeleteProject from "./commandDeleteProject";
7
7
  import commandEnvVars from "./commandEnvVars";
8
8
  import commandGetMyTotalWorktime from "./commandGetMyTotalWorktime";
9
9
  import commandGetShell from "./commandGetShell";
10
10
  import commandGitlabCi from "./commandGitlabCi";
11
- import commandInitGitlab from "./commandInitGitlab";
12
- import commandInitProject from "./commandInitProject";
11
+ import commandSetup from "./commandSetup";
12
+ //import commandInitProject from "./commandInitProject.old";
13
13
  import commandListPods from "./commandListPods";
14
14
  import commandMigrateHelm3 from "./commandMigrateHelm3";
15
15
  import commandNamespace from "./commandNamespace";
@@ -22,15 +22,15 @@ import commandPauseProject from "./commandPauseProject";
22
22
  import commandOpenGrafana from "./commandOpenGrafana";
23
23
  import commandPortForward from "./commandPortForward";
24
24
  import commandTriggerCronjob from "./commandTriggerCronjob";
25
- import commandVariables from "./commandVariables";
25
+
26
26
  import commandOpenGrafanaPod from "./commandOpenGrafanaPod";
27
+ import commandSecretsClearBackups from "./commandSecretsClearBackups";
28
+
29
+ export default async (vorpal: Vorpal) => {
30
+ commandSetup(vorpal);
27
31
 
28
- export default (vorpal: Vorpal) => {
29
- commandInitProject(vorpal);
30
- commandInitGitlab(vorpal);
31
32
  commandEnvVars(vorpal);
32
33
 
33
- commandVariables(vorpal);
34
34
  commandNamespace(vorpal);
35
35
  commandListPods(vorpal);
36
36
  commandPauseProject(vorpal);
@@ -49,8 +49,8 @@ export default (vorpal: Vorpal) => {
49
49
  commandOpenEnv(vorpal);
50
50
  commandTriggerCronjob(vorpal);
51
51
  commandConfigSecrets(vorpal);
52
+ commandSecretsClearBackups(vorpal);
52
53
  commandDeletePods(vorpal);
53
- commandCopyDB(vorpal);
54
54
 
55
55
  commandGetShell(vorpal);
56
56
  commandPortForward(vorpal);
@@ -0,0 +1,44 @@
1
+ import type { CommandInstance } from "vorpal";
2
+ import { getAllPipelineContexts } from "../../../../../config/getProjectConfig";
3
+ import { projectConfigSecrets } from "../commandConfigSecrets";
4
+ import { setupAccessTokens } from "./setupAccessTokens";
5
+ import { setupContext } from "./setupContext";
6
+ import { setupTopic } from "./setupTopic";
7
+
8
+ export const setupProject = async (instance: CommandInstance) => {
9
+ const allContext = await getAllPipelineContexts();
10
+
11
+ for (const context of allContext) {
12
+ await setupContext(instance, context);
13
+ }
14
+ await setupAccessTokens(instance);
15
+ await setupTopic(instance);
16
+ instance.log("");
17
+ const { configSecrets } = await instance.prompt({
18
+ default: true,
19
+ message: "Before deployments work, you need to config secrets. Do it now?",
20
+ name: "configSecrets",
21
+ type: "confirm",
22
+ });
23
+ instance.log("");
24
+ if (configSecrets) {
25
+ await projectConfigSecrets(instance);
26
+ } else {
27
+ instance.log(
28
+ "👆 don't forget to config secret using `project-config-secrets`"
29
+ );
30
+ }
31
+ instance.log("");
32
+ instance.log("gitlab is ready! 🥂");
33
+ instance.log("\n");
34
+ instance.log("do not forget to make sure that:");
35
+ [
36
+ "you have __health route in place",
37
+ "lint and test are defined",
38
+ "secrets are configured (call project-config-secret)",
39
+ "eat your vegetables",
40
+ "be awesome 🤩",
41
+ ].forEach((tip) => instance.log(` - ${tip}`));
42
+ instance.log("\n");
43
+ instance.log("\n");
44
+ };
@@ -0,0 +1,84 @@
1
+ import open from "open";
2
+ import type { CommandInstance } from "vorpal";
3
+ import { doGitlabRequest, getProjectInfo } from "../../../../../utils/gitlab";
4
+
5
+ export const setupAccessTokens = async (instance: CommandInstance) => {
6
+ const { id: projectId, web_url: projectWebUrl } = await getProjectInfo(
7
+ instance
8
+ );
9
+ try {
10
+ await doGitlabRequest(instance, `projects/${projectId}/variables/GL_TOKEN`);
11
+ } catch (e) {
12
+ if (e.message !== "not found") {
13
+ throw e;
14
+ }
15
+ // not found
16
+
17
+ instance.log(
18
+ "I need add a GL_TOKEN to the project, so that semantic release will work\n"
19
+ );
20
+ instance.log(
21
+ "👉 Please please create a project access token in gitlab and copy its value into clipboard\n\n - name: something like 'semantic-release'\n - expires: leave empty\n - role: maintainer - scopes: api, read_repository"
22
+ );
23
+ instance.log("\n");
24
+
25
+ const { understood } = await instance.prompt({
26
+ default: true,
27
+ message: "Understood and open gitlab now? 🤔",
28
+ name: "understood",
29
+ type: "confirm",
30
+ });
31
+ if (!understood) {
32
+ instance.log("continuing anyway...");
33
+ }
34
+ open(`${projectWebUrl}/-/settings/access_tokens`);
35
+
36
+ instance.log("\n");
37
+
38
+ instance.log("Enter your copied token now: ");
39
+
40
+ instance.log("\n");
41
+ const { GL_TOKEN } = await instance.prompt({
42
+ type: "password",
43
+ name: "GL_TOKEN",
44
+ message: "Access Token: ",
45
+ });
46
+
47
+ await doGitlabRequest(
48
+ instance,
49
+ `projects/${projectId}/variables`,
50
+ {
51
+ key: "GL_TOKEN",
52
+ value: GL_TOKEN,
53
+ masked: true,
54
+ },
55
+ "POST"
56
+ );
57
+ }
58
+
59
+ const deploy_tokens = await doGitlabRequest(
60
+ instance,
61
+ `projects/${projectId}/deploy_tokens`
62
+ );
63
+
64
+ if (
65
+ !deploy_tokens.find(
66
+ (v: { name: string }) => v.name === "gitlab-deploy-token"
67
+ )
68
+ ) {
69
+ instance.log(
70
+ "I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project."
71
+ );
72
+
73
+ await doGitlabRequest(
74
+ instance,
75
+ `projects/${projectId}/deploy_tokens`,
76
+ {
77
+ id: projectId,
78
+ name: "gitlab-deploy-token",
79
+ scopes: ["read_registry"],
80
+ },
81
+ "POST"
82
+ );
83
+ }
84
+ };