@catladder/cli 0.0.0-node16-ddfae617 → 0.0.0-pipeline-variables-ed2d2565

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 (295) hide show
  1. package/bin/catenv +1 -1
  2. package/bin/catenv-dev +3 -0
  3. package/bin/catladder +1 -1
  4. package/bin/catladder-dev +3 -0
  5. package/dist/apps/catenv/catenv.d.ts +2 -1
  6. package/dist/apps/catenv/catenv.js +13 -82
  7. package/dist/apps/catenv/catenv.js.map +1 -1
  8. package/dist/apps/catenv/printVariables.d.ts +3 -0
  9. package/dist/apps/catenv/printVariables.js +112 -0
  10. package/dist/apps/catenv/printVariables.js.map +1 -0
  11. package/dist/apps/catenv/types.d.ts +5 -0
  12. package/dist/apps/catenv/types.js +3 -0
  13. package/dist/apps/catenv/types.js.map +1 -0
  14. package/dist/apps/catenv/utils.d.ts +12 -0
  15. package/dist/apps/catenv/utils.js +108 -0
  16. package/dist/apps/catenv/utils.js.map +1 -0
  17. package/dist/apps/catenv/writeDotEnvFiles.d.ts +3 -0
  18. package/dist/apps/catenv/writeDotEnvFiles.js +94 -0
  19. package/dist/apps/catenv/writeDotEnvFiles.js.map +1 -0
  20. package/dist/apps/catenv/writeEnvDTs.d.ts +3 -0
  21. package/dist/apps/catenv/writeEnvDTs.js +114 -0
  22. package/dist/apps/catenv/writeEnvDTs.js.map +1 -0
  23. package/dist/apps/cli/cli.js +4 -2
  24. package/dist/apps/cli/cli.js.map +1 -1
  25. package/dist/apps/cli/commands/{project/commandCopyDB.d.ts → cloudSQL/commandRestoreDb.d.ts} +1 -1
  26. package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js +180 -0
  27. package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +1 -0
  28. package/dist/apps/cli/commands/cloudSQL/index.d.ts +3 -0
  29. package/dist/apps/cli/commands/cloudSQL/index.js +50 -0
  30. package/dist/apps/cli/commands/cloudSQL/index.js.map +1 -0
  31. package/dist/apps/cli/commands/general/index.d.ts +1 -1
  32. package/dist/apps/cli/commands/general/index.js +11 -11
  33. package/dist/apps/cli/commands/general/index.js.map +1 -1
  34. package/dist/apps/cli/commands/general/portForward.d.ts +1 -1
  35. package/dist/apps/cli/commands/general/portForward.js +3 -3
  36. package/dist/apps/cli/commands/general/portForward.js.map +1 -1
  37. package/dist/apps/cli/commands/mongodb/index.d.ts +1 -1
  38. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +1 -1
  39. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +2 -1
  40. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -1
  41. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +1 -1
  42. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +1 -1
  43. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +27 -11
  44. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -1
  45. package/dist/apps/cli/commands/mongodb/utils/index.js +16 -4
  46. package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -1
  47. package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +1 -1
  48. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +89 -62
  49. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
  50. package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +2 -1
  51. package/dist/apps/cli/commands/project/commandConfigSecrets.js +71 -57
  52. package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
  53. package/dist/apps/cli/commands/project/commandDeletePods.d.ts +1 -1
  54. package/dist/apps/cli/commands/project/commandDeletePods.js +2 -1
  55. package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -1
  56. package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +1 -1
  57. package/dist/apps/cli/commands/project/commandEnvVars.d.ts +1 -1
  58. package/dist/apps/cli/commands/project/commandEnvVars.js +1 -1
  59. package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -1
  60. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +1 -1
  61. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +1 -1
  62. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -1
  63. package/dist/apps/cli/commands/project/commandGetShell.d.ts +1 -1
  64. package/dist/apps/cli/commands/project/commandGetShell.js +10 -6
  65. package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -1
  66. package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +1 -1
  67. package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -1
  68. package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +1 -1
  69. package/dist/apps/cli/commands/project/commandListPods.d.ts +1 -1
  70. package/dist/apps/cli/commands/project/commandListPods.js +2 -2
  71. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -1
  72. package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +1 -1
  73. package/dist/apps/cli/commands/project/commandMigrateHelm3.js +1 -2
  74. package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -1
  75. package/dist/apps/cli/commands/project/commandNamespace.d.ts +1 -1
  76. package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +1 -1
  77. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +2 -2
  78. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -1
  79. package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +1 -1
  80. package/dist/apps/cli/commands/project/commandOpenDashboard.js +19 -20
  81. package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -1
  82. package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +1 -1
  83. package/dist/apps/cli/commands/project/commandOpenGit.d.ts +1 -1
  84. package/dist/apps/cli/commands/project/commandOpenGit.js +2 -7
  85. package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -1
  86. package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +1 -1
  87. package/dist/apps/cli/commands/project/commandOpenGrafana.js +2 -2
  88. package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -1
  89. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +1 -1
  90. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +4 -3
  91. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -1
  92. package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +1 -1
  93. package/dist/apps/cli/commands/project/commandOpenLogs.js +7 -20
  94. package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -1
  95. package/dist/apps/cli/commands/project/commandPauseProject.d.ts +1 -1
  96. package/dist/apps/cli/commands/project/commandPortForward.d.ts +1 -1
  97. package/dist/apps/cli/commands/project/commandPortForward.js +98 -36
  98. package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -1
  99. package/dist/apps/cli/commands/project/commandSecretsClearBackups.d.ts +5 -0
  100. package/dist/apps/cli/commands/project/commandSecretsClearBackups.js +90 -0
  101. package/dist/apps/cli/commands/project/commandSecretsClearBackups.js.map +1 -0
  102. package/dist/apps/cli/commands/project/commandSetup.d.ts +1 -1
  103. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +1 -1
  104. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -1
  105. package/dist/apps/cli/commands/project/index.d.ts +1 -1
  106. package/dist/apps/cli/commands/project/index.js +2 -2
  107. package/dist/apps/cli/commands/project/index.js.map +1 -1
  108. package/dist/apps/cli/commands/project/setup/index.d.ts +1 -1
  109. package/dist/apps/cli/commands/project/setup/index.js +11 -7
  110. package/dist/apps/cli/commands/project/setup/index.js.map +1 -1
  111. package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +1 -1
  112. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +5 -4
  113. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
  114. package/dist/apps/cli/commands/project/setup/setupCloudRun.d.ts +3 -0
  115. package/dist/apps/cli/commands/project/setup/setupCloudRun.js +118 -0
  116. package/dist/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -0
  117. package/dist/apps/cli/commands/project/setup/setupContext.d.ts +2 -2
  118. package/dist/apps/cli/commands/project/setup/setupContext.js +10 -3
  119. package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -1
  120. package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -2
  121. package/dist/apps/cli/commands/project/setup/setupKubernetes.js +25 -18
  122. package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
  123. package/dist/apps/cli/commands/project/setup/setupTopic.d.ts +2 -0
  124. package/dist/apps/cli/commands/project/setup/setupTopic.js +69 -0
  125. package/dist/apps/cli/commands/project/setup/setupTopic.js.map +1 -0
  126. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +1 -1
  127. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
  128. package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +1 -1
  129. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +1 -1
  130. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +1 -1
  131. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -1
  132. package/dist/apps/cli/config/writeConfig.d.ts +2 -2
  133. package/dist/apps/cli/verify/index.d.ts +1 -1
  134. package/dist/apps/cli/verify/migration/fromv2.d.ts +1 -1
  135. package/dist/apps/cli/verify/migration/fromv2.js +2 -0
  136. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -1
  137. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +3 -3
  138. package/dist/apps/cli/verify/migration/migrateSecrets.js +6 -3
  139. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -1
  140. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +1 -1
  141. package/dist/apps/cli/verify/migration/oldGitlabCi.js +1 -1
  142. package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -1
  143. package/dist/bundles/catenv/index.js +45988 -0
  144. package/dist/bundles/catenv/xdg-open +1066 -0
  145. package/dist/bundles/cli/clipboard_i686.exe +0 -0
  146. package/dist/bundles/cli/clipboard_x86_64.exe +0 -0
  147. package/dist/bundles/cli/exec-child.js +39 -0
  148. package/dist/bundles/cli/index.js +359559 -0
  149. package/dist/bundles/cli/xdg-open +1066 -0
  150. package/dist/bundles/cli/xsel +0 -0
  151. package/dist/catenv.js +3 -3
  152. package/dist/catenv.js.map +1 -1
  153. package/dist/cli.js +0 -7
  154. package/dist/cli.js.map +1 -1
  155. package/dist/config/constants.d.ts +0 -1
  156. package/dist/config/constants.js +1 -2
  157. package/dist/config/constants.js.map +1 -1
  158. package/dist/config/getProjectConfig.d.ts +10 -10
  159. package/dist/config/getProjectConfig.js +77 -23
  160. package/dist/config/getProjectConfig.js.map +1 -1
  161. package/dist/config/parseChoice.d.ts +4 -0
  162. package/dist/config/parseChoice.js +9 -0
  163. package/dist/config/parseChoice.js.map +1 -0
  164. package/dist/gcloud/artifactsRegistry.d.ts +5 -0
  165. package/dist/gcloud/artifactsRegistry.js +59 -0
  166. package/dist/gcloud/artifactsRegistry.js.map +1 -0
  167. package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.d.ts +2 -0
  168. package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js +67 -0
  169. package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js.map +1 -0
  170. package/dist/gcloud/cloudRun/openCloudRunDashboards.d.ts +3 -0
  171. package/dist/gcloud/cloudRun/openCloudRunDashboards.js +62 -0
  172. package/dist/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -0
  173. package/dist/gcloud/cloudSql/startProxy.d.ts +10 -0
  174. package/dist/gcloud/cloudSql/startProxy.js +121 -0
  175. package/dist/gcloud/cloudSql/startProxy.js.map +1 -0
  176. package/dist/gcloud/enableServices.d.ts +3 -0
  177. package/dist/gcloud/enableServices.js +63 -0
  178. package/dist/gcloud/enableServices.js.map +1 -0
  179. package/dist/gcloud/openDashboard.d.ts +2 -0
  180. package/dist/{apps/cli/commands/shared/index.js → gcloud/openDashboard.js} +23 -27
  181. package/dist/gcloud/openDashboard.js.map +1 -0
  182. package/dist/gcloud/serviceAccounts.d.ts +12 -0
  183. package/dist/gcloud/serviceAccounts.js +144 -0
  184. package/dist/gcloud/serviceAccounts.js.map +1 -0
  185. package/dist/kubernetes/index.d.ts +3 -0
  186. package/dist/kubernetes/index.js +88 -0
  187. package/dist/kubernetes/index.js.map +1 -0
  188. package/dist/kubernetes/openKubernetesDashboards.d.ts +4 -0
  189. package/dist/kubernetes/openKubernetesDashboards.js +94 -0
  190. package/dist/kubernetes/openKubernetesDashboards.js.map +1 -0
  191. package/dist/kubernetes/portForward.d.ts +1 -0
  192. package/dist/kubernetes/portForward.js +55 -0
  193. package/dist/kubernetes/portForward.js.map +1 -0
  194. package/dist/tsconfig.tsbuildinfo +1 -1
  195. package/dist/utils/cluster.js +3 -8
  196. package/dist/utils/cluster.js.map +1 -1
  197. package/dist/utils/gitlab.d.ts +8 -6
  198. package/dist/utils/gitlab.js +165 -46
  199. package/dist/utils/gitlab.js.map +1 -1
  200. package/dist/utils/passwordstore/index.d.ts +0 -1
  201. package/dist/utils/passwordstore/index.js +1 -64
  202. package/dist/utils/passwordstore/index.js.map +1 -1
  203. package/dist/utils/portForwards.d.ts +12 -0
  204. package/dist/utils/{portForward.js → portForwards.js} +20 -16
  205. package/dist/utils/portForwards.js.map +1 -0
  206. package/dist/utils/projects/index.d.ts +0 -3
  207. package/dist/utils/projects/index.js +3 -53
  208. package/dist/utils/projects/index.js.map +1 -1
  209. package/package.json +24 -22
  210. package/scripts/bundle +4 -0
  211. package/src/apps/catenv/catenv.ts +10 -54
  212. package/src/apps/catenv/printVariables.ts +53 -0
  213. package/src/apps/catenv/types.ts +6 -0
  214. package/src/apps/catenv/utils.ts +49 -0
  215. package/src/apps/catenv/writeDotEnvFiles.ts +46 -0
  216. package/src/apps/catenv/writeEnvDTs.ts +71 -0
  217. package/src/apps/cli/cli.ts +3 -1
  218. package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +154 -0
  219. package/src/apps/cli/commands/cloudSQL/index.ts +8 -0
  220. package/src/apps/cli/commands/general/index.ts +11 -8
  221. package/src/apps/cli/commands/general/portForward.ts +4 -4
  222. package/src/apps/cli/commands/mongodb/index.ts +1 -1
  223. package/src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts +3 -5
  224. package/src/apps/cli/commands/mongodb/projectMongoGetShell.ts +1 -1
  225. package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +21 -3
  226. package/src/apps/cli/commands/mongodb/utils/index.ts +19 -11
  227. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +106 -55
  228. package/src/apps/cli/commands/project/commandConfigSecrets.ts +49 -35
  229. package/src/apps/cli/commands/project/commandDeletePods.ts +3 -5
  230. package/src/apps/cli/commands/project/commandDeleteProject.ts +1 -1
  231. package/src/apps/cli/commands/project/commandEnvVars.ts +6 -3
  232. package/src/apps/cli/commands/project/commandGetMyTotalWorktime.ts +2 -2
  233. package/src/apps/cli/commands/project/commandGetShell.ts +10 -9
  234. package/src/apps/cli/commands/project/commandGitlabCi.ts +2 -1
  235. package/src/apps/cli/commands/project/commandInitProject.old.ts +1 -1
  236. package/src/apps/cli/commands/project/commandListPods.ts +2 -2
  237. package/src/apps/cli/commands/project/commandMigrateHelm3.ts +4 -3
  238. package/src/apps/cli/commands/project/commandNamespace.ts +1 -1
  239. package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +3 -3
  240. package/src/apps/cli/commands/project/commandOpenDashboard.ts +12 -32
  241. package/src/apps/cli/commands/project/commandOpenEnv.ts +1 -1
  242. package/src/apps/cli/commands/project/commandOpenGit.ts +3 -3
  243. package/src/apps/cli/commands/project/commandOpenGrafana.ts +3 -3
  244. package/src/apps/cli/commands/project/commandOpenGrafanaPod.ts +5 -7
  245. package/src/apps/cli/commands/project/commandOpenLogs.ts +4 -35
  246. package/src/apps/cli/commands/project/commandPauseProject.ts +1 -1
  247. package/src/apps/cli/commands/project/commandPortForward.ts +75 -34
  248. package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +27 -0
  249. package/src/apps/cli/commands/project/commandSetup.ts +1 -1
  250. package/src/apps/cli/commands/project/commandTriggerCronjob.ts +3 -2
  251. package/src/apps/cli/commands/project/index.ts +4 -3
  252. package/src/apps/cli/commands/project/setup/index.ts +3 -1
  253. package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +23 -11
  254. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +84 -0
  255. package/src/apps/cli/commands/project/setup/setupContext.ts +9 -2
  256. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +56 -28
  257. package/src/apps/cli/commands/project/setup/setupTopic.ts +22 -0
  258. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +4 -2
  259. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +1 -1
  260. package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +2 -2
  261. package/src/apps/cli/config/writeConfig.ts +2 -2
  262. package/src/apps/cli/verify/index.ts +1 -1
  263. package/src/apps/cli/verify/migration/fromv2.ts +5 -7
  264. package/src/apps/cli/verify/migration/migrateSecrets.ts +15 -5
  265. package/src/apps/cli/verify/migration/oldGitlabCi.ts +2 -2
  266. package/src/catenv.ts +6 -3
  267. package/src/cli.ts +1 -7
  268. package/src/config/constants.ts +0 -2
  269. package/src/config/getProjectConfig.ts +70 -30
  270. package/src/config/parseChoice.ts +4 -0
  271. package/src/gcloud/artifactsRegistry.ts +16 -0
  272. package/src/gcloud/cloudRun/getCloudRunDomainSuffix.ts +35 -0
  273. package/src/gcloud/cloudRun/openCloudRunDashboards.ts +22 -0
  274. package/src/gcloud/cloudSql/startProxy.ts +74 -0
  275. package/src/gcloud/enableServices.ts +14 -0
  276. package/src/gcloud/openDashboard.ts +19 -0
  277. package/src/gcloud/serviceAccounts.ts +101 -0
  278. package/src/kubernetes/index.ts +27 -0
  279. package/src/kubernetes/openKubernetesDashboards.ts +52 -0
  280. package/src/kubernetes/portForward.ts +15 -0
  281. package/src/types/child-process-promise.d.ts +37 -1
  282. package/src/utils/cluster.ts +3 -3
  283. package/src/utils/gitlab.ts +141 -30
  284. package/src/utils/passwordstore/index.ts +2 -30
  285. package/src/utils/{portForward.ts → portForwards.ts} +27 -22
  286. package/src/utils/projects/index.ts +3 -24
  287. package/tsconfig.json +1 -1
  288. package/dist/apps/cli/commands/project/commandCopyDB.js +0 -102
  289. package/dist/apps/cli/commands/project/commandCopyDB.js.map +0 -1
  290. package/dist/apps/cli/commands/shared/index.d.ts +0 -3
  291. package/dist/apps/cli/commands/shared/index.js.map +0 -1
  292. package/dist/utils/portForward.d.ts +0 -4
  293. package/dist/utils/portForward.js.map +0 -1
  294. package/src/apps/cli/commands/project/commandCopyDB.ts +0 -91
  295. package/src/apps/cli/commands/shared/index.ts +0 -36
