@catladder/pipeline 1.144.1 → 1.146.0

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 (335) hide show
  1. package/dist/bash/BashExpression.d.ts +40 -0
  2. package/dist/bash/BashExpression.js +124 -0
  3. package/dist/bash/bashExpressionPerPipelineType.d.ts +6 -0
  4. package/dist/bash/bashExpressionPerPipelineType.js +11 -0
  5. package/dist/bash/bashYaml.d.ts +10 -0
  6. package/dist/bash/bashYaml.js +46 -0
  7. package/dist/bash/getInjectVarsScript.d.ts +2 -0
  8. package/dist/bash/getInjectVarsScript.js +45 -0
  9. package/dist/bash/replaceAsync.d.ts +2 -0
  10. package/dist/{pipeline/commitInfo/getCommitInfo.js → bash/replaceAsync.js} +49 -21
  11. package/dist/build/base/__tests__/createArtifactsConfig.test.js +3 -1
  12. package/dist/build/base/constants.js +3 -1
  13. package/dist/build/base/createAppBuildJob.d.ts +2 -1
  14. package/dist/build/base/createAppBuildJob.js +10 -6
  15. package/dist/build/base/createArtifactsConfig.d.ts +1 -1
  16. package/dist/build/base/createArtifactsConfig.js +3 -1
  17. package/dist/build/base/index.js +3 -1
  18. package/dist/build/base/writeBuildInfo.js +4 -3
  19. package/dist/build/base/writeDotEnv.js +12 -3
  20. package/dist/build/custom/__tests__/testJob.test.js +3 -1
  21. package/dist/build/custom/buildJob.js +4 -12
  22. package/dist/build/custom/index.js +3 -1
  23. package/dist/build/custom/testJob.d.ts +1 -1
  24. package/dist/build/custom/testJob.js +18 -14
  25. package/dist/build/docker.d.ts +5 -31
  26. package/dist/build/docker.js +16 -9
  27. package/dist/build/index.d.ts +1 -1
  28. package/dist/build/index.js +13 -7
  29. package/dist/build/node/buildJob.js +4 -12
  30. package/dist/build/node/cache.js +6 -3
  31. package/dist/build/node/constants.js +3 -1
  32. package/dist/build/node/index.js +3 -1
  33. package/dist/build/node/meteor.js +5 -2
  34. package/dist/build/node/testJob.js +18 -14
  35. package/dist/build/node/yarn.d.ts +3 -2
  36. package/dist/build/node/yarn.js +6 -3
  37. package/dist/build/rails/build.js +3 -1
  38. package/dist/build/rails/index.js +3 -1
  39. package/dist/build/rails/test.js +15 -11
  40. package/dist/build/sbom.js +3 -1
  41. package/dist/build/types.d.ts +24 -18
  42. package/dist/build/types.js +3 -1
  43. package/dist/bundles/catladder-gitlab/index.js +3 -3
  44. package/dist/catladder-gitlab.js +10 -54
  45. package/dist/config/__tests__/configruedEnvs.test.js +3 -1
  46. package/dist/config/configruedEnvs.js +3 -1
  47. package/dist/config/index.js +13 -7
  48. package/dist/config/readConfig.js +6 -5
  49. package/dist/constants.js +5 -3
  50. package/dist/context/__tests__/resolveReferences.test.js +40 -8
  51. package/dist/context/getBuildInfoVariables.d.ts +7 -0
  52. package/dist/context/getBuildInfoVariables.js +29 -0
  53. package/dist/context/getEnvConfig.js +3 -1
  54. package/dist/context/getEnvType.js +3 -1
  55. package/dist/context/getEnvironment.d.ts +3 -3
  56. package/dist/context/getEnvironment.js +10 -14
  57. package/dist/context/getEnvironmentContext.d.ts +7 -3
  58. package/dist/context/getEnvironmentContext.js +21 -11
  59. package/dist/context/getEnvironmentVariables.d.ts +26 -5
  60. package/dist/context/getEnvironmentVariables.js +40 -25
  61. package/dist/context/getLabels.js +4 -2
  62. package/dist/context/getReviewSlug.d.ts +4 -0
  63. package/dist/context/getReviewSlug.js +22 -0
  64. package/dist/context/index.d.ts +12 -3
  65. package/dist/context/index.js +21 -15
  66. package/dist/context/resolveReferences.d.ts +3 -1
  67. package/dist/context/resolveReferences.js +53 -21
  68. package/dist/context/transformJobOnlyVars.d.ts +5 -2
  69. package/dist/context/transformJobOnlyVars.js +4 -2
  70. package/dist/context/utils/envVars.d.ts +1 -1
  71. package/dist/context/utils/envVars.js +5 -2
  72. package/dist/defaults/index.js +3 -1
  73. package/dist/deploy/base/deploy.d.ts +1 -1
  74. package/dist/deploy/base/deploy.js +12 -11
  75. package/dist/deploy/base/index.js +3 -1
  76. package/dist/deploy/base/rollback.d.ts +1 -1
  77. package/dist/deploy/base/rollback.js +13 -9
  78. package/dist/deploy/base/stop.d.ts +1 -1
  79. package/dist/deploy/base/stop.js +16 -11
  80. package/dist/deploy/base/types.d.ts +1 -1
  81. package/dist/deploy/base/types.js +3 -1
  82. package/dist/deploy/base/variables.js +3 -1
  83. package/dist/deploy/cloudRun/artifactsRegistry.d.ts +2 -1
  84. package/dist/deploy/cloudRun/artifactsRegistry.js +6 -4
  85. package/dist/deploy/cloudRun/cleanup.js +3 -1
  86. package/dist/deploy/cloudRun/cloudRunRevisions.js +3 -1
  87. package/dist/deploy/cloudRun/createJobs/cloudRunJobs.js +8 -5
  88. package/dist/deploy/cloudRun/createJobs/cloudRunServices.d.ts +2 -2
  89. package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +6 -3
  90. package/dist/deploy/cloudRun/createJobs/common.d.ts +3 -3
  91. package/dist/deploy/cloudRun/createJobs/common.js +3 -1
  92. package/dist/deploy/cloudRun/createJobs/constants.d.ts +1 -0
  93. package/dist/deploy/cloudRun/createJobs/constants.js +7 -0
  94. package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +10 -4
  95. package/dist/deploy/cloudRun/createJobs/getCloudRunStopScripts.js +3 -1
  96. package/dist/deploy/cloudRun/createJobs/index.js +25 -8
  97. package/dist/deploy/cloudRun/createJobs/volumes.js +3 -1
  98. package/dist/deploy/cloudRun/index.js +5 -3
  99. package/dist/deploy/cloudRun/utils/createArgsString.d.ts +2 -1
  100. package/dist/deploy/cloudRun/utils/createArgsString.js +3 -1
  101. package/dist/deploy/cloudRun/utils/database.js +13 -13
  102. package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +3 -1
  103. package/dist/deploy/cloudRun/utils/getServiceName.d.ts +1 -1
  104. package/dist/deploy/cloudRun/utils/getServiceName.js +3 -1
  105. package/dist/deploy/cloudRun/utils/jobName.d.ts +2 -1
  106. package/dist/deploy/cloudRun/utils/jobName.js +4 -2
  107. package/dist/deploy/cloudRun/utils/removeFirstLinesFromCommandOutput.js +3 -1
  108. package/dist/deploy/cloudSql/utils.d.ts +2 -1
  109. package/dist/deploy/cloudSql/utils.js +7 -2
  110. package/dist/deploy/custom/deployJob.js +3 -1
  111. package/dist/deploy/custom/index.js +3 -1
  112. package/dist/deploy/dockerTag/deployJob.js +3 -1
  113. package/dist/deploy/dockerTag/index.js +3 -1
  114. package/dist/deploy/index.d.ts +4 -3
  115. package/dist/deploy/index.js +13 -7
  116. package/dist/deploy/kubernetes/additionalSecretKeys.js +3 -1
  117. package/dist/deploy/kubernetes/cloudSql/index.d.ts +3 -2
  118. package/dist/deploy/kubernetes/cloudSql/index.js +6 -4
  119. package/dist/deploy/kubernetes/deployJob.js +22 -15
  120. package/dist/deploy/kubernetes/index.js +51 -14
  121. package/dist/deploy/kubernetes/kubeEnv.d.ts +3 -2
  122. package/dist/deploy/kubernetes/kubeEnv.js +7 -4
  123. package/dist/deploy/kubernetes/kubeValues.d.ts +2 -2
  124. package/dist/deploy/kubernetes/kubeValues.js +4 -5
  125. package/dist/deploy/kubernetes/mongodb.js +3 -1
  126. package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +2 -1
  127. package/dist/deploy/kubernetes/processSecretsAsFiles.js +3 -1
  128. package/dist/deploy/sbom.js +3 -1
  129. package/dist/deploy/types/base.d.ts +8 -2
  130. package/dist/deploy/types/base.js +3 -1
  131. package/dist/deploy/types/custom.d.ts +1 -1
  132. package/dist/deploy/types/custom.js +3 -1
  133. package/dist/deploy/types/dockerTag.d.ts +1 -1
  134. package/dist/deploy/types/dockerTag.js +3 -1
  135. package/dist/deploy/types/googleCloudRun.d.ts +19 -18
  136. package/dist/deploy/types/googleCloudRun.js +3 -1
  137. package/dist/deploy/types/index.d.ts +6 -6
  138. package/dist/deploy/types/index.js +13 -7
  139. package/dist/deploy/types/kubernetes.d.ts +22 -22
  140. package/dist/deploy/types/kubernetes.js +3 -1
  141. package/dist/deploy/utils.js +3 -1
  142. package/dist/index.d.ts +3 -2
  143. package/dist/index.js +16 -9
  144. package/dist/packageInfos.d.ts +2 -0
  145. package/dist/packageInfos.js +14 -0
  146. package/dist/pipeline/createAllJobs.d.ts +13 -5
  147. package/dist/pipeline/createAllJobs.js +21 -10
  148. package/dist/pipeline/createChildPipeline.d.ts +1 -1
  149. package/dist/pipeline/createChildPipeline.js +24 -7
  150. package/dist/pipeline/createJobsForComponent.d.ts +3 -3
  151. package/dist/pipeline/createJobsForComponent.js +19 -18
  152. package/dist/pipeline/createMainPipeline.d.ts +3 -0
  153. package/dist/pipeline/createMainPipeline.js +248 -0
  154. package/dist/pipeline/generatePipelineFiles.d.ts +2 -0
  155. package/dist/pipeline/generatePipelineFiles.js +178 -0
  156. package/dist/pipeline/getPipelineStages.js +3 -1
  157. package/dist/pipeline/gitlab/createGitlabJobs.d.ts +15 -5
  158. package/dist/pipeline/gitlab/createGitlabJobs.js +98 -25
  159. package/dist/pipeline/gitlab/createGitlabPipeline.d.ts +7 -2
  160. package/dist/pipeline/gitlab/createGitlabPipeline.js +34 -17
  161. package/dist/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.d.ts +1 -0
  162. package/dist/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.js +29 -0
  163. package/dist/pipeline/gitlab/gitlabReleaseJobs.d.ts +33 -0
  164. package/dist/pipeline/gitlab/gitlabReleaseJobs.js +24 -0
  165. package/dist/pipeline/index.d.ts +3 -1
  166. package/dist/pipeline/index.js +16 -8
  167. package/dist/pipeline/packageManager.js +4 -2
  168. package/dist/pipeline/yarn/yarnUtils.js +6 -4
  169. package/dist/rules/index.d.ts +4 -1
  170. package/dist/rules/index.js +25 -18
  171. package/dist/runner/index.d.ts +1 -1
  172. package/dist/runner/index.js +3 -1
  173. package/dist/tsconfig.tsbuildinfo +1 -1
  174. package/dist/types/config.d.ts +18 -15
  175. package/dist/types/config.js +5 -2
  176. package/dist/types/context.d.ts +37 -32
  177. package/dist/types/context.js +3 -1
  178. package/dist/types/environmentContext.d.ts +11 -7
  179. package/dist/types/environmentContext.js +3 -1
  180. package/dist/types/gitlab-ci-yml.d.ts +30 -30
  181. package/dist/types/gitlab-ci-yml.js +3 -2
  182. package/dist/types/gitlab-types.d.ts +4 -6
  183. package/dist/types/gitlab-types.js +3 -1
  184. package/dist/types/index.js +13 -7
  185. package/dist/types/jobs.d.ts +23 -6
  186. package/dist/types/jobs.js +3 -1
  187. package/dist/types/pipeline.d.ts +4 -3
  188. package/dist/types/pipeline.js +3 -1
  189. package/dist/types/utils.d.ts +1 -1
  190. package/dist/types/utils.js +3 -1
  191. package/dist/utils/gitlab.js +3 -1
  192. package/dist/utils/index.d.ts +1 -1
  193. package/dist/utils/index.js +3 -1
  194. package/dist/utils/writeFiles.d.ts +7 -0
  195. package/dist/{pipeline/commitInfo/getBuildId.js → utils/writeFiles.js} +39 -22
  196. package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +480 -384
  197. package/examples/__snapshots__/cloud-run-meteor-with-worker.ts.snap +462 -366
  198. package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +480 -384
  199. package/examples/__snapshots__/cloud-run-no-service.ts.snap +501 -393
  200. package/examples/__snapshots__/cloud-run-non-public.ts.snap +480 -384
  201. package/examples/__snapshots__/cloud-run-post-stop-job.ts.snap +489 -392
  202. package/examples/__snapshots__/cloud-run-service-gen2.ts.snap +480 -384
  203. package/examples/__snapshots__/cloud-run-service-with-volumes.ts.snap +501 -401
  204. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +1155 -915
  205. package/examples/__snapshots__/cloud-run-with-sql.ts.snap +1116 -888
  206. package/examples/__snapshots__/cloud-run-with-worker.ts.snap +482 -386
  207. package/examples/__snapshots__/custom-build-job-with-tests.ts.snap +452 -356
  208. package/examples/__snapshots__/custom-build-job.ts.snap +434 -350
  209. package/examples/__snapshots__/custom-deploy.ts.snap +319 -223
  210. package/examples/__snapshots__/custom-envs.ts.snap +123 -81
  211. package/examples/__snapshots__/custom-sbom-java.ts.snap +434 -350
  212. package/examples/__snapshots__/kubernetes-application-customization.ts.snap +846 -969
  213. package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +886 -957
  214. package/examples/__snapshots__/kubernetes-with-cloud-sql.ts.snap +894 -969
  215. package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +1626 -1728
  216. package/examples/__snapshots__/kubernetes-with-mongodb.ts.snap +974 -1137
  217. package/examples/__snapshots__/local-dot-env.ts.snap +480 -384
  218. package/examples/__snapshots__/meteor-kubernetes.ts.snap +906 -1069
  219. package/examples/__snapshots__/multiline-var.ts.snap +4500 -0
  220. package/examples/__snapshots__/native-app.ts.snap +706 -578
  221. package/examples/__snapshots__/node-build-with-custom-image.ts.snap +480 -384
  222. package/examples/__snapshots__/node-build-with-docker-additions.ts.snap +488 -384
  223. package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1656 -1942
  224. package/examples/__snapshots__/wait-for-other-deploy.ts.snap +287 -231
  225. package/examples/__utils__/helpers.ts +2 -2
  226. package/examples/custom-deploy.ts +7 -7
  227. package/examples/multiline-var.ts +64 -0
  228. package/package.json +5 -8
  229. package/scripts/generate-gitlab-ci-types.ts +2 -2
  230. package/src/bash/BashExpression.ts +81 -0
  231. package/src/bash/bashExpressionPerPipelineType.ts +16 -0
  232. package/src/bash/bashYaml.ts +46 -0
  233. package/src/bash/getInjectVarsScript.ts +12 -0
  234. package/src/bash/replaceAsync.ts +50 -0
  235. package/src/build/base/__tests__/createArtifactsConfig.test.ts +3 -3
  236. package/src/build/base/createAppBuildJob.ts +8 -4
  237. package/src/build/base/createArtifactsConfig.ts +2 -2
  238. package/src/build/base/index.ts +1 -1
  239. package/src/build/base/writeBuildInfo.ts +1 -1
  240. package/src/build/base/writeDotEnv.ts +6 -1
  241. package/src/build/custom/__tests__/testJob.test.ts +1 -1
  242. package/src/build/custom/buildJob.ts +4 -6
  243. package/src/build/custom/testJob.ts +6 -5
  244. package/src/build/docker.ts +21 -13
  245. package/src/build/index.ts +1 -1
  246. package/src/build/node/buildJob.ts +3 -5
  247. package/src/build/node/cache.ts +4 -4
  248. package/src/build/node/meteor.ts +1 -1
  249. package/src/build/node/testJob.ts +6 -5
  250. package/src/build/node/yarn.ts +14 -9
  251. package/src/build/rails/test.ts +2 -1
  252. package/src/build/types.ts +8 -1
  253. package/src/catladder-gitlab.ts +8 -55
  254. package/src/config/configruedEnvs.ts +6 -6
  255. package/src/config/readConfig.ts +4 -5
  256. package/src/constants.ts +5 -2
  257. package/src/context/__tests__/resolveReferences.test.ts +11 -6
  258. package/src/context/getBuildInfoVariables.ts +40 -0
  259. package/src/context/getEnvConfig.ts +1 -1
  260. package/src/context/getEnvType.ts +1 -1
  261. package/src/context/getEnvironment.ts +7 -30
  262. package/src/context/getEnvironmentContext.ts +25 -29
  263. package/src/context/getEnvironmentVariables.ts +72 -47
  264. package/src/context/getReviewSlug.ts +27 -0
  265. package/src/context/index.ts +26 -25
  266. package/src/context/resolveReferences.ts +40 -17
  267. package/src/context/transformJobOnlyVars.ts +6 -3
  268. package/src/context/utils/envVars.ts +5 -4
  269. package/src/deploy/base/deploy.ts +25 -23
  270. package/src/deploy/base/index.ts +1 -1
  271. package/src/deploy/base/rollback.ts +9 -11
  272. package/src/deploy/base/stop.ts +9 -10
  273. package/src/deploy/cloudRun/artifactsRegistry.ts +13 -8
  274. package/src/deploy/cloudRun/cleanup.ts +3 -3
  275. package/src/deploy/cloudRun/cloudRunRevisions.ts +3 -3
  276. package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +22 -17
  277. package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +7 -6
  278. package/src/deploy/cloudRun/createJobs/common.ts +1 -1
  279. package/src/deploy/cloudRun/createJobs/constants.ts +1 -0
  280. package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +25 -7
  281. package/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.ts +1 -1
  282. package/src/deploy/cloudRun/createJobs/index.ts +18 -9
  283. package/src/deploy/cloudRun/createJobs/volumes.ts +2 -2
  284. package/src/deploy/cloudRun/index.ts +22 -10
  285. package/src/deploy/cloudRun/utils/createArgsString.ts +3 -2
  286. package/src/deploy/cloudRun/utils/database.ts +7 -7
  287. package/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.ts +1 -1
  288. package/src/deploy/cloudRun/utils/jobName.ts +7 -2
  289. package/src/deploy/cloudRun/utils/removeFirstLinesFromCommandOutput.ts +1 -1
  290. package/src/deploy/cloudSql/utils.ts +13 -10
  291. package/src/deploy/index.ts +5 -4
  292. package/src/deploy/kubernetes/cloudSql/index.ts +6 -5
  293. package/src/deploy/kubernetes/deployJob.ts +28 -14
  294. package/src/deploy/kubernetes/index.ts +15 -8
  295. package/src/deploy/kubernetes/kubeEnv.ts +9 -7
  296. package/src/deploy/kubernetes/kubeValues.ts +5 -6
  297. package/src/deploy/kubernetes/mongodb.ts +1 -1
  298. package/src/deploy/kubernetes/processSecretsAsFiles.ts +5 -4
  299. package/src/deploy/types/base.ts +6 -0
  300. package/src/deploy/types/googleCloudRun.ts +2 -0
  301. package/src/deploy/utils.ts +2 -2
  302. package/src/index.ts +2 -1
  303. package/src/packageInfos.ts +10 -0
  304. package/src/pipeline/createAllJobs.ts +28 -14
  305. package/src/pipeline/createChildPipeline.ts +20 -9
  306. package/src/pipeline/createJobsForComponent.ts +15 -23
  307. package/src/pipeline/createMainPipeline.ts +91 -0
  308. package/src/pipeline/generatePipelineFiles.ts +29 -0
  309. package/src/pipeline/getPipelineStages.ts +1 -1
  310. package/src/pipeline/gitlab/createGitlabJobs.ts +182 -59
  311. package/src/pipeline/gitlab/createGitlabPipeline.ts +16 -14
  312. package/src/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.ts +46 -0
  313. package/src/pipeline/gitlab/gitlabReleaseJobs.ts +20 -0
  314. package/src/pipeline/index.ts +2 -0
  315. package/src/pipeline/packageManager.ts +2 -2
  316. package/src/pipeline/yarn/yarnUtils.ts +7 -7
  317. package/src/rules/index.ts +15 -9
  318. package/src/types/config.ts +12 -3
  319. package/src/types/context.ts +39 -26
  320. package/src/types/environmentContext.ts +13 -7
  321. package/src/types/gitlab-ci-yml.ts +0 -1
  322. package/src/types/gitlab-types.ts +5 -4
  323. package/src/types/jobs.ts +29 -4
  324. package/src/types/pipeline.ts +4 -0
  325. package/src/types/utils.ts +4 -4
  326. package/src/utils/gitlab.ts +1 -1
  327. package/src/utils/index.ts +2 -2
  328. package/src/utils/writeFiles.ts +40 -0
  329. package/dist/deploy/cloudRun/createJobs/variables.d.ts +0 -5
  330. package/dist/deploy/cloudRun/createJobs/variables.js +0 -19
  331. package/dist/pipeline/commitInfo/getBuildId.d.ts +0 -6
  332. package/dist/pipeline/commitInfo/getCommitInfo.d.ts +0 -2
  333. package/src/deploy/cloudRun/createJobs/variables.ts +0 -21
  334. package/src/pipeline/commitInfo/getBuildId.ts +0 -17
  335. package/src/pipeline/commitInfo/getCommitInfo.ts +0 -15
