@catladder/cli 0.0.1-bla → 1.0.3

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 (288) hide show
  1. package/.nvmrc +1 -1
  2. package/bin/catenv +3 -0
  3. package/bin/catladder +1 -1
  4. package/dist/apps/catenv/catenv.d.ts +2 -0
  5. package/dist/apps/catenv/catenv.js +135 -0
  6. package/dist/apps/catenv/catenv.js.map +1 -0
  7. package/dist/apps/cli/cli.d.ts +2 -0
  8. package/dist/apps/cli/cli.js +81 -0
  9. package/dist/apps/cli/cli.js.map +1 -0
  10. package/dist/apps/cli/commands/general/index.d.ts +4 -0
  11. package/dist/apps/cli/commands/general/index.js +274 -0
  12. package/dist/apps/cli/commands/general/index.js.map +1 -0
  13. package/dist/apps/cli/commands/general/namespaceAutoCompletion.d.ts +3 -0
  14. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +56 -0
  15. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -0
  16. package/dist/apps/cli/commands/general/portForward.d.ts +3 -0
  17. package/dist/apps/cli/commands/general/portForward.js +98 -0
  18. package/dist/apps/cli/commands/general/portForward.js.map +1 -0
  19. package/dist/apps/cli/commands/mongodb/index.d.ts +3 -0
  20. package/dist/apps/cli/commands/mongodb/index.js +53 -0
  21. package/dist/apps/cli/commands/mongodb/index.js.map +1 -0
  22. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +3 -0
  23. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +190 -0
  24. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -0
  25. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +3 -0
  26. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js +96 -0
  27. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -0
  28. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +3 -0
  29. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +105 -0
  30. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -0
  31. package/dist/apps/cli/commands/mongodb/utils/index.d.ts +13 -0
  32. package/dist/apps/cli/commands/mongodb/utils/index.js +167 -0
  33. package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -0
  34. package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +3 -0
  35. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +128 -0
  36. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
  37. package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +3 -0
  38. package/dist/apps/cli/commands/project/commandConfigSecrets.js +254 -0
  39. package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
  40. package/dist/apps/cli/commands/project/commandCopyDB.d.ts +3 -0
  41. package/dist/apps/cli/commands/project/commandCopyDB.js +102 -0
  42. package/dist/apps/cli/commands/project/commandCopyDB.js.map +1 -0
  43. package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
  44. package/dist/apps/cli/commands/project/commandDeletePods.js +119 -0
  45. package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -0
  46. package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +3 -0
  47. package/dist/apps/cli/commands/project/commandDeleteProject.js +97 -0
  48. package/dist/apps/cli/commands/project/commandDeleteProject.js.map +1 -0
  49. package/dist/apps/cli/commands/project/commandEnvVars.d.ts +3 -0
  50. package/dist/apps/cli/commands/project/commandEnvVars.js +74 -0
  51. package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -0
  52. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +3 -0
  53. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +58 -0
  54. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -0
  55. package/dist/apps/cli/commands/project/commandGetShell.d.ts +3 -0
  56. package/dist/apps/cli/commands/project/commandGetShell.js +92 -0
  57. package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -0
  58. package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +3 -0
  59. package/dist/apps/cli/commands/project/commandGitlabCi.js +185 -0
  60. package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -0
  61. package/dist/apps/cli/commands/project/commandInitGitlab.d.ts +3 -0
  62. package/dist/apps/cli/commands/project/commandInitGitlab.js +245 -0
  63. package/dist/apps/cli/commands/project/commandInitGitlab.js.map +1 -0
  64. package/dist/apps/cli/commands/project/commandInitProject.d.ts +3 -0
  65. package/dist/apps/cli/commands/project/commandInitProject.js +345 -0
  66. package/dist/apps/cli/commands/project/commandInitProject.js.map +1 -0
  67. package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
  68. package/dist/apps/cli/commands/project/commandListPods.js +78 -0
  69. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
  70. package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
  71. package/dist/apps/cli/commands/project/commandMigrateHelm3.js +113 -0
  72. package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
  73. package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
  74. package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
  75. package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
  76. package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
  77. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
  78. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
  79. package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
  80. package/dist/apps/cli/commands/project/commandOpenDashboard.js +92 -0
  81. package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
  82. package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
  83. package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
  84. package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
  85. package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
  86. package/dist/apps/cli/commands/project/commandOpenGit.js +56 -0
  87. package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
  88. package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
  89. package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
  90. package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
  91. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
  92. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +99 -0
  93. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
  94. package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
  95. package/dist/apps/cli/commands/project/commandOpenLogs.js +87 -0
  96. package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
  97. package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
  98. package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
  99. package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
  100. package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
  101. package/dist/apps/cli/commands/project/commandPortForward.js +106 -0
  102. package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
  103. package/dist/apps/cli/commands/project/commandReloadConfig.d.ts +3 -0
  104. package/dist/apps/cli/commands/project/commandReloadConfig.js +62 -0
  105. package/dist/apps/cli/commands/project/commandReloadConfig.js.map +1 -0
  106. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
  107. package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
  108. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
  109. package/dist/apps/cli/commands/project/index.d.ts +3 -0
  110. package/dist/apps/cli/commands/project/index.js +97 -0
  111. package/dist/apps/cli/commands/project/index.js.map +1 -0
  112. package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
  113. package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
  114. package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
  115. package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
  116. package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
  117. package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
  118. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +1 -0
  119. package/dist/apps/cli/commands/project/utils/ensureNamespace.js +92 -0
  120. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
  121. package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
  122. package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
  123. package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
  124. package/dist/apps/cli/commands/shared/index.d.ts +2 -0
  125. package/dist/apps/cli/commands/shared/index.js +72 -0
  126. package/dist/apps/cli/commands/shared/index.js.map +1 -0
  127. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
  128. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +131 -0
  129. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
  130. package/dist/apps/cli/config/writeConfig.d.ts +5 -0
  131. package/dist/apps/cli/config/writeConfig.js +104 -0
  132. package/dist/apps/cli/config/writeConfig.js.map +1 -0
  133. package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
  134. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
  135. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
  136. package/dist/apps/cli/verify/index.d.ts +2 -0
  137. package/dist/apps/cli/verify/index.js +90 -0
  138. package/dist/apps/cli/verify/index.js.map +1 -0
  139. package/dist/apps/cli/verify/migration/fromv2.d.ts +3 -0
  140. package/dist/apps/cli/verify/migration/fromv2.js +322 -0
  141. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
  142. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
  143. package/dist/apps/cli/verify/migration/migrateSecrets.js +88 -0
  144. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
  145. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +17 -0
  146. package/dist/apps/cli/verify/migration/oldGitlabCi.js +26 -0
  147. package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
  148. package/dist/catenv.d.ts +1 -0
  149. package/dist/catenv.js +8 -0
  150. package/dist/catenv.js.map +1 -0
  151. package/dist/cli.d.ts +1 -0
  152. package/dist/cli.js +13 -0
  153. package/dist/cli.js.map +1 -0
  154. package/dist/config/clusters.d.ts +14 -0
  155. package/dist/config/clusters.js +72 -0
  156. package/dist/config/clusters.js.map +1 -0
  157. package/dist/config/constants.d.ts +4 -0
  158. package/dist/config/constants.js +8 -0
  159. package/dist/config/constants.js.map +1 -0
  160. package/dist/config/getProjectConfig.d.ts +21 -0
  161. package/dist/config/getProjectConfig.js +212 -0
  162. package/dist/config/getProjectConfig.js.map +1 -0
  163. package/dist/k8sApi/index.d.ts +5 -0
  164. package/dist/k8sApi/index.js +11 -0
  165. package/dist/k8sApi/index.js.map +1 -0
  166. package/dist/packageInfos.d.ts +2 -0
  167. package/dist/packageInfos.js +6 -0
  168. package/dist/packageInfos.js.map +1 -0
  169. package/dist/tsconfig.tsbuildinfo +1 -0
  170. package/dist/types/types.d.ts +18 -0
  171. package/dist/types/types.js +3 -0
  172. package/dist/types/types.js.map +1 -0
  173. package/dist/utils/cluster.d.ts +12 -0
  174. package/dist/utils/cluster.js +100 -0
  175. package/dist/utils/cluster.js.map +1 -0
  176. package/dist/utils/editAsFile.d.ts +1 -0
  177. package/dist/utils/editAsFile.js +85 -0
  178. package/dist/utils/editAsFile.js.map +1 -0
  179. package/dist/utils/files.d.ts +2 -0
  180. package/dist/utils/files.js +83 -0
  181. package/dist/utils/files.js.map +1 -0
  182. package/dist/utils/formatEnvVars.d.ts +2 -0
  183. package/dist/utils/formatEnvVars.js +10 -0
  184. package/dist/utils/formatEnvVars.js.map +1 -0
  185. package/dist/utils/getEditor.d.ts +4 -0
  186. package/dist/utils/getEditor.js +70 -0
  187. package/dist/utils/getEditor.js.map +1 -0
  188. package/dist/utils/gitlab.d.ts +21 -0
  189. package/dist/utils/gitlab.js +258 -0
  190. package/dist/utils/gitlab.js.map +1 -0
  191. package/dist/utils/log.d.ts +1 -0
  192. package/dist/utils/log.js +14 -0
  193. package/dist/utils/log.js.map +1 -0
  194. package/dist/utils/passwordstore/index.d.ts +8 -0
  195. package/dist/utils/passwordstore/index.js +378 -0
  196. package/dist/utils/passwordstore/index.js.map +1 -0
  197. package/dist/utils/portForward.d.ts +4 -0
  198. package/dist/utils/portForward.js +116 -0
  199. package/dist/utils/portForward.js.map +1 -0
  200. package/dist/utils/preferences/index.d.ts +3 -0
  201. package/dist/utils/preferences/index.js +119 -0
  202. package/dist/utils/preferences/index.js.map +1 -0
  203. package/dist/utils/projects/index.d.ts +8 -0
  204. package/dist/utils/projects/index.js +150 -0
  205. package/dist/utils/projects/index.js.map +1 -0
  206. package/dist/utils/promise.d.ts +2 -0
  207. package/dist/utils/promise.js +62 -0
  208. package/dist/utils/promise.js.map +1 -0
  209. package/dist/utils/shell.d.ts +1 -0
  210. package/dist/utils/shell.js +81 -0
  211. package/dist/utils/shell.js.map +1 -0
  212. package/package.json +12 -20
  213. package/src/apps/catenv/catenv.ts +48 -27
  214. package/src/apps/{shell/shell.ts → cli/cli.ts} +10 -2
  215. package/src/apps/{shell → cli}/commands/general/index.ts +1 -1
  216. package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
  217. package/src/apps/{shell → cli}/commands/general/portForward.ts +1 -1
  218. package/src/apps/{shell → cli}/commands/mongodb/index.ts +1 -1
  219. package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +18 -18
  220. package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +12 -10
  221. package/src/apps/{shell → cli}/commands/mongodb/projectMongoPortForward.ts +13 -8
  222. package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +9 -8
  223. package/src/apps/{shell → cli}/commands/project/commandCloudSqlProxy.ts +23 -17
  224. package/src/apps/cli/commands/project/commandConfigSecrets.ts +208 -0
  225. package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +22 -23
  226. package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +8 -9
  227. package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +7 -8
  228. package/src/apps/cli/commands/project/commandEnvVars.ts +15 -0
  229. package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +2 -2
  230. package/src/apps/{shell → cli}/commands/project/commandGetShell.ts +10 -10
  231. package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
  232. package/src/apps/cli/commands/project/commandInitGitlab.ts +203 -0
  233. package/src/apps/{shell → cli}/commands/project/commandInitProject.ts +14 -6
  234. package/src/apps/cli/commands/project/commandListPods.ts +18 -0
  235. package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +16 -7
  236. package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
  237. package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +10 -7
  238. package/src/apps/cli/commands/project/commandOpenDashboard.ts +45 -0
  239. package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
  240. package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +1 -1
  241. package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +7 -7
  242. package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +9 -10
  243. package/src/apps/{shell → cli}/commands/project/commandOpenLogs.ts +7 -7
  244. package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +9 -7
  245. package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +8 -8
  246. package/src/apps/cli/commands/project/commandReloadConfig.ts +12 -0
  247. package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +7 -7
  248. package/src/apps/{shell → cli}/commands/project/index.ts +4 -3
  249. package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
  250. package/src/apps/cli/commands/project/utils/ensureCluster.ts +37 -0
  251. package/src/apps/{shell → cli}/commands/project/utils/ensureNamespace.ts +2 -3
  252. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
  253. package/src/apps/{shell → cli}/commands/shared/index.ts +0 -0
  254. package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +11 -11
  255. package/src/apps/cli/config/writeConfig.ts +69 -0
  256. package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
  257. package/src/apps/cli/verify/index.ts +34 -0
  258. package/src/apps/cli/verify/migration/fromv2.ts +241 -0
  259. package/src/apps/cli/verify/migration/migrateSecrets.ts +37 -0
  260. package/src/apps/cli/verify/migration/oldGitlabCi.ts +43 -0
  261. package/src/catenv.ts +3 -0
  262. package/src/cli.ts +8 -0
  263. package/src/config/getProjectConfig.ts +118 -0
  264. package/src/types/types.ts +0 -2
  265. package/src/utils/cluster.ts +15 -2
  266. package/src/utils/editAsFile.ts +31 -0
  267. package/src/utils/files.ts +6 -2
  268. package/src/utils/gitlab.ts +126 -32
  269. package/src/utils/passwordstore/index.ts +19 -21
  270. package/src/utils/preferences/index.ts +6 -3
  271. package/src/utils/projects/index.ts +14 -134
  272. package/tsconfig.json +3 -7
  273. package/bin/catenv.sh +0 -1
  274. package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
  275. package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
  276. package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
  277. package/src/apps/shell/commands/project/commandListPods.ts +0 -21
  278. package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
  279. package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
  280. package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
  281. package/src/apps/shell/commands/project/commandVariables.ts +0 -13
  282. package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
  283. package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
  284. package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
  285. package/src/index.ts +0 -17
  286. package/src/types/git-repo-name.d.ts +0 -1
  287. package/src/types/yawn-yaml.d.ts +0 -1
  288. package/src/utils/dashboardToken.ts +0 -20