@@ -1,10 +1,10 @@
1
+ import type { Context } from "@catladder/pipeline";
1
2
  import {
2
- Context,
3
3
  getFullKubernetesClusterName,
4
4
  isOfDeployType,
5
5
  } from "@catladder/pipeline";
6
- import { CommandInstance } from "vorpal";
7
- import { $ } from "zx";
6
+ import type { CommandInstance } from "vorpal";
7
+ import { exec } from "child-process-promise";
8
8
  import { connectToCluster } from "../../../../../utils/cluster";
9
9
  import { upsertAllVariables } from "../../../../../utils/gitlab";
10
10
  import ensureNamespace from "../utils/ensureNamespace";
@@ -33,34 +33,41 @@ export const setupKubernetes = async (
33
33
  // we currently create one per component to better separate them
34
34
  instance.log("ensuring service accounts...");
35
35
  const serviceAccountName = `cl-${context.componentName}-deploy`;
36
- const KUBE_URL =
37
- await $`TERM=dumb kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'`.then(
38
- (s) => s.stdout.trim()
39
- );
36
+ const KUBE_URL = await exec(
37
+ `TERM=dumb kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'`
38
+ ).then((s) => s.stdout.trim());
40
39
 
41
40
  // first upsert service acount in the ns
42
41
  try {
43
- await $`kubectl delete serviceaccount --namespace ${namespace} ${serviceAccountName}`;
44
- await $`kubectl delete rolebinding --namespace ${namespace} ${serviceAccountName}`;
45
- await $`kubectl delete role --namespace ${namespace} ${serviceAccountName}`;
42
+ await exec(
43
+ `kubectl delete serviceaccount --namespace ${namespace} ${serviceAccountName}`
44
+ );
45
+ await exec(
46
+ `kubectl delete rolebinding --namespace ${namespace} ${serviceAccountName}`
47
+ );
48
+ await exec(
49
+ `kubectl delete role --namespace ${namespace} ${serviceAccountName}`
50
+ );
46
51
  } catch (e) {
47
52
  // ignore
48
53
  }
49
54
 
50
- await $`kubectl create serviceaccount --namespace ${namespace} ${serviceAccountName}`;
55
+ await exec(
56
+ `kubectl create serviceaccount --namespace ${namespace} ${serviceAccountName}`
57
+ );
51
58
 
52
59
  // upsert role in the ns
53
60
 
54
- await $`cat <<EOF | kubectl apply -f -
61
+ await exec(`cat <<EOF | kubectl apply -f -
55
62
  kind: Role
56
63
  apiVersion: rbac.authorization.k8s.io/v1
57
64
  metadata:
58
65
  namespace: ${namespace}
59
66
  name: ${serviceAccountName}
60
67
  rules:
61
- - apiGroups: ["", "extensions", "apps", "networking.k8s.io", "batch", "autoscaling"]
62
- resources: ["deployments", "replicasets", "statefulsets", "pods", "secrets", "configmaps", "services", "ingresses", "serviceaccounts", "jobs", "cronjobs", "horizontalpodautoscalers"]
63
- verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] # You can also use ["*"]
68
+ - apiGroups: ["", "extensions", "apps", "networking.k8s.io", "batch", "autoscaling", "rbac.authorization.k8s.io","snapshot.storage.k8s.io"]
69
+ resources: ["deployments", "replicasets", "statefulsets", "pods", "secrets", "configmaps", "services", "ingresses", "serviceaccounts", "roles", "rolebindings", "jobs", "cronjobs", "horizontalpodautoscalers", "persistentvolumeclaims", "volumesnapshots"]
70
+ verbs: ["*"]
64
71
  ---