@@ -1,4 +1,9 @@
1
1
  import type { DeployTypeDefinition } from "..";
2
+ import {
3
+ BashExpression,
4
+ getBashVariable,
5
+ joinBashExpressions,
6
+ } from "../../bash/BashExpression";
2
7
  import { getSecretVarName } from "../../context";
3
8
  import type { EnvironmentContext } from "../../types/environmentContext";
4
9
  import { sanitizeForBashVariable } from "../../utils/gitlab";
@@ -28,11 +33,11 @@ const getCloudSqlVariables = ({
28
33
  deployConfigRaw.cloudSql,
29
34
  fullConfig,
30
35
  environmentSlugPrefix,
31
- componentName
36
+ componentName,
32
37
  );
33
38
 
34
39
  const additionalQueryParamsString = Object.entries(
35
- deployConfigRaw.cloudSql.dbAdditionalQueryParams ?? {}
40
+ deployConfigRaw.cloudSql.dbAdditionalQueryParams ?? {},
36
41
  )
37
42
  .map(([key, value]) => `&${key}=${value}`)
38
43
  .join("");
@@ -44,7 +49,7 @@ const getCloudSqlVariables = ({
44
49
  DB_USER: deployConfigRaw.cloudSql.dbUser ?? "postgres",
45
50
  DB_PASSWORD: "$" + getSecretVarName(env, componentName, "DB_PASSWORD"),
46
51
  DATABASE_URL: `${getDatabaseConnectionString(
47
- deployConfigRaw.cloudSql
52
+ deployConfigRaw.cloudSql,
48
53
  )}${additionalQueryParamsString}`,
49
54
  DATABASE_JDBC_URL: DATABASE_JDBC_URL,
50
55
  };
@@ -78,13 +83,20 @@ export const GCLOUD_RUN_DEPLOY_TYPE: DeployTypeDefinition<"google-cloudrun"> = {
78
83
  ],
79
84
  getAdditionalEnvVars: (ctx) => {
80
85
  const { fullName, env, componentName, deployConfigRaw } = ctx;
81
- const HOST_INTERNAL =
82
- fullName.toLowerCase() +
83
- "-" +
84
- (process.env[
85
- getSecretVarName(env, componentName, GCLOUD_RUN_CANONICAL_HOST_SUFFIX)
86
- ] ?? "unknown-host.example.com");
87
86
 
87
+ const HOST_INTERNAL = joinBashExpressions(
88
+ [
89
+ fullName,
90
+ getBashVariable(
91
+ getSecretVarName(
92
+ env,
93
+ componentName,
94
+ GCLOUD_RUN_CANONICAL_HOST_SUFFIX,
95
+ ),
96
+ ),
97
+ ],
98
+ "-",
99
+ ).toLowerCase();
88
100
  const jobTriggers =
89
101
  deployConfigRaw && deployConfigRaw.jobs
90
102
  ? Object.fromEntries(
@@ -95,7 +107,7 @@ export const GCLOUD_RUN_DEPLOY_TYPE: DeployTypeDefinition<"google-cloudrun"> = {
95
107
  }-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/${
96
108
  deployConfigRaw.projectId
97
109
  }/jobs/${getCloudRunJobName(fullName, name)}:run`,
98
- ])
110
+ ]),
99
111
  )
100
112
  : {};
101
113
 
@@ -1,4 +1,5 @@
1
1
  import { isNil } from "lodash";
2
+ import type { BashExpression } from "../../../bash/BashExpression";
2
3
 
3
4
  /**
4
5
  * creates arguments string:
@@ -22,12 +23,12 @@ export const createArgsString = (...args: keyValuesArg[]) =>
22
23
  return `--no-${key}`;
23
24
  }
24
25
  return `--${key}=${value}`;
25
- })
26
+ }),
26
27
  )
27
28
  .flat()
28
29
  .join(" ");
29
30
 
30
31
  export type keyValuesArg = Record<
31
32
  string,
32
- string | number | true | false | undefined
33
+ string | number | true | false | undefined | BashExpression
33
34
  >;
@@ -7,13 +7,13 @@ import type {
7
7
 
8
8
  export const getDatabaseDeleteScript = (
9
9
  context: Context,
10
- deployConfig: DeployConfigCloudRun
10
+ deployConfig: DeployConfigCloudRun,
11
11
  ): string[] => {
12
12
  if (!deployConfig.cloudSql || !deployConfig.cloudSql.deleteDatabaseOnStop) {
13
13
  throw new Error("not possible");
14
14
  }
15
+ const DB_NAME = context.environment.envVars["DB_NAME"];
15
16
 
16
- const { DB_NAME } = context.environment.envVars ?? {};
17
17
  if (!DB_NAME) {
18
18
  throw new Error("error: env vars did not specify DB_NAME");
19
19
  }
@@ -29,20 +29,20 @@ export const getDatabaseDeleteScript = (
29
29
  `gcloud sql databases delete ${DB_NAME} --instance=${instanceId} --project ${projectId}`,
30
30
  {
31
31
  pauseInSeconds: 10,
32
- }
32
+ },
33
33
  ),
34
34
  ];
35
35
  };
36
36
 
37
37
  export const getDatabaseCreateScript = (
38
38
  context: Context,
39
- deployConfig: DeployConfigCloudRun
39
+ deployConfig: DeployConfigCloudRun,
40
40
  ): string[] => {
41
41
  if (!deployConfig.cloudSql) {
42
42
  throw new Error("not possible");
43
43
  }
44
44
 
45
- const { DB_NAME } = context.environment.envVars ?? {};
45
+ const DB_NAME = context.environment.envVars["DB_NAME"];
46
46
 
47
47
  if (!DB_NAME) {
48
48
  throw new Error("error: env vars did not specify DB_NAME");
@@ -61,14 +61,14 @@ export const DATABASE_JDBC_URL =
61
61
  "jdbc:postgresql:///$DB_NAME?cloudSqlInstance=$CLOUD_SQL_INSTANCE_CONNECTION_NAME&socketFactory=com.google.cloud.sql.postgres.SocketFactory&user=$DB_USER&password=$DB_PASSWORD";
62
62
 
63
63
  export const getDatabaseConnectionString = (
64
- config: DeployConfigCloudRunCloudSql
64
+ config: DeployConfigCloudRunCloudSql,
65
65
  ): string => {
66
66
  switch (config.dbConnectionStringFormat) {
67
67
  case "jdbc":
68
68
  return DATABASE_JDBC_URL;
69
69
  case "rails":
70
70
  return `postgresql://$DB_USER:$DB_PASSWORD@${encodeURIComponent(
71
- `/cloudsql/${config.instanceConnectionName}`
71
+ `/cloudsql/${config.instanceConnectionName}`,
72
72
  )}/$DB_NAME?`;
73
73
  default:
74
74
  // prisma
@@ -5,6 +5,6 @@ import type { Context } from "../../../types";
5
5
  export const gcloudServiceAccountLoginCommands = (context: Context) => [
6
6
  `gcloud auth activate-service-account --key-file=<(echo "$${getSecretVarNameForContext(
7
7
  context,
8
- GCLOUD_DEPLOY_CREDENTIALS_KEY
8
+ GCLOUD_DEPLOY_CREDENTIALS_KEY,
9
9
  )}")`,
10
10
  ];