@@ -0,0 +1,203 @@
1
+ import { isOfDeployType } from "@catladder/pipeline";
2
+ import open from "open";
3
+ import Vorpal from "vorpal";
4
+ import { getAllPipelineContexts } from "../../../../config/getProjectConfig";
5
+ import {
6
+ getClusterByFullName,
7
+ getClusterByName,
8
+ } from "../../../../utils/cluster";
9
+ import { doGitlabRequest, getProjectInfo } from "../../../../utils/gitlab";
10
+ import { readPass } from "../../../../utils/passwordstore";
11
+ import { getProjectNamespace } from "../../../../utils/projects";
12
+
13
+ export default async (vorpal: Vorpal) =>
14
+ vorpal
15
+ .command(
16
+ "project-init-gitlab",
17
+ "Initializes the gitlab repo, e.g. connects the cluster to it"
18
+ )
19
+ .action(async function () {
20
+ const { id: projectId, web_url: projectWebUrl } = await getProjectInfo(
21
+ this
22
+ );
23
+ const existingGitlabClusters = await doGitlabRequest<{ name: string }[]>(
24
+ this,
25
+ `projects/${projectId}/clusters`
26
+ );
27
+
28
+ const existingClusters = existingGitlabClusters.map(
29
+ (c: { name: string }) => {
30
+ const found = getClusterByFullName(c.name);
31
+
32
+ return {
33
+ name: found ? found.name : null,
34
+ fullName: c.name,
35
+ };
36
+ }
37
+ );
38
+
39
+ if (existingClusters.length === 0) {
40
+ this.log("");
41
+ this.log("there is no cluster on the current project?");
42
+ } else {
43
+ this.log("there are already these clusters on the gitlab: ");
44
+ this.log("");
45
+ existingClusters.forEach((cluster) =>
46
+ this.log(` - ${cluster.name || "unknown"} (${cluster.fullName})`)
47
+ );
48
+ }
49
+
50
+ this.log("");
51
+ this.log("your project specifies the following clusters:");
52
+ this.log("");
53
+ const allContext = await getAllPipelineContexts();
54
+ const allDeployments = allContext.map((c) => c.componentConfig.deploy);
55
+
56
+ const configuredClusterNames = allDeployments.reduce<string[]>(
57
+ (acc, c) => {
58
+ if (
59
+ isOfDeployType(c, "kubernetes") &&
60
+ !acc.includes(c.cluster || "production")
61
+ ) {
62
+ return [...acc, c.cluster || "production"];
63
+ }
64
+ return acc;
65
+ },
66
+ []
67
+ );
68
+ const configuredClusters = configuredClusterNames.map((c) => ({
69
+ name: c,
70
+ config: getClusterByName(c),
71
+ }));
72
+ configuredClusters.forEach((cluster) =>
73
+ this.log(` - ${cluster.name || "unknown"} (${cluster.config.fullName})`)
74
+ );
75
+ this.log("");
76
+
77
+ const missingClusters = configuredClusters.filter(
78
+ (c) => !existingClusters.some((exist) => exist.name === c.name)
79
+ );
80
+
81
+ this.log("");
82
+ this.log("These clusters are not configured yet on gitlab:");
83
+ this.log("");
84
+
85
+ missingClusters.forEach((cluster) =>
86
+ this.log(` - ${cluster.name || "unknown"} (${cluster.config.fullName})`)
87
+ );
88
+ this.log("");
89
+
90
+ for (const cluster of missingClusters) {
91
+ this.log(`${cluster} (${cluster.config.fullName})`);
92
+ this.log("");
93
+ const { shouldContinue } = await this.prompt({
94
+ type: "confirm",
95
+ name: "shouldContinue",
96
+ message: "Should I add the this cluster ? 🤔 ",
97
+ });
98
+ this.log("");
99
+ if (shouldContinue) {
100
+ const { api_url, passCredentials } = cluster.config;
101
+ if (!api_url) {
102
+ throw new Error("no api_url on this cluster!");
103
+ }
104
+ if (!passCredentials) {
105
+ throw new Error("no passCredentials on this cluster!");
106
+ }
107
+ const token = await readPass(passCredentials.token);
108
+ const ca_cert = await readPass(passCredentials.ca_cert);
109
+
110
+ const postResult = await doGitlabRequest(
111
+ this,
112
+ `projects/${projectId}/clusters/user`,
113
+ {
114
+ name: cluster.config.fullName,
115
+ managed: false,
116
+ platform_kubernetes_attributes: {
117
+ api_url,
118
+ ca_cert,
119
+ token,
120
+ namespace: await getProjectNamespace("prod"),
121
+ },
122
+ }
123
+ );
124
+ const { message } = postResult;
125
+ if (message) {
126
+ this.log(`Message from gitlab: ${message}`);
127
+ }
128
+ }
129
+ }
130
+
131
+ const variables = await doGitlabRequest(
132
+ this,
133
+ `projects/${projectId}/variables`
134
+ );
135
+
136
+ if (!variables.find((v: any) => v.key === "GL_TOKEN")) {
137
+ this.log(
138
+ "I need add a GL_TOKEN to the project, so that semantic release will work\n"
139
+ );
140
+ this.log(
141
+ "👉 Please please create a project access token in gitlab and copy its value into clipboard\n\n - name: something like 'semantic-release'\n - expires: leave empty\n - scopes: api, read_repository"
142
+ );
143
+ this.log("\n");
144
+
145
+ const { understood } = await this.prompt({
146
+ default: true,
147
+ message: "Understood and open gitlab now? 🤔",
148
+ name: "understood",
149
+ type: "confirm",
150
+ });
151
+ if (!understood) {
152
+ this.log("continuing anyway...");
153
+ }
154
+ open(`${projectWebUrl}/-/settings/access_tokens`);
155
+
156
+ this.log("\n");
157
+
158
+ this.log("Enter your copied token now: ");
159
+
160
+ this.log("\n");
161
+ const { GL_TOKEN } = await this.prompt({
162
+ type: "password",
163
+ name: "GL_TOKEN",
164
+ message: "Access Token: ",
165
+ });
166
+ await doGitlabRequest(this, `projects/${projectId}/variables`, {
167
+ key: "GL_TOKEN",
168
+ value: GL_TOKEN,
169
+ });
170
+ }
171
+
172
+ const deploy_tokens = await doGitlabRequest(
173
+ this,
174
+ `projects/${projectId}/deploy_tokens`
175
+ );
176
+
177
+ if (
178
+ !deploy_tokens.find(
179
+ (v: { name: string }) => v.name === "gitlab-deploy-token"
180
+ )
181
+ ) {
182
+ this.log(
183
+ "I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project."
184
+ );
185
+
186
+ await doGitlabRequest(this, `projects/${projectId}/deploy_tokens`, {
187
+ id: projectId,
188
+ name: "gitlab-deploy-token",
189
+ scopes: ["read_registry"],
190
+ });
191
+ }
192
+ this.log("gitlab is ready! 🥂");
193
+ this.log("\n");
194
+ this.log("do not forget to make sure that:");
195
+ [
196
+ "you have __health route in place",
197
+ "lint and test are defined",
198
+ "eat your vegetables",
199
+ "be awesome 🤩",
200
+ ].forEach((tip) => this.log(` - ${tip}`));
201
+ this.log("\n");
202
+ this.log("\n");
203
+ });
@@ -1,5 +1,5 @@
1
1
  import { readFile, writeFile } from "fs-extra";