65
72
  kind: RoleBinding
66
73
  apiVersion: rbac.authorization.k8s.io/v1
@@ -76,20 +83,29 @@ roleRef:
76
83
  name: ${serviceAccountName}
77
84
  apiGroup: rbac.authorization.k8s.io
78
85
  EOF
79
- `;
86
+ `);
80
87
 
81
- // get token name
82
- const tokenName =
83
- await $`kubectl get serviceaccount --namespace ${namespace} ${serviceAccountName} -o jsonpath='{.secrets[0].name}'`;
88
+ const secretName = `${serviceAccountName}-secret`;
89
+ // create token for the service account
90
+ await exec(`
91
+ kubectl apply -f - <<EOF
92
+ apiVersion: v1
93
+ kind: Secret
94
+ metadata:
95
+ name: ${secretName}
96
+ namespace: ${namespace}
97
+ annotations:
98
+ kubernetes.io/service-account.name: ${serviceAccountName}
99
+ type: kubernetes.io/service-account-token
100
+ EOF
101
+ `);
84
102
 
85
- const KUBE_CA_PEM =
86
- await $`kubectl get secret ${tokenName} --namespace ${namespace} -o jsonpath="{['data']['ca\\.crt']}"`.then(
87
- (c) => c.stdout.trim()
88
- );
89
- const KUBE_TOKEN =
90
- await $`kubectl get secret ${tokenName} --namespace ${namespace} -o jsonpath="{['data']['token']}" | base64 --decode`.then(
91
- (c) => c.stdout.trim()
92
- );
103
+ const KUBE_CA_PEM = await exec(
104
+ `kubectl get secret ${secretName} --namespace ${namespace} -o jsonpath="{['data']['ca\\.crt']}"`
105
+ ).then((c) => c.stdout.trim());
106
+ const KUBE_TOKEN = await exec(
107
+ `kubectl get secret ${secretName} --namespace ${namespace} -o jsonpath="{['data']['token']}" | base64 --decode`
108
+ ).then((c) => c.stdout.trim());
93
109
 