@@ -1,2 +1,7 @@
1
- export const getCloudRunJobName = (fullAppName: string, jobName: string) =>
2
- fullAppName.toLowerCase() + "-" + jobName.toLowerCase();
1
+ import type { StringOrBashExpression } from "../../../bash/BashExpression";
2
+
3
+ export const getCloudRunJobName = (
4
+ fullAppName: StringOrBashExpression,
5
+ jobName: string,
6
+ ): StringOrBashExpression =>
7
+ fullAppName.toLowerCase().concat("-" + jobName.toLowerCase());
@@ -8,5 +8,5 @@
8
8
  */
9
9
  export const removeFirstLinesFromCommandOutput = (
10
10
  cmd: string,
11
- removeFirstN: number
11
+ removeFirstN: number,
12
12
  ) => (removeFirstN === 0 ? cmd : `${cmd} | tail -n +${removeFirstN + 1}`);
@@ -1,4 +1,6 @@
1
1
  import type { Config } from "../..";
2
+ import type { StringOrBashExpression } from "../../bash/BashExpression";
3
+ import { joinBashExpressions } from "../../bash/BashExpression";
2
4
  import type {
3
5
  DeployConfigCloudRunCloudSql,
4
6
  DeployConfigKubernetesValuesCloudSQLUnmanaged,
@@ -9,15 +11,16 @@ export const getFullDbName = (
9
11
  | DeployConfigCloudRunCloudSql
10
12
  | DeployConfigKubernetesValuesCloudSQLUnmanaged,
11
13
  fullConfig: Config<never>,
12
- environmentSlugPrefix: string,
13
- componentName: string
14
+ environmentSlugPrefix: StringOrBashExpression,
15
+ componentName: string,
14
16
  ) => {
15
- return [
16
- cloudSqlConfig.dbNamePrefix ??
17
- `${fullConfig.customerName}-${fullConfig.appName}`,
18
- environmentSlugPrefix,
19
- cloudSqlConfig.dbBaseName ?? componentName,
20
- ]
21
- .filter(Boolean)
22
- .join("-");
17
+ return joinBashExpressions(
18
+ [
19
+ cloudSqlConfig.dbNamePrefix ??
20
+ `${fullConfig.customerName}-${fullConfig.appName}`,
21
+ environmentSlugPrefix,
22
+ cloudSqlConfig.dbBaseName ?? componentName,
23
+ ].flatMap((part) => (part ? [part] : [])),
24
+ "-",
25
+ );
23
26
  };
@@ -1,4 +1,5 @@
1
1
  import type { SecretEnvVar } from "..";
2
+ import type { BashExpression } from "../bash/BashExpression";
2
3
  import type { Context } from "../types/context";
3
4
  import type { EnvironmentContext } from "../types/environmentContext";
4
5
  import type { CatladderJob } from "../types/jobs";
@@ -16,14 +17,14 @@ export * from "./utils";
16
17
  export type DeployTypeDefinition<T extends DeployConfigType> = {
17
18
  jobs: (context: Context) => CatladderJob[];
18
19
  defaults: (
19
- envContext: EnvironmentContext<any, T>
20
+ envContext: EnvironmentContext<any, T>,
20
21
  ) => PartialDeep<DeployConfigGeneric<T>>;
21
22
  additionalSecretKeys: (
22
- envContext: EnvironmentContext<any, T>
23
+ envContext: EnvironmentContext<any, T>,
23
24
  ) => SecretEnvVar[];
24
25
  getAdditionalEnvVars: (
25
- envContext: EnvironmentContext<any, T>
26
- ) => Record<string, string | undefined | null>;
26
+ envContext: EnvironmentContext<any, T>,
27
+ ) => Record<string, string | BashExpression | undefined | null>;
27
28
  };