2
- import { safeDump } from "js-yaml";
2
+ import { dump } from "js-yaml";
3
3
  import { mapKeys, snakeCase, toUpper } from "lodash";
4
4
  import path from "path";
5
5
  import Vorpal from "vorpal";
@@ -29,7 +29,7 @@ const DEFAULT_VARIABLES = {
29
29
  clusterName: "production",
30
30
  };
31
31
  // TODO: we should find a way how to fetch the variables of the inclues directly from gitlab
32
- const DEFAULT_NODE_APPLICATION = {};
32
+ const DEFAULT_NODE_asdfAPPLICATION = {};
33
33
 
34
34
  const DEFAULT_FILES_TO_CREATE: FileToCreate[] = [
35
35
  {
@@ -38,6 +38,9 @@ const DEFAULT_FILES_TO_CREATE: FileToCreate[] = [
38
38
  readFile(path.resolve(__dirname, "../includes/envrc"), "utf8"),
39
39
  },
40
40
  ];
41
+ /*
42
+
43
+ TODO: reimplement as PRESETS ?
41
44
  const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
42
45
  nextJS: {
43
46
  variables: {},
@@ -154,7 +157,7 @@ const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
154
157
  {
155
158
  filename: "values-review.yml",
156
159
  content: async () =>
157
- safeDump({
160
+ dump({
158
161
  jobs: {
159
162
  "db-prepare-seed": {
160
163
  hook: "post-install",
@@ -180,10 +183,15 @@ const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
180
183
  values: {},
181
184
  },
182
185
  };
183
- export default (vorpal: Vorpal) =>
186
+
187
+ */
188
+
189
+ const PLATFORMS: any = {};
190
+ export default async (vorpal: Vorpal) =>
184
191
  vorpal
185
192
  .command("project-init", "Inits a new project")
186
193
  .action(async function () {
194
+ throw new Error("needs reimplementation");
187
195
  const hasGitlabFile = await hasGitlabCiFile();
188
196
  if (hasGitlabFile) {
189
197
  this.log("there is already a gitlab-ci.yml file. Skipping");
@@ -251,7 +259,7 @@ export default (vorpal: Vorpal) =>
251
259
  variables: transformedVariables,
252
260
  };
253
261
 
254
- const gitlabCiContent = safeDump(gitlabCiContentObj);
262
+ const gitlabCiContent = dump(gitlabCiContentObj);
255
263
  await writeFile(".gitlab-ci.yml", gitlabCiContent);
256
264
 
257
265
  allFilesToCreate.forEach(async ({ filename, content }) => {
@@ -260,7 +268,7 @@ export default (vorpal: Vorpal) =>
260
268
  await writeFile(filename, theContent);
261
269
  });
262
270
 
263
- await writeFile("values.yml", safeDump(values));
271
+ await writeFile("values.yml", dump(values));
264
272
 
265
273
  this.log("");
266
274
  this.log("gitlab-ci created! 💪😻");
@@ -0,0 +1,18 @@
1
+ import { dump } from "js-yaml";
2
+ import { pick } from "lodash";
3
+ import Vorpal from "vorpal";
4
+ import { getProjectPods } from "../../../../utils/projects";
5
+ import { envAndComponents } from "./utils/autocompletions";
6
+ import ensureCluster from "./utils/ensureCluster";
7
+
8
+ export default async (vorpal: Vorpal) =>
9
+ vorpal
10
+ .command("project-list-pods <envComponent>", "list pods of local project")
11
+ .autocomplete(await envAndComponents())
12
+ .action(async function ({ envComponent }) {
13
+ await ensureCluster.call(this, envComponent);
14
+ const pods = await getProjectPods(envComponent);
15
+ this.log(
16
+ dump(pods.map((p) => pick(p, ["metadata.name", "status.startTime"])))
17
+ );
18
+ });
@@ -1,24 +1,31 @@
1
1
  import { exec } from "child-process-promise";
2
2
  import Vorpal from "vorpal";
3
+ import {
4
+ getEnvironment,
5
+ parseChoice,
6
+ } from "../../../../config/getProjectConfig";
3
7
  import { logError } from "../../../../utils/log";
4
- import { getProjectHelmReleaseName } from "../../../../utils/projects";
5
- import { envAutocompletion } from "./utils/autocompletions";
8
+
9
+ import { envAndComponents } from "./utils/autocompletions";
6
10
 
7
11
  /**
8
12
  * Error: rendered manifests contain a resource that already exists.
9
13
  * Unable to continue with install: ConfigMap "web-app-env" in namespace "pvl-bike2school-dev" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "pvl-bike2school-dev-web"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "pvl-bike2school-dev"
10
14
  */
11
- export default (vorpal: Vorpal) =>
15
+ export default async (vorpal: Vorpal) =>
12
16
  vorpal
13
17
  .command(
14
- "project-migrate-helm3 <env>",
18
+ "project-migrate-helm3 <envComponent>",
15
19
  "Do manual step for helm2 to helm3 migration"
16
20
  )
17
21
  .autocomplete(
18
- envAutocompletion.filter((e) => e !== "dev-local" && e !== "review")
22
+ (await envAndComponents()).filter(
23
+ (e) => !e.startsWith("local") && !e.startsWith("review")
24
+ )
19
25
  )
20
- .action(async function ({ env }) {
26
+ .action(async function ({ envComponent }) {
21
27
  try {
28
+ const { env, componentName } = parseChoice(envComponent);
22
29
  const result = await exec("helm version --short");
23
30
  const version = result.stdout as string;
24
31
  this.log(`your helm version: ${version}`);
@@ -35,7 +42,9 @@ export default (vorpal: Vorpal) =>
35
42
  } catch (e) {
36
43
  // ignore
37
44
  }
38
- const releaseName = await getProjectHelmReleaseName(env);
45
+
46
+ const releaseName = (await getEnvironment(env, componentName)).envVars
47
+ .RELEASE_NAME; // TODO: maybe its own function would be better
39
48
  this.log(`helm release name: ${releaseName}`);
40
49
  this.log("");
41
50
  this.log("migrating now... 😼. This may take a moment");
@@ -0,0 +1,14 @@
1
+ import 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
+ });
@@ -9,15 +9,18 @@ import { startPortForward } from "../../../../utils/portForward";
9
9
 
10
10
  import { getProjectNamespace } from "../../../../utils/projects";
11
11
 
12
- import { envAutocompletion } from "./utils/autocompletions";
12
+ import { envAndComponents } from "./utils/autocompletions";
13
13
  import ensureCluster from "./utils/ensureCluster";
14
- export default (vorpal: Vorpal) =>
14
+ export default async (vorpal: Vorpal) =>
15
15
  vorpal
16
- .command("project-check-costs <env>", "Shows you how much you're spending")
17
- .autocomplete(envAutocompletion)
18
- .action(async function ({ env }) {
19
- await ensureCluster.call(this);
20
- const namespace = await getProjectNamespace(env);
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);
21
24
  const url = `http://localhost:${GRAFANA_PROXY_LOCAL_PORT}/namespace.html?name=${namespace}`;
22
25
  await startPortForward(
23
26
  "deployment/kubecost-cost-analyzer",
@@ -0,0 +1,45 @@
1
+ import Vorpal from "vorpal";
2
+ import {
3
+ getPipelineContextByChoice,
4
+ parseChoice,
5
+ } from "../../../../config/getProjectConfig";
6
+ import { getCurrentConnectedClusterName } from "../../../../utils/cluster";
7
+ import { getGoogleAuthUserNumber } from "../../utils/getGoogleAuthUserNumber";
8
+ import { openGoogleCloudKubernetesDashboard } from "../shared";
9
+ import { envAndComponents } from "./utils/autocompletions";
10
+ import ensureCluster from "./utils/ensureCluster";
11
+ export default async (vorpal: Vorpal) =>
12
+ vorpal
13
+ .command(
14
+ "project-open-dashboard <envComponent>",
15
+ "open kubernetes dashboard on google"
16
+ )
17
+ .autocomplete(await envAndComponents())
18
+ .action(async function ({ envComponent }) {
19
+ const { env, componentName } = parseChoice(envComponent);
20
+ const { componentConfig, environment } = await getPipelineContextByChoice(
21
+ env,
22
+ componentName
23
+ );
24
+
25
+ if (
26
+ !componentConfig.deploy ||
27
+ componentConfig.deploy.type !== "kubernetes"
28
+ ) {
29
+ throw new Error(
30
+ "only kubernetes deployments are supported at the moment"
31
+ );
32
+ }
33
+ // currently only supports kubernetes
34
+ const namespace = environment.envVars.KUBE_NAMESPACE;
35
+ await ensureCluster.call(this, envComponent); // TODO: implement
36
+ const clustername = await getCurrentConnectedClusterName();
37
+
38
+ const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
39
+
40
+ openGoogleCloudKubernetesDashboard(
41
+ authGoogleNumber,
42
+ clustername,
43
+ namespace
44
+ );
45
+ });
@@ -0,0 +1,22 @@
1
+ import open from "open";
2
+ import 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
1
  import { exec } from "child-process-promise";
2
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",
@@ -8,18 +8,18 @@ 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
24
  await startPortForward(
25
25
  "deployment/kubecost-cost-analyzer",
@@ -6,24 +6,23 @@ import {
6
6
  } from "../../../../config/constants";
7
7
  import { logError } from "../../../../utils/log";
8
8
  import { startPortForward } from "../../../../utils/portForward";
9
-
10
9
  import {
11
10
  getProjectNamespace,
12
11
  getProjectPodNames,
13
12
  } from "../../../../utils/projects";
14
-
15
- import { envAutocompletion } from "./utils/autocompletions";
13
+ import { envAndComponents } from "./utils/autocompletions";
16
14
  import ensureCluster from "./utils/ensureCluster";
17
- export default (vorpal: Vorpal) =>
15
+
16
+ export default async (vorpal: Vorpal) =>
18
17
  vorpal
19
18
  .command(
20
- "project-open-grafana-pod <env>",
19
+ "project-open-grafana-pod <envComponent>",
21
20
  "open Grafana dashboard for a specific pod"
22
21
  )
23
- .autocomplete(envAutocompletion)
24
- .action(async function ({ env }) {
25
- await ensureCluster.call(this);
26
- const podNames = await getProjectPodNames(env);
22
+ .autocomplete(await envAndComponents())
23
+ .action(async function ({ envComponent }) {
24
+ await ensureCluster.call(this, envComponent);
25
+ const podNames = await getProjectPodNames(envComponent);
27
26
  if (podNames.length === 0) {
28
27
  logError(this, "sorry, no pods found");
29
28
  return;
@@ -34,7 +33,7 @@ export default (vorpal: Vorpal) =>
34
33
  choices: podNames,
35
34
  message: "Which pod? 🤔",
36
35
  });
37
- const namespace = await getProjectNamespace(env);
36
+ const namespace = await getProjectNamespace(envComponent);
38
37
  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
38
  await startPortForward(
40
39
  "deployment/kubecost-cost-analyzer",
@@ -3,20 +3,20 @@ import { getCurrentConnectedClusterName } from "../../../../utils/cluster";
3
3
  import { getProjectNamespace } from "../../../../utils/projects";
4
4
  import { getGoogleAuthUserNumber } from "../../utils/getGoogleAuthUserNumber";
5
5
  import { openGoogleCloudLogs } from "../shared";
6
- import { envAutocompletion } from "./utils/autocompletions";
6
+ import { envAndComponents } from "./utils/autocompletions";
7
7
  import ensureCluster from "./utils/ensureCluster";
8
8
 
9
- export default (vorpal: Vorpal) =>
9
+ export default async (vorpal: Vorpal) =>
10
10
  vorpal
11
11
  .command(
12
- "project-open-logs <env>",
12
+ "project-open-logs <envComponent>",
13
13
  "open google cloud logs (stackdriver logs)"
14
14
  )
15
- .autocomplete(envAutocompletion)
16
- .action(async function ({ env }) {
17
- await ensureCluster.call(this);
15
+ .autocomplete(await envAndComponents())
16
+ .action(async function ({ envComponent }) {
17
+ await ensureCluster.call(this, envComponent);
18
18
  const clustername = await getCurrentConnectedClusterName();
19
- const namespace = await getProjectNamespace(env);
19
+ const namespace = await getProjectNamespace(envComponent);
20
20
  const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
21
21
 
22
22
  await openGoogleCloudLogs(authGoogleNumber, clustername, namespace);
@@ -1,15 +1,17 @@
1
1
  import 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",
@@ -5,17 +5,17 @@ import {
5
5
  getProjectNamespace,
6
6
  getProjectPodNames,
7
7
  } from "../../../../utils/projects";
8
- import { envAutocompletion } from "./utils/autocompletions";
8
+ import { envAndComponents } from "./utils/autocompletions";
9
9
  import ensureCluster from "./utils/ensureCluster";
10
10
 
11
- export default (vorpal: Vorpal) =>
11
+ export default async (vorpal: Vorpal) =>
12
12
  vorpal
13
- .command("project-port-forward <env>", "start port-forwarding")
14
- .autocomplete(envAutocompletion)
15
- .action(async function ({ env }) {
16
- await ensureCluster.call(this);
17
- const namespace = await getProjectNamespace(env);
18
- const podNames = await getProjectPodNames(env);
13
+ .command("project-port-forward <envComponent>", "start port-forwarding")
14
+ .autocomplete(await envAndComponents())
15
+ .action(async function ({ envComponent }) {
16
+ await ensureCluster.call(this, envComponent);
17
+ const namespace = await getProjectNamespace(envComponent);
18
+ const podNames = await getProjectPodNames(envComponent);
19
19
  if (podNames.length === 0) {
20
20
  logError(this, "sorry, no pods found");
21
21
  return;
@@ -0,0 +1,12 @@
1
+ import Vorpal from "vorpal";
2
+ import { reloadConfig } from "../../../../config/getProjectConfig";
3
+ import { showProjectBanner } from "./utils/showProjectBanner";
4
+
5
+ export default async (vorpal: Vorpal) =>
6
+ vorpal
7
+ .command("project-reload-config", "reloads the config")
8
+
9
+ .action(async function () {
10
+ await reloadConfig();
11
+ await showProjectBanner(vorpal);
12
+ });
@@ -6,7 +6,7 @@ import { logError } from "../../../../utils/log";
6
6
  import { namespaceAutoCompletion } from "../general/namespaceAutoCompletion";
7
7
 
8
8
  import { getProjectNamespace } from "../../../../utils/projects";
9
- import { envAutocompletion } from "./utils/autocompletions";
9
+ import { envAndComponents } from "./utils/autocompletions";
10
10
  import ensureCluster from "./utils/ensureCluster";
11
11
 
12
12
  async function triggerCronjob(namespace: string) {
@@ -43,7 +43,7 @@ async function triggerCronjob(namespace: string) {
43
43
  logError(this, "command failed", e.body);
44
44
  }
45
45
  }
46
- export default (vorpal: Vorpal) => {
46
+ export default async (vorpal: Vorpal) => {
47
47
  vorpal
48
48
  .command("trigger-cronjob <namespace>", "trigger cronjob")
49
49
  .autocomplete(namespaceAutoCompletion)
@@ -51,11 +51,11 @@ export default (vorpal: Vorpal) => {
51
51
  await triggerCronjob.call(this, namespace);
52
52
  });
53
53
  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);
54
+ .command("project-trigger-cronjob <envComponent>", "trigger cronjob")
55
+ .autocomplete(await envAndComponents())
56
+ .action(async function ({ envComponent }) {
57
+ await ensureCluster.call(this, envComponent);
58
+ const namespace = await getProjectNamespace(envComponent);
59
59
  await triggerCronjob.call(this, namespace);
60
60
  });
61
61
  };