94
110
  const vars = {
95
111
  KUBE_TOKEN,
@@ -97,6 +113,17 @@ EOF
97
113
  KUBE_URL,
98
114
  };
99
115
 
116
+ const missing = Object.entries(vars).filter((e) => !e[1]);
117
+ if (missing.length > 0) {
118
+ throw new Error(
119
+ "could not setup credentials. Missing vars: " +
120
+ missing.map((m) => m[0]).join(", ") +
121
+ ". Check whether your local kubectl is still working for '" +
122
+ fullName +
123
+ "'"
124
+ );
125
+ }
126
+
100
127
  instance.log("service accounts created / updated!");
101
128
 
102
129
  instance.log("");
@@ -106,7 +133,8 @@ EOF
106
133
  instance,
107
134
  vars,
108
135
  context.environment.shortName,
109
- context.componentName
136
+ context.componentName,
137
+ false // no backup
110
138
  );
111
139
  instance.log("done!");
112
140
  };
@@ -0,0 +1,22 @@
1
+ import type { CommandInstance } from "vorpal";
2
+ import { doGitlabRequest, getProjectInfo } from "../../../../../utils/gitlab";
3
+
4
+ const catladderTopic = "catladder"
5
+
6
+ export const setupTopic = async (instance: CommandInstance) => {
7
+ const { id: projectId } = await getProjectInfo(
8
+ instance
9
+ );
10
+
11
+ const { topics } = await doGitlabRequest(
12
+ instance,
13
+ `projects/${projectId}`
14
+ );
15
+
16
+ await doGitlabRequest(
17
+ instance,
18
+ `projects/${projectId}`,
19
+ { topics: [catladderTopic, ...topics] },
20
+ "PUT"
21
+ );
22
+ };
@@ -1,5 +1,7 @@
1
- import { Context, getKubernetesNamespace } from "@catladder/pipeline";
2
- import { V1Namespace, V1ObjectMeta } from "@kubernetes/client-node";
1
+ import type { Context} from "@catladder/pipeline";
2
+ import { getKubernetesNamespace } from "@catladder/pipeline";
3
+ import type { V1ObjectMeta } from "@kubernetes/client-node";
4
+ import { V1Namespace } from "@kubernetes/client-node";
3
5
  import { getk8sApi } from "../../../../../k8sApi";