28
29
  export type DeployTypes = {
29
30
  [T in DeployConfigType]: DeployTypeDefinition<T>;
@@ -1,3 +1,4 @@
1
+ import type { StringOrBashExpression } from "../../../bash/BashExpression";
1
2
  import { getSecretVarNameForContext } from "../../../context";
2
3
  import type { Context } from "../../../types";
3
4
  import { getFullDbName } from "../../cloudSql/utils";
@@ -15,11 +16,11 @@ type CloudSqlValues = {
15
16
  proxyCredentials: string;
16
17
 
17
18
  instanceConnectionName: string;
18
- fullDbName: string;
19
+ fullDbName: StringOrBashExpression;
19
20
  dbUser: string;
20
21
  };
21
22
  export const createKubernetesCloudsqlBaseValues = (
22
- context: Context
23
+ context: Context,
23
24
  ): {
24
25
  cloudsql: CloudSqlValues;
25
26
  } => {
@@ -35,7 +36,7 @@ export const createKubernetesCloudsqlBaseValues = (
35
36
 
36
37
  const proxyCredentials = `$${getSecretVarNameForContext(
37
38
  context,
38
- "cloudsqlProxyCredentials"
39
+ "cloudsqlProxyCredentials",
39
40
  )}`;
40
41
  if (config?.type !== "unmanaged") {
41
42
  const instanceConnectionName = `${config.projectId ?? "skynet-164509"}:${
@@ -48,7 +49,7 @@ export const createKubernetesCloudsqlBaseValues = (
48
49
  dbUser: "postgres",
49
50
  instanceConnectionName,
50
51
  proxyCredentials,
51
- fullDbName: context.environment.envVars.KUBE_APP_NAME,
52
+ fullDbName: context.environment.envVars.KUBE_APP_NAME ?? "",
52
53
  },
53
54
  };
54
55
  } else if (config.type === "unmanaged") {
@@ -62,7 +63,7 @@ export const createKubernetesCloudsqlBaseValues = (
62
63
  config,
63
64
  context.fullConfig,
64
65
  context.environment.slugPrefix,
65
- context.componentName
66
+ context.componentName,
66
67
  ),
67
68
  },
68
69
  };
@@ -1,4 +1,4 @@
1
- import { dump } from "js-yaml";
1
+ import { getSecretVarNameForContext } from "../../context/getEnvironmentVariables";
2
2
  import { getRunnerImage } from "../../runner";
3
3
  import type { Context } from "../../types/context";
4
4
  import type { CatladderJob } from "../../types/jobs";
@@ -9,10 +9,13 @@ import {
9
9
  } from "../sbom";
10
10
  import { isOfDeployType } from "../types";
11
11
  import { createKubeValues } from "./kubeValues";
12
- import { getSecretVarNameForContext } from "../../context/getEnvironmentVariables";
13
12
 
13
+ import { writeBashYamlToFileScript } from "../../bash/bashYaml";
14
+ import { collapseableSection } from "../../utils/gitlab";
15
+
16
+ const ALL_VALUES_FILE = "__all_values.yml";
14
17
  export const createKubernetesDeployJobs = (
15
- context: Context
18
+ context: Context,
16
19
  ): CatladderJob[] => {
17
20
  const deployConfig = context.componentConfig.deploy;
18
21
  if (deployConfig === false) {
@@ -23,19 +26,23 @@ export const createKubernetesDeployJobs = (
23
26
  throw new Error("deploy config is not kubernetes");
24
27
  }
25
28
 
26
- const kubeValues = createKubeValues(context);
27
- const shared: Pick<CatladderJob, "image" | "variables"> = {
29
+ const shared: Pick<CatladderJob, "image" | "variables" | "artifacts"> = {
28
30
  image: getRunnerImage("kubernetes"),
31
+ ...(deployConfig.debug
32
+ ? {
33
+ artifacts: {
34
+ paths: [
35
+ ALL_VALUES_FILE, // debug
36
+ ],
37
+ when: "always",
38
+ },
39
+ }
40
+ : {}),
29
41
  variables: {
30
42
  ...context.environment.envVars,
31
43
  RELEASE_NAME: context.environment.fullName,
32
44
  HELM_EXPERIMENTAL_OCI: "1",
33
45
  KUBE_DOCKER_IMAGE_PULL_SECRET: `gitlab-registry-${context.componentName}`,
34
- KUBE_VALUES: dump(kubeValues, {
35
- lineWidth: -1,
36
- quotingType: "'",
37
- forceQuotes: true,
38
- }),
39
46
  HELM_GITLAB_CHART_NAME:
40
47
  deployConfig.chartName ?? "/helm-charts/the-panter-chart",
41
48
  HELM_ARGS: [
@@ -43,7 +50,8 @@ export const createKubernetesDeployJobs = (
43
50
  ...(deployConfig.additionalHelmArgs ?? []),
44
51
  ].join(" "),
45
52
  COMPONENT_NAME: context.componentName,
46
- BUILD_ID: context.commitInfo?.buildId,
53
+ /** @deprecated */
54
+ BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID,
47
55
  },
48
56
  };
49
57
 
@@ -51,14 +59,14 @@ export const createKubernetesDeployJobs = (
51
59
  const connectContext = [
52
60
  `kubectl config set-cluster "${clusterName}" --server="$${getSecretVarNameForContext(
53
61
  context,
54
- "KUBE_URL"
62
+ "KUBE_URL",
55
63
  )}" --certificate-authority <(echo $${getSecretVarNameForContext(
56
64
  context,
57
- "KUBE_CA_PEM"
65
+ "KUBE_CA_PEM",
58
66
  )} | base64 -d) --embed-certs=true`,
59
67
  `kubectl config set-credentials "${clusterName}" --token="$${getSecretVarNameForContext(