4
6
 
5
7
  export default async function (context: Context) {
@@ -1,4 +1,4 @@
1
- import Vorpal from "vorpal";
1
+ import type Vorpal from "vorpal";
2
2
  import { getProjectConfig } from "../../../../../config/getProjectConfig";
3
3
 
4
4
  export const showProjectBanner = async (vorpal: Vorpal) => {
@@ -1,6 +1,6 @@
1
1
  import { spawn } from "child-process-promise";
2
2
  import fetch from "node-fetch";
3
- import Vorpal from "vorpal";
3
+ import type Vorpal from "vorpal";
4
4
 
5
5
  export default async (vorpal: Vorpal) => {
6
6
  vorpal.command("dadjoke", "something for jonas.").action(async function () {
@@ -19,7 +19,7 @@ export default async (vorpal: Vorpal) => {
19
19
  vorpal
20
20
  .command("starwars", "Long time ago... in a galaxy far far away...")
21
21
  .action(async function () {
22
- starwarsPromise = spawn("telnet", ["towel.blinkenlights.nl"], {
22
+ starwarsPromise = spawn("telnet", ["2001:7b8:666:ffff::1:42"], {
23
23
  stdio: ["pipe", "inherit", "pipe"],
24
24
  });
25
25
  await starwarsPromise;
@@ -1,9 +1,9 @@
1
- import { Config } from "@catladder/pipeline";
1
+ import type { Config } from "@catladder/pipeline";
2
2
  import { spawn, exec } from "child-process-promise";
3
3
  import { writeFile } from "fs-extra";
4
4
  import { dump } from "js-yaml";
5
5
  import { format } from "prettier";
6
- import { CommandInstance } from "vorpal";
6
+ import type { CommandInstance } from "vorpal";
7
7
  import { getGitRoot } from "../../../utils/projects";
8
8
 
9
9
  export const writeConfig = async (
@@ -1,4 +1,4 @@
1
- import Vorpal from "vorpal";
1
+ import type Vorpal from "vorpal";
2
2
  import {
3
3
  getGitlabCi,
4
4
  getProjectConfig,
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  BuildConfig,
3
3
  ComponentConfig,
4
4
  Config,
@@ -14,7 +14,7 @@ import {
14
14
  } from "fs-extra";
15
15
  import { isEmpty } from "lodash";
16
16
  import { join } from "path";
17
- import Vorpal from "vorpal";
17
+ import type Vorpal from "vorpal";
18
18
  import {
19
19
  getGitlabCi,
20
20
  getGitlabCiFilePath,
@@ -24,11 +24,8 @@ import { syncBitwarden } from "../../../../utils/passwordstore";
24
24
  import { getGitRoot } from "../../../../utils/projects";
25
25
  import { writeConfig } from "../../config/writeConfig";
26
26
  import { migrateSecrets } from "./migrateSecrets";
27
- import {
28
- detectBuildConfig,
29
- isOldInclude,
30
- OldGitlabCiFile,
31
- } from "./oldGitlabCi";
27
+ import type { OldGitlabCiFile } from "./oldGitlabCi";
28
+ import { detectBuildConfig, isOldInclude } from "./oldGitlabCi";
32
29
  export const LEGACY_ENVS = [
33
30
  "dev-local",
34
31
  "dev",
@@ -39,6 +36,7 @@ export const LEGACY_ENVS = [
39
36
 
40
37
  const arrayToRecord = (arr: { name: string }[]): Record<string, any> => {
41
38
  if (!arr) return undefined;
39
+ if (!Array.isArray(arr)) return arr;
42
40
  return Object.fromEntries(arr.map(({ name, ...rest }) => [name, rest]));
43
41
  };
44
42
 
@@ -1,10 +1,11 @@
1
- import { Config, getEnvironment } from "@catladder/pipeline";
1
+ import type { Config } from "@catladder/pipeline";
2
+ import { getEnvironment } from "@catladder/pipeline";
2
3
  import { load } from "js-yaml";
3
4
  import { pick } from "lodash";
4
- import { CommandInstance } from "vorpal";
5
+ import type { CommandInstance } from "vorpal";
5
6
  import { upsertAllVariables } from "../../../../utils/gitlab";
6
7
  import { readPass, trashItem } from "../../../../utils/passwordstore";
7
- import { LEGACY_ENVS } from "./fromv2";
8
+ import type { LEGACY_ENVS } from "./fromv2";
8
9
 
9
10
  const getPassPath = (newConfig: Config, env: string) => {
10
11
  return `${newConfig.customerName}/${newConfig.appName}/${env}/secrets.yml`;
@@ -22,10 +23,19 @@ export const migrateSecrets = async (
22
23
  const secrets = load(yamlstring);
23
24
 
24
25
  Object.keys(newConfig.components).forEach(async (componentName) => {
25
- const environment = getEnvironment(newConfig, componentName, newEnv);
26
+ const environment = await getEnvironment(
27
+ newConfig,
28
+ componentName,
29
+ newEnv
30
+ );
26
31
  await upsertAllVariables(
27
32
  vorpal,
28
- pick(secrets, environment.secretEnvVarKeys),
33
+ pick(
34
+ secrets,
35
+ environment.secretEnvVarKeys
36
+ .filter((k) => !k.hidden)
37
+ .map((k) => k.key)
38
+ ),
29
39
  newEnv,
30
40
  componentName
31
41
  );
@@ -1,4 +1,4 @@
1
- import { BuildConfig } from "@catladder/pipeline";
1
+ import type { BuildConfig } from "@catladder/pipeline";
2
2
 
3
3
  export type OldGitlabCiFile = {
4
4
  variables: {
@@ -43,6 +43,6 @@ export const detectBuildConfig = (
43
43
  }
44
44
 
45
45
  if (firstInclude.file === "rails-kubernetes.yml") {
46
- throw new Error("rails is not yet implemented");
46
+ return "rails";
47
47
  }
48
48
  };
package/src/catenv.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import catenv from "./apps/catenv/catenv";
2
- import { $ } from "zx";
3
- $.verbose = false;
4
- catenv().then(() => {
2
+
3
+ import { parseChoice } from "./config/parseChoice";
4
+
5
+ const choice = process.argv[2] ? parseChoice(process.argv[2]) : null;
6
+
7
+ catenv(choice).then(() => {
5
8
  // we have to exit manually, because we have some file watches
6
9
  process.exit();
7
10
  });
package/src/cli.ts CHANGED
@@ -1,9 +1,3 @@
1
- import updateNotifier from "update-notifier";
2
1
  import cli from "./apps/cli/cli";
3
- import packageInfos from "./packageInfos";
4
- import { $ } from "zx";
5
- $.verbose = false;
6
- updateNotifier({
7
- pkg: packageInfos,
8
- }).notify();
2
+
9
3
  cli();
@@ -1,4 +1,2 @@
1
1
  export const GRAFANA_PROXY_LOCAL_PORT = 9090;
2
2
  export const GRAFANA_PROXY_TARGET_PORT = 9090;
3
-
4
- export const GOOGLE_CLOUD_SQL_PASS_PATH = "cloud-sql-proxy-credentials";
@@ -1,20 +1,22 @@
1
+ import type { Config, EnvironmentEnvVars } from "@catladder/pipeline";
1
2
  import {
2
3
  readConfigSync,
3
4
  getAllEnvs,
4
5
  getEnvironment as _getEnvironment,
5
6
  createContext,
6
7
  getSecretVarName,
7
- Config,
8
8
  } from "@catladder/pipeline";
9
9
 
10
- import { CommandInstance } from "vorpal";
10
+ import type { CommandInstance } from "vorpal";
11
11
  import { getAllVariables, getVariableValueByRawName } from "../utils/gitlab";
12
12
 
13
13
  import { getGitRoot } from "../utils/projects";
14
14
  import { readYaml } from "../utils/files";
15
15
  import { watch } from "fs";
16
16
 
17
- let currentConfig: Config = null;
17
+ export { parseChoice } from "./parseChoice";
18
+
19
+ let currentConfig: Config | null = null;
18
20
 
19
21
  // reload the config on change
20
22
  const reloadConfigAndObserve = async () => {
@@ -37,7 +39,7 @@ export const getProjectConfig = async () => {
37
39
  // initially
38
40
  await reloadConfigAndObserve();
39
41
  }
40
- return currentConfig;
42
+ return currentConfig as Config;
41
43
  };
42
44
 
43
45
  export const getGitlabCiFilePath = async () => {
@@ -59,17 +61,12 @@ export const getProjectComponents = async () => {
59
61
  return Object.keys(config.components);
60
62
  };
61
63
 
62
- export const parseChoice = (envComponent: string) => {
63
- const [env, componentName] = envComponent.split(":");
64
- return { env, componentName };
65
- };
66
-
67
64
  export const getPipelineContextByChoice = async (
68
65
  env: string,
69
66
  componentName: string
70
67
  ) => {
71
68
  const config = await getProjectConfig();
72
- return createContext(config, componentName, env);
69
+ return await createContext(config, componentName, env);
73
70
  };
74
71
  export const getAllComponentsWithAllEnvsFlat = async (): Promise<
75
72
  Array<{ env: string; componentName: string }>
@@ -126,35 +123,78 @@ export const getGitlabVar = async (
126
123
  };
127
124
 
128
125
  const resolveSecrets = async (
129
- vorpal: CommandInstance,
130
- allEnvVars: Record<string, string>
126
+ vorpal: CommandInstance | null,
127
+ varSets: EnvironmentEnvVars[]
131
128
  ) => {
132
129
  const allVariablesInGitlab = await getAllVariables(vorpal);
133
130
 
134
131
  return Object.fromEntries(
135
- Object.entries(allEnvVars).map(([key, value]) => {
136
- const containsSecret = String(value)?.includes?.("$CL_");
137
- if (containsSecret) {
138
- for (const variable of allVariablesInGitlab) {
139
- value = value.replace(
140
- new RegExp("\\$" + variable.key, "g"),
141
- variable.value
142
- );
143
- }
144
- return [key, value];
145
- }
146
- return [key, value];
147
- })
132
+ varSets.flatMap((set) =>
133
+ Object.entries(set.envVars)
134
+ .map(([key, value]) => {
135
+ const secretKey = set.secretEnvVarKeys.find((k) => k.key === key);
136
+
137
+ if (secretKey) {
138
+ if (secretKey.hidden) {
139
+ return null;
140
+ }
141
+ for (const variable of allVariablesInGitlab) {
142
+ value = value.replace(
143
+ new RegExp("\\$" + variable.key, "g"),
144
+ variable.value
145
+ );
146
+ }
147
+ return [key, value];
148
+ }
149
+ return [key, value];
150
+ })
151
+ .filter(Boolean)
152
+ )
148
153
  );
149
154
  };
150
155
 
151
- export const getEnvVars = async (
156
+ export const getEnvVarsResolved = async (
157
+ vorpal: CommandInstance | null,
158
+ env: string,
159
+ componentName: string | null
160
+ ) => {
161
+ if (!componentName) {
162
+ return {};
163
+ }
164
+ try {
165
+ const envionment = await getEnvironment(env, componentName);
166
+
167
+ // in the pipeline the secrets alreadyy exists and bash will expand them
168
+ // but here we need to manually load them
169
+ return resolveSecrets(vorpal, [
170
+ {
171
+ envVars: envionment.envVars,
172
+ secretEnvVarKeys: envionment.secretEnvVarKeys,
173
+ },
174
+ ]);
175
+ } catch (e) {
176
+ // env is disabled
177
+ return {};
178
+ }
179
+ };
180
+
181
+ /**
182
+ *
183
+ * is used to get job only vars that should also be editable locally with catladder.
184
+ */
185
+ export const getJobOnlyEnvVarsResolved = async (
152
186
  vorpal: CommandInstance,
153
187
  env: string,
154
188
  componentName: string
155
189
  ) => {
156
- const envionment = await getEnvironment(env, componentName);
157
- // in the pipeline the secrets alreadyy exists and bash will expand them
158
- // but here we need to manually load them
159
- return resolveSecrets(vorpal, envionment.envVars);
190
+ try {
191
+ const envionment = await getEnvironment(env, componentName);
192
+ return resolveSecrets(vorpal, [
193
+ envionment.jobOnlyVars.build,
194
+ envionment.jobOnlyVars.deploy,
195
+ ]);
196
+ } catch (e) {
197
+ // env is disabled
198
+ return {};
199
+ }
160
200
  };
@@ -0,0 +1,4 @@
1
+ export const parseChoice = (envComponent: string) => {
2
+ const [env, componentName] = envComponent.split(":").map((x) => x || null);
3
+ return { env: env as string, componentName };
4
+ };
@@ -0,0 +1,16 @@
1
+ import type { Gcloudregion } from "@catladder/pipeline";
2
+ import { exec } from "child-process-promise";
3
+
4
+ export const upsertGcloudArtifactsRegistry = async (config: {
5
+ projectId: string;
6
+ region: Gcloudregion;
7
+ }) => {
8
+ try {
9
+ await exec(
10
+ `gcloud artifacts repositories create catladder-deploy --project="${config.projectId}" --repository-format=docker --location=${config.region}`
11
+ );
12
+ } catch (e) {
13
+ // probably already exists
14
+ //
15
+ }
16
+ };
@@ -0,0 +1,35 @@
1
+ import type { DeployConfigCloudRun } from "@catladder/pipeline";
2
+ import { exec } from "child-process-promise";
3
+
4
+ const getSuffixFromService = (service: any) => {
5
+ const fullUrl = service.status.url;
6
+ const name = service.metadata.name;
7
+
8
+ return fullUrl.replace("https://" + name + "-", "");
9
+ };
10
+ export const getCloudRunDomainSuffix = async (config: DeployConfigCloudRun) => {
11
+ /* google cloud run domains are partially predictable, they have a fixed suffix that depends on the region and project, but we don't know it beforehand
12
+
13
+ So what we do is either:
14
+ - get one service and extract its suffix
15
+ - create a dummy project, extract the suffix and save that as a gitlab variable
16
+
17
+
18
+ */
19
+
20
+ const dummyServiceName = "cl-dummy-service-delete-me";
21
+
22
+ const existingServices = await exec(
23
+ `gcloud run services list --format=json --project="${config.projectId}" --region=${config.region} --limit=1`
24
+ ).then((r) => JSON.parse(r.stdout));
25
+
26
+ if (existingServices.length > 0) {
27
+ return getSuffixFromService(existingServices[0]);
28
+ }
29
+
30
+ const result = await exec(
31
+ `gcloud run deploy ${dummyServiceName} --region=${config.region} --allow-unauthenticated --project ${config.projectId} --image=us-docker.pkg.dev/cloudrun/container/hello --format=json`
32
+ ).then((r) => JSON.parse(r.stdout));
33
+
34
+ return await getSuffixFromService(result);
35
+ };
@@ -0,0 +1,22 @@
1
+ import type { Context } from "@catladder/pipeline";
2
+ import { isOfDeployType } from "@catladder/pipeline";
3
+ import type { CommandInstance } from "vorpal";
4
+ import { openGoogleCloudDashboard } from "../openDashboard";
5
+
6
+ export const openGoogleCloudRunDashboard = async (
7
+ instance: CommandInstance,
8
+ context: Context
9
+ ) => {
10
+ if (!isOfDeployType(context.componentConfig.deploy, "google-cloudrun")) {
11
+ throw new Error("deploy type is not google-cloudrun ");
12
+ }
13
+ const { fullName } = context.environment;
14
+ const { region, projectId } = context.componentConfig.deploy;
15
+ await openGoogleCloudDashboard(
16
+ instance,
17
+ `run/detail/${region}/${fullName}/metrics`,
18
+ {
19
+ project: projectId,
20
+ }
21
+ );
22
+ };
@@ -0,0 +1,74 @@
1
+ import { spawn } from "child-process-promise";
2
+ import commandExists from "command-exists-promise";
3
+
4
+ export const ERROR_NOT_INSTALLED = "cloud-sql-proxy not installed";
5
+
6
+ export type CloudSqlBackgroundProxy = {
7
+ stop: () => void;
8
+ };
9
+
10
+ export type CloudSqlProxyOptions = {
11
+ instanceName: string;
12
+ localPort: number;
13
+ };
14
+
15
+ const getProxyCommandSpawnArgs = async ({
16
+ localPort,
17
+ instanceName,
18
+ }: CloudSqlProxyOptions) => {
19
+ const commandString = (await commandExists("cloud-sql-proxy"))
20
+ ? `cloud-sql-proxy --port ${localPort} ${instanceName}`
21
+ : (await commandExists(
22
+ "cloud_sql_proxy" // v1
23
+ ))
24
+ ? `cloud_sql_proxy -instances ${instanceName}=tcp:${localPort}`
25
+ : null;
26
+ if (!commandString) {
27
+ throw new Error(ERROR_NOT_INSTALLED);
28
+ }
29
+
30
+ const [cmd, ...args] = commandString.split(" ");
31
+ return { cmd, args };
32
+ };
33
+
34
+ export const startCloudSqlProxyInCurrentShell = async (
35
+ opts: CloudSqlProxyOptions
36
+ ) => {
37
+ const { cmd, args } = await getProxyCommandSpawnArgs(opts);
38
+
39
+ await spawn(cmd, args, {
40
+ stdio: "inherit",
41
+ shell: true,
42
+ });
43
+ };
44
+
45
+ export const startCloudSqlProxyInBackground = async (
46
+ opts: CloudSqlProxyOptions
47
+ ): Promise<CloudSqlBackgroundProxy> => {
48
+ const { cmd, args } = await getProxyCommandSpawnArgs(opts);
49
+
50
+ const proxyPromise = spawn(cmd, args, { shell: "bash" });
51
+
52
+ // wait until it starts
53
+ await spawn(
54
+ `echo -n "Waiting for proxy"
55
+ until echo > /dev/tcp/localhost/${opts.localPort}; do
56
+ sleep 0.2
57
+ echo -n "."
58
+ done 2>/dev/null`,
59
+ [],
60
+ { shell: "bash" }
61
+ );
62
+ const stop = () => {
63
+ proxyPromise.catch(() => {
64
+ // ignore
65
+ });
66
+ proxyPromise.childProcess.kill();
67
+ };
68
+ // stop if catladder i stopped
69
+ process.on("beforeExit", stop);
70
+
71
+ return {
72
+ stop,
73
+ };
74
+ };
@@ -0,0 +1,14 @@
1
+ import { exec } from "child-process-promise";
2
+
3
+ export const enableGCloudServices = async (
4
+ services: string[],
5
+ config: {
6
+ projectId: string;
7
+ }
8
+ ) => {
9
+ for (const service of services) {
10
+ await exec(
11
+ `gcloud services enable ${service} --project=${config.projectId}`
12
+ );
13
+ }
14
+ };