60
68
  context,
61
- "KUBE_TOKEN"
69
+ "KUBE_TOKEN",
62
70
  )}"`,
63
71
  `kubectl config set-context "${clusterName}" --cluster="${clusterName}" --user="${clusterName}" --namespace="${context.environment.envVars.KUBE_NAMESPACE}"`,
64
72
  `kubectl config use-context "${clusterName}"`,
@@ -69,6 +77,12 @@ export const createKubernetesDeployJobs = (
69
77
  ...shared,
70
78
  script: [
71
79
  ...connectContext,
80
+ ...collapseableSection(
81
+ "writeallvalues",
82
+ "Write " + ALL_VALUES_FILE + " for helm deployment",
83
+ )(
84
+ writeBashYamlToFileScript(createKubeValues(context), ALL_VALUES_FILE),
85
+ ),
72
86
  "kubernetesCreateSecret",
73
87
  "kubernetesDeploy",
74
88
  ...getDependencyTrackUploadScript(context),
@@ -1,6 +1,7 @@
1
1
  import slugify from "slugify";
2
2
  import type { DeployTypeDefinition } from "..";
3
3
  import { getKubernetesNamespace } from "..";
4
+ import { joinBashExpressions } from "../../bash/BashExpression";
4
5
  import { additionalKubernetesSecretKeys } from "./additionalSecretKeys";
5
6
  import { createKubernetesDeployJobs } from "./deployJob";
6
7
  export * from "./cloudSql";
@@ -13,25 +14,31 @@ export const KUBERNETES_DEPLOY_TYPE: DeployTypeDefinition<"kubernetes"> = {
13
14
  fullConfig,
14
15
  deployConfigRaw,
15
16
  env,
17
+ reviewSlug,
16
18
  envType,
17
- commitInfo,
18
19
  }) => {
19
20
  const KUBE_APP_NAME_PREFIX =
20
- envType === "review" && commitInfo ? `${commitInfo.reviewSlug}-` : "";
21
- const KUBE_APP_NAME = `${KUBE_APP_NAME_PREFIX}${componentName}`;
21
+ envType === "review" && reviewSlug ? reviewSlug.concat("-") : "";
22
+ const KUBE_APP_NAME = KUBE_APP_NAME_PREFIX.concat(componentName);
22
23
  const KUBE_NAMESPACE = getKubernetesNamespace(fullConfig, env);
23
24
  const componentSlug = slugify(componentName);
24
- const envInUrl =
25
- envType === "review" && commitInfo
26
- ? `${commitInfo.reviewSlug}.${env}`
27
- : env;
28
25
 
29
26
  const domainCanonical =
30
27
  (deployConfigRaw && deployConfigRaw.cluster?.domainCanonical) || // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
31
28
  fullConfig.domainCanonical ||
32
29
  "panter.cloud";
33
- const HOST_INTERNAL = `${componentSlug}.${envInUrl}.${fullConfig.appName}.${fullConfig.customerName}.${domainCanonical}`; // default for kubernetes and rest
34
30
 
31
+ const HOST_INTERNAL = joinBashExpressions(
32
+ [
33
+ componentSlug,
34
+ ...(envType === "review" && reviewSlug ? [reviewSlug] : []),
35
+ env,
36
+ fullConfig.appName,
37
+ fullConfig.customerName,
38
+ domainCanonical,
39
+ ],
40
+ ".",
41
+ ); // default for kubernetes and rest
35
42
  return {
36
43
  KUBE_NAMESPACE,
37
44
  KUBE_APP_NAME,
@@ -1,7 +1,9 @@
1
+ import type { StringOrBashExpression } from "../../bash/BashExpression";
1
2
  import type { Context } from "../../types";
2
3
  import { isOfDeployType } from "../types";
3
4
 
4
- const shouldGoIntoSecrets = (key: string, value: string) => {
5
+ const shouldGoIntoSecrets = (key: string, value: string | undefined) => {
6
+ if (!value) return false;
5
7
  if (String(value)?.includes("$CL_")) {
6
8
  return true;
7
9
  }
@@ -21,27 +23,27 @@ export const createKubeEnv = (context: Context) => {
21
23
  const allEnvVars = context.environment.envVars;
22
24
 
23
25
  const env = Object.entries(allEnvVars).reduce<{
24
- secret: Record<string, string>;
25
- public: Record<string, string>;
26
+ secret: Record<string, StringOrBashExpression>;
27
+ public: Record<string, StringOrBashExpression>;
26
28
  }>(
27
29
  (acc, [key, value]) => {
28
- if (shouldGoIntoSecrets(key, value)) {
30
+ if (shouldGoIntoSecrets(key, value?.toString())) {
29
31
  acc.secret = {
30
32
  ...acc.secret,
31
- [key]: value,
33
+ [key]: value ?? "",
32
34
  };
33
35
  return acc;
34
36
  }
35
37
  acc.public = {
36
38
  ...acc.public,
37
- [key]: value,
39
+ [key]: value ?? "",
38
40
  };
39
41
  return acc;
40
42
  },
41
43
  {
42
44
  secret: {},
43
45
  public: {},
44
- }
46
+ },
45
47
  );
46
48
 
47
49
  return env;
@@ -15,7 +15,7 @@ import { processSecretsAsFiles } from "./processSecretsAsFiles";
15
15
 
16
16
  const createAppConfig = (
17
17
  context: Context,
18
- application: DeployConfigKubernetesValues["application"]
18
+ application: DeployConfigKubernetesValues["application"],
19
19
  ): DeployConfigKubernetesValues["application"] => {
20
20
  if (application === false) {
21
21
  return {
@@ -45,14 +45,14 @@ const createAppConfig = (
45
45
  },
46
46
  },
47
47
  }, // default
48
- rest // merge rest in
48
+ rest, // merge rest in
49
49
  );
50
50
  };
51
51
 
52
52
  const removeFalsy = <T>(record?: Record<string, false | T>) => {
53
53
  if (!record) return undefined;
54
54
  return Object.fromEntries(
55
- Object.entries(record).filter(([, value]) => value !== false)
55
+ Object.entries(record).filter(([, value]) => value !== false),
56
56
  );
57
57
  };
58
58
 
@@ -70,7 +70,6 @@ export const createKubeValues = (context: Context) => {
70
70
 
71
71
  // we remove the application config because it can be just the value `false` which is a convenience feature, but not supported in the helm chart
72
72
  // we only merge the rest of the values in
73
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
74
73
  const { application, jobs, cronjobs, ...rest } = values ?? {};
75
74
 
76
75
  const env = createKubeEnv(context);
@@ -85,7 +84,7 @@ export const createKubeValues = (context: Context) => {
85
84
  : {},
86
85
  deployConfig.values?.mongodb?.enabled
87
86
  ? createMongodbBaseConfig(context)
88
- : {}
87
+ : {},
89
88
  );
90
89
 
91
90
  const kubeValues = processSecretsAsFiles(
@@ -94,7 +93,7 @@ export const createKubeValues = (context: Context) => {
94
93
  cronjobs: removeFalsy(cronjobs),
95
94
 
96
95
  ...rest,
97
- })
96
+ }),
98
97
  );
99
98
 
100
99
  return kubeValues;
@@ -19,7 +19,7 @@ const getMongodbReplicasetHost = (context: Context, index: number) => {
19
19
  const fullAppname = context.environment.envVars.KUBE_APP_NAME;
20
20
  return getMongodbHost(
21
21
  context,
22
- `${fullAppname}-mongodb-${index}.${fullAppname}-mongodb-headless`
22
+ `${fullAppname}-mongodb-${index}.${fullAppname}-mongodb-headless`,
23
23
  );
24
24
  };
25
25
  const createMongodbUrl = (context: Context, dbName: string) => {
@@ -1,14 +1,15 @@
1
1
  import { omit } from "lodash";
2
2
  import type { DeployConfigKubernetesValues } from "../types";
3
+ import type { StringOrBashExpression } from "../../bash/BashExpression";
3
4
 
4
5
  export const processSecretsAsFiles = <
5
6
  T extends {
6
7
  env: {
7
- secret: Record<string, string>;
8
+ secret: Record<string, StringOrBashExpression>;
8
9
  };
9
- } & DeployConfigKubernetesValues
10
+ } & DeployConfigKubernetesValues,
10
11
  >(
11
- values: T
12
+ values: T,
12
13
  ): T => {
13
14
  if (!values.secretsAsFile || values.secretsAsFile.length === 0) {
14
15
  return values;
@@ -26,7 +27,7 @@ export const processSecretsAsFiles = <
26
27
  values.secretsAsFile.map((key) => [
27
28
  key + "_content",
28
29
  values.env.secret[key],
29
- ])
30
+ ]),
30
31
  ),
31
32
  },
32
33
  },
@@ -31,6 +31,12 @@ export type DeployConfigBase = {
31
31
  * @deprecated use deploy.jobVars for deploy job specific variables
32
32
  */
33
33
  extraVars?: Record<string, string>;
34
+ /**
35
+ * additional vars only for the runner.
36
+ * Also if you use services: that require env vars, you need to set them here.
37
+ *
38
+ */
39
+ runnerVariables?: Record<string, string>;
34
40
  };
35
41
 
36
42
  export type AllowUnknownProps<T extends Record<string, unknown>> = T &
@@ -256,6 +256,8 @@ export type DeployConfigCloudRun = {
256
256
  * add cloudSql
257
257
  */
258
258
  cloudSql?: DeployConfigCloudRunCloudSql | false;
259
+
260
+ debug?: boolean;
259
261
  } & DeployConfigBase;
260
262
 
261
263
  export type DeployConfigCloudRunVolumes = Record<
@@ -3,7 +3,7 @@ import type { DeployConfigKubernetesCluster } from "./types";
3
3
  import { isOfDeployType } from "./types";
4
4
 
5
5
  export const getFullKubernetesClusterName = (
6
- cluster: DeployConfigKubernetesCluster
6
+ cluster: DeployConfigKubernetesCluster,
7
7
  ) => {
8
8
  if (cluster.type === "gcloud") {
9
9
  return `gke_${cluster.projectId}_${cluster.region}_${cluster.name}`;
@@ -12,7 +12,7 @@ export const getFullKubernetesClusterName = (
12
12
 
13
13
  export const getKubernetesNamespace = (
14
14
  config: Pick<Config, "customerName" | "appName">,
15
- env: string
15
+ env: string,
16
16
  ) => {
17
17
  return `${config.customerName}-${config.appName}-${env}`;
18
18
  };
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./pipeline/";
1
+ export * from "./pipeline";
2
2
  export * from "./types";
3
3
  export * from "./rules";
4
4
  export * from "./runner";
@@ -6,3 +6,4 @@ export * from "./config";
6
6
  export * from "./context";
7
7
  export * from "./build";
8
8
  export * from "./deploy";
9
+ export * from "./utils/writeFiles";
@@ -0,0 +1,10 @@
1
+ // we can't import the package.json directly, because the bundling process will inline it
2
+ // but the version is only set during deployement, when its already bundled
3
+ // instead we need to use require.main.path to get the path of the main module, which is actually the file in the bin
4
+ // this will point to the root package.json
5
+
6
+ const path = require.main?.path + "/../package.json";
7
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
8
+ const ownPkg = require(path);
9
+
10
+ export default ownPkg;