@catladder/pipeline 3.29.1 → 3.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/build/rails/index.js +2 -2
  2. package/dist/constants.js +1 -1
  3. package/dist/deploy/cloudRun/createJobs/execute/onDeploy.js +22 -14
  4. package/dist/deploy/types/executeBase.d.ts +24 -0
  5. package/dist/deploy/types/executeBase.js +5 -0
  6. package/dist/deploy/types/googleCloudRun.d.ts +5 -4
  7. package/dist/tsconfig.tsbuildinfo +1 -1
  8. package/examples/__snapshots__/automatic-releases.test.ts.snap +1 -1
  9. package/examples/__snapshots__/cloud-run-execute-script-on-deploy.test.ts.snap +1618 -0
  10. package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +1 -1
  11. package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +1 -1
  12. package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +1 -1
  13. package/examples/__snapshots__/cloud-run-http2.test.ts.snap +1 -1
  14. package/examples/__snapshots__/cloud-run-llama.test.ts.snap +1 -1
  15. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +1 -1
  16. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +1 -1
  17. package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +1 -1
  18. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +1 -1
  19. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +1 -1
  20. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +1 -1
  21. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +1 -1
  22. package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +1 -1
  23. package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +1 -1
  24. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +1 -1
  25. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +1 -1
  26. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +1 -1
  27. package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +1 -1
  28. package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +1 -1
  29. package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +1 -1
  30. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +1 -1
  31. package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +1 -1
  32. package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +1 -1
  33. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +1 -1
  34. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +1 -1
  35. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +1 -1
  36. package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +1 -1
  37. package/examples/__snapshots__/custom-build-job.test.ts.snap +1 -1
  38. package/examples/__snapshots__/custom-deploy.test.ts.snap +1 -1
  39. package/examples/__snapshots__/custom-envs.test.ts.snap +1 -1
  40. package/examples/__snapshots__/custom-sbom-java.test.ts.snap +1 -1
  41. package/examples/__snapshots__/custom-verify-job.test.ts.snap +1 -1
  42. package/examples/__snapshots__/git-submodule.test.ts.snap +1 -1
  43. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +1 -1
  44. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +1 -1
  45. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +1 -1
  46. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +1 -1
  47. package/examples/__snapshots__/local-dot-env.test.ts.snap +1 -1
  48. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +1 -1
  49. package/examples/__snapshots__/modify-generated-files.test.ts.snap +1 -1
  50. package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +1 -1
  51. package/examples/__snapshots__/multiline-var.test.ts.snap +1 -1
  52. package/examples/__snapshots__/native-app.test.ts.snap +1 -1
  53. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +1 -1
  54. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +1 -1
  55. package/examples/__snapshots__/override-secrets.test.ts.snap +1 -1
  56. package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +1 -1
  57. package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +1 -1
  58. package/examples/__snapshots__/referencing-other-vars.test.ts.snap +1 -1
  59. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +1 -1
  60. package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +1 -1
  61. package/examples/__snapshots__/workspace-api-www.test.ts.snap +1 -1
  62. package/examples/automatic-releases.test.ts +1 -0
  63. package/examples/cloud-run-execute-script-on-deploy.test.ts +12 -0
  64. package/examples/cloud-run-execute-script-on-deploy.ts +47 -0
  65. package/examples/cloud-run-health-check-defaults.test.ts +1 -0
  66. package/examples/cloud-run-health-check-only-startup.test.ts +1 -0
  67. package/examples/cloud-run-health-check.test.ts +1 -0
  68. package/examples/cloud-run-http2.test.ts +1 -0
  69. package/examples/cloud-run-llama.test.ts +1 -0
  70. package/examples/cloud-run-memory-limit.test.ts +1 -0
  71. package/examples/cloud-run-meteor-with-worker.test.ts +1 -0
  72. package/examples/cloud-run-nextjs.test.ts +1 -0
  73. package/examples/cloud-run-no-cpu-throttling.test.ts +1 -0
  74. package/examples/cloud-run-no-service.test.ts +1 -0
  75. package/examples/cloud-run-non-public.test.ts +1 -0
  76. package/examples/cloud-run-post-stop-job.test.ts +1 -0
  77. package/examples/cloud-run-service-custom-vpc-connector.test.ts +1 -0
  78. package/examples/cloud-run-service-custom-vpc.test.ts +1 -0
  79. package/examples/cloud-run-service-gen2.test.ts +1 -0
  80. package/examples/cloud-run-service-increase-timout.test.ts +1 -0
  81. package/examples/cloud-run-service-with-volumes.test.ts +1 -0
  82. package/examples/cloud-run-storybook.test.ts +1 -0
  83. package/examples/cloud-run-with-agents.test.ts +1 -0
  84. package/examples/cloud-run-with-gpu.test.ts +1 -0
  85. package/examples/cloud-run-with-ngnix.test.ts +1 -0
  86. package/examples/cloud-run-with-sql-legacy-jobs.test.ts +1 -0
  87. package/examples/cloud-run-with-sql-multiple-dbs.test.ts +1 -0
  88. package/examples/cloud-run-with-sql-reuse-db.test.ts +1 -0
  89. package/examples/cloud-run-with-sql.test.ts +1 -0
  90. package/examples/cloud-run-with-worker.test.ts +1 -0
  91. package/examples/custom-build-job-with-tests.test.ts +1 -0
  92. package/examples/custom-build-job.test.ts +1 -0
  93. package/examples/custom-deploy.test.ts +1 -0
  94. package/examples/custom-envs.test.ts +1 -0
  95. package/examples/custom-sbom-java.test.ts +1 -0
  96. package/examples/custom-verify-job.test.ts +1 -0
  97. package/examples/git-submodule.test.ts +1 -0
  98. package/examples/kubernetes-application-customization.test.ts +1 -0
  99. package/examples/kubernetes-with-cloud-sql.test.ts +1 -0
  100. package/examples/kubernetes-with-jobs.test.ts +1 -0
  101. package/examples/kubernetes-with-mongodb.test.ts +1 -0
  102. package/examples/local-dot-env.test.ts +1 -0
  103. package/examples/meteor-kubernetes.test.ts +1 -0
  104. package/examples/modify-generated-files.test.ts +1 -0
  105. package/examples/modify-generated-yaml.test.ts +1 -0
  106. package/examples/multiline-var.test.ts +1 -0
  107. package/examples/native-app.test.ts +1 -0
  108. package/examples/node-build-with-custom-image.test.ts +1 -0
  109. package/examples/node-build-with-docker-additions.test.ts +1 -0
  110. package/examples/override-secrets.test.ts +1 -0
  111. package/examples/rails-k8s-with-worker.test.ts +1 -0
  112. package/examples/referencing-other-vars.test.ts +1 -0
  113. package/examples/wait-for-other-deploy.test.ts +1 -0
  114. package/examples/workspace-api-www-turbo-cache.test.ts +1 -0
  115. package/examples/workspace-api-www.test.ts +1 -0
  116. package/package.json +1 -3
  117. package/scripts/generate-examples-test.ts +1 -0
  118. package/src/build/base/__tests__/__snapshots__/createArtifactsConfig.test.ts.snap +4 -4
  119. package/src/build/base/__tests__/createArtifactsConfig.test.ts +1 -0
  120. package/src/build/custom/__tests__/testJob.test.ts +1 -0
  121. package/src/build/rails/index.ts +1 -1
  122. package/src/config/__tests__/__snapshots__/getAllEnvs.test.ts.snap +4 -4
  123. package/src/config/__tests__/__snapshots__/getAllEnvsInAllComponents.test.ts.snap +2 -2
  124. package/src/config/__tests__/configruedEnvs.test.ts +1 -0
  125. package/src/config/__tests__/getAllEnvs.test.ts +1 -0
  126. package/src/config/__tests__/getAllEnvsInAllComponents.test.ts +1 -0
  127. package/src/deploy/cloudRun/createJobs/execute/onDeploy.ts +31 -24
  128. package/src/deploy/types/base.ts +1 -0
  129. package/src/deploy/types/executeBase.ts +27 -0
  130. package/src/deploy/types/googleCloudRun.ts +8 -2
  131. package/src/pipeline/__tests__/__snapshots__/getPipelineStages.test.ts.snap +2 -2
  132. package/src/pipeline/__tests__/getPipelineStages.test.ts +1 -0
  133. package/src/variables/__tests__/resolveAllReferences.test.ts +1 -0
  134. package/src/variables/__tests__/resolveAllReferencesOnce.test.ts +1 -0
  135. package/src/variables/__tests__/resolveReferencesOnce.test.ts +1 -0
  136. package/src/variables/__tests__/variableValue.test.ts +1 -0
  137. package/tsconfig.json +2 -1
  138. package/dist/build/base/__tests__/createArtifactsConfig.test.d.ts +0 -1
  139. package/dist/build/base/__tests__/createArtifactsConfig.test.js +0 -42
  140. package/dist/build/custom/__tests__/testJob.test.d.ts +0 -1
  141. package/dist/build/custom/__tests__/testJob.test.js +0 -36
  142. package/dist/config/__tests__/configruedEnvs.test.d.ts +0 -1
  143. package/dist/config/__tests__/configruedEnvs.test.js +0 -112
  144. package/dist/config/__tests__/getAllEnvs.test.d.ts +0 -1
  145. package/dist/config/__tests__/getAllEnvs.test.js +0 -79
  146. package/dist/config/__tests__/getAllEnvsInAllComponents.test.d.ts +0 -1
  147. package/dist/config/__tests__/getAllEnvsInAllComponents.test.js +0 -73
  148. package/dist/pipeline/__tests__/getPipelineStages.test.d.ts +0 -1
  149. package/dist/pipeline/__tests__/getPipelineStages.test.js +0 -73
  150. package/dist/variables/__tests__/resolveAllReferences.test.d.ts +0 -1
  151. package/dist/variables/__tests__/resolveAllReferences.test.js +0 -218
  152. package/dist/variables/__tests__/resolveAllReferencesOnce.test.d.ts +0 -1
  153. package/dist/variables/__tests__/resolveAllReferencesOnce.test.js +0 -171
  154. package/dist/variables/__tests__/resolveReferencesOnce.test.d.ts +0 -1
  155. package/dist/variables/__tests__/resolveReferencesOnce.test.js +0 -199
  156. package/dist/variables/__tests__/variableValue.test.d.ts +0 -1
  157. package/dist/variables/__tests__/variableValue.test.js +0 -36
  158. /package/dist/build/rails/{test.d.ts → testJob.d.ts} +0 -0
  159. /package/dist/build/rails/{test.js → testJob.js} +0 -0
  160. /package/src/build/rails/{test.ts → testJob.ts} +0 -0
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./cloud-run-with-sql";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./cloud-run-with-worker";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./custom-build-job-with-tests";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./custom-build-job";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./custom-deploy";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./custom-envs";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./custom-sbom-java";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./custom-verify-job";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./git-submodule";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./kubernetes-application-customization";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./kubernetes-with-cloud-sql";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./kubernetes-with-jobs";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./kubernetes-with-mongodb";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./local-dot-env";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./meteor-kubernetes";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./modify-generated-files";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./modify-generated-yaml";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./multiline-var";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./native-app";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./node-build-with-custom-image";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./node-build-with-docker-additions";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./override-secrets";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./rails-k8s-with-worker";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./referencing-other-vars";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./wait-for-other-deploy";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./workspace-api-www-turbo-cache";
3
4
 
@@ -1,3 +1,4 @@
1
+ import { it, expect } from "vitest";
1
2
  import { createYamlLocalPipeline } from "./__utils__/helpers";
2
3
  import config from "./workspace-api-www";
3
4
 
package/package.json CHANGED
@@ -53,7 +53,7 @@
53
53
  }
54
54
  ],
55
55
  "license": "MIT",
56
- "version": "3.29.1",
56
+ "version": "3.30.1",
57
57
  "scripts": {
58
58
  "build:tsc": "yarn tsc",
59
59
  "build": "yarn build:compile && yarn build:inline-variables",
@@ -73,9 +73,7 @@
73
73
  "@babel/core": "^7.25.2",
74
74
  "@babel/plugin-syntax-typescript": "^7.25.4",
75
75
  "@babel/preset-typescript": "^7.24.7",
76
- "@jest/globals": "^29.7.0",
77
76
  "@types/child-process-promise": "^2.2.6",
78
- "@types/jest": "^29.5.12",
79
77
  "@types/lodash": "^4.17.7",
80
78
  "@types/node": "^22.5.1",
81
79
  "babel-plugin-transform-inline-environment-variables": "^0.4.3",
@@ -56,6 +56,7 @@ async function main() {
56
56
  exampleFiles.map(async (exampleFile) => {
57
57
  const kebabName = basename(exampleFile, ".ts");
58
58
  const testFileContent = [
59
+ `import { it, expect } from "vitest";`,
59
60
  `import { createYamlLocalPipeline } from "./__utils__/helpers";`,
60
61
  `import config from "./${kebabName}";`,
61
62
  `\n/**`,
@@ -1,6 +1,6 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`createArtifactsConfig merges junit files if both given 1`] = `
3
+ exports[`createArtifactsConfig > merges junit files if both given 1`] = `
4
4
  {
5
5
  "artifacts": {
6
6
  "paths": [
@@ -17,7 +17,7 @@ exports[`createArtifactsConfig merges junit files if both given 1`] = `
17
17
  }
18
18
  `;
19
19
 
20
- exports[`createArtifactsConfig returns artifacts if no artifactsReports 1`] = `
20
+ exports[`createArtifactsConfig > returns artifacts if no artifactsReports 1`] = `
21
21
  {
22
22
  "artifacts": {
23
23
  "paths": [
@@ -35,7 +35,7 @@ exports[`createArtifactsConfig returns artifacts if no artifactsReports 1`] = `
35
35
  }
36
36
  `;
37
37
 
38
- exports[`createArtifactsConfig returns junit parts of artifactsReports 1`] = `
38
+ exports[`createArtifactsConfig > returns junit parts of artifactsReports 1`] = `
39
39
  {
40
40
  "artifacts": {
41
41
  "paths": [],
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from "vitest";
1
2
  import { createArtifactsConfig } from "../createArtifactsConfig";
2
3
 
3
4
  describe("createArtifactsConfig", () => {
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from "vitest";
1
2
  import type { BuildContextStandalone, ComponentContext } from "../../..";
2
3
  import { createCustomTestJobs } from "../testJob";
3
4
 
@@ -1,7 +1,7 @@
1
1
  import type { ComponentContextWithBuild } from "../../types";
2
2
  import type { CatladderJob } from "../../types/jobs";
3
3
  import { createRailsBuildJobs } from "./build";
4
- import { createRailsTestJobs } from "./test";
4
+ import { createRailsTestJobs } from "./testJob";
5
5
 
6
6
  export const createRailsJobs = (
7
7
  context: ComponentContextWithBuild,
@@ -1,6 +1,6 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`getAllEnvs() should return all envs for app1 1`] = `
3
+ exports[`getAllEnvs() > should return all envs for app1 1`] = `
4
4
  [
5
5
  "dev",
6
6
  "review",
@@ -10,7 +10,7 @@ exports[`getAllEnvs() should return all envs for app1 1`] = `
10
10
  ]
11
11
  `;
12
12
 
13
- exports[`getAllEnvs() should return all envs for app2 1`] = `
13
+ exports[`getAllEnvs() > should return all envs for app2 1`] = `
14
14
  [
15
15
  "dev",
16
16
  "review",
@@ -24,7 +24,7 @@ exports[`getAllEnvs() should return all envs for app2 1`] = `
24
24
  ]
25
25
  `;
26
26
 
27
- exports[`getAllEnvs() should return all envs for app3 1`] = `
27
+ exports[`getAllEnvs() > should return all envs for app3 1`] = `
28
28
  [
29
29
  "local",
30
30
  ]
@@ -1,6 +1,6 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`getAllEnvsInAllComponents() should return all envs for SIMPLE_CONFIG1 1`] = `
3
+ exports[`getAllEnvsInAllComponents() > should return all envs for SIMPLE_CONFIG1 1`] = `
4
4
  [
5
5
  "dev",
6
6
  "review",
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from "vitest";
1
2
  import { getAllEnvsByTrigger } from "..";
2
3
  import type { DeployConfigKubernetesCluster } from "../..";
3
4
  import type { Config } from "../../types";
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from "vitest";
1
2
  import { type DeployConfigKubernetesCluster } from "../..";
2
3
  import type { Config } from "../../types";
3
4
  import { getAllEnvs } from "../configruedEnvs";
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from "vitest";
1
2
  import { type DeployConfigKubernetesCluster } from "../..";
2
3
  import type { Config } from "../../types";
3
4
  import { getAllEnvsInAllComponents } from "../configruedEnvs";
@@ -1,10 +1,8 @@
1
1
  import type { StringOrBashExpression } from "../../../../bash";
2
2
  import type { ComponentContext } from "../../../../types/context";
3
- import type {
4
- DeployConfigCloudRunExecuteOnDeploy,
5
- DeployConfigCloudRunJob,
6
- DeployConfigCloudRunService,
7
- } from "../../../types/googleCloudRun";
3
+ import { ensureArray } from "../../../../utils";
4
+ import type { DeployConfigBaseExecuteOnDeploy } from "../../../types/executeBase";
5
+ import type { DeployConfigCloudRunExecuteOnDeploy } from "../../../types/googleCloudRun";
8
6
  import { createArgsString } from "../../utils/createArgsString";
9
7
  import { getCloudRunServiceOrJobArgsArg } from "../../utils/getJobOrServiceArgs";
10
8
  import { getFullJobName } from "../../utils/jobName";
@@ -17,7 +15,7 @@ import {
17
15
 
18
16
  type Execute = {
19
17
  jobName: StringOrBashExpression;
20
- config: DeployConfigCloudRunExecuteOnDeploy;
18
+ config: DeployConfigCloudRunExecuteOnDeploy | DeployConfigBaseExecuteOnDeploy;
21
19
  };
22
20
  export const getOnDeployExecuteScript = (
23
21
  context: ComponentContext,
@@ -27,7 +25,7 @@ export const getOnDeployExecuteScript = (
27
25
 
28
26
  return executes
29
27
  .filter(({ config }) => config.when === when)
30
- .map((execute) => {
28
+ .flatMap((execute) => {
31
29
  return getJobRunScriptForExecute(context, execute);
32
30
  });
33
31
  };
@@ -37,7 +35,8 @@ const getExecutes = (context: ComponentContext): Execute[] => {
37
35
  return [
38
36
  ...getLegacyExecutes(context),
39
37
  ...Object.entries(deployConfig.execute ?? {}).flatMap(([key, value]) => {
40
- if (!value || (value.when !== "schedule" && value.type !== "job")) {
38
+ // remove all schedule executes
39
+ if (!value) {
41
40
  return [];
42
41
  }
43
42
  return [
@@ -81,22 +80,30 @@ const getLegacyExecutes = (context: ComponentContext): Execute[] => {
81
80
  const getJobRunScriptForExecute = (
82
81
  context: ComponentContext,
83
82
  { jobName, config }: Execute,
84
- ) => {
85
- const commonArgs = getCommonCloudRunArgs(context);
83
+ ): string[] => {
84
+ const type = config.type;
85
+ if (type === "script") {
86
+ return ensureArray(config.script);
87
+ } else if (type === "job") {
88
+ const commonArgs = getCommonCloudRunArgs(context);
86
89
 
87
- // always wait for completion for preStop and postStop jobs
88
- // since stop will delete the jobs afterwards, so they will fail
89
- const waitForCompletion = ["preStop", "postStop"].includes(config.when)
90
- ? true // always
91
- : "waitForCompletion" in config
92
- ? (config.waitForCompletion ?? false) // depends on config
93
- : false;
90
+ // always wait for completion for preStop and postStop jobs
91
+ // since stop will delete the jobs afterwards, so they will fail
92
+ const waitForCompletion = ["preStop", "postStop"].includes(config.when)
93
+ ? true // always
94
+ : "waitForCompletion" in config
95
+ ? (config.waitForCompletion ?? false) // depends on config
96
+ : false;
94
97
 
95
- const argString = createArgsString({
96
- ...commonArgs,
97
- wait: waitForCompletion === true ? true : undefined,
98
- args: getCloudRunServiceOrJobArgsArg(config.args),
99
- });
100
- const fullJobName = getFullJobName(context, jobName);
101
- return `${gcloudRunCmd()} jobs execute ${fullJobName.toString()} ${argString}`;
98
+ const argString = createArgsString({
99
+ ...commonArgs,
100
+ wait: waitForCompletion === true ? true : undefined,
101
+ args: getCloudRunServiceOrJobArgsArg(config.args),
102
+ });
103
+ const fullJobName = getFullJobName(context, jobName);
104
+ return [
105
+ `${gcloudRunCmd()} jobs execute ${fullJobName.toString()} ${argString}`,
106
+ ];
107
+ }
108
+ throw new Error(`unsupported execute type: ${type}`);
102
109
  };
@@ -1,4 +1,5 @@
1
1
  import type { EnvVars } from "../../types/config";
2
+ import type { DeployConfigBaseExecute } from "./executeBase";
2
3
 
3
4
  export type DeployConfigBase = {
4
5
  /**
@@ -0,0 +1,27 @@
1
+ type DeployConfigBaseExecuteScript = {
2
+ type: "script";
3
+ script: string | string[];
4
+ };
5
+ /**
6
+ * currently only supported for cloud run deployments
7
+ */
8
+ export type DeployConfigBaseExecuteOnDeploy = DeployConfigBaseExecuteScript &
9
+ (
10
+ | {
11
+ /**
12
+ * run the job before or after the deploy
13
+ */
14
+ when: "preDeploy" | "postDeploy";
15
+ /**
16
+ * whether to wait for completion of the job
17
+ */
18
+ waitForCompletion?: boolean;
19
+ }
20
+ | {
21
+ /**
22
+ * run the job before or after the environment is stopped
23
+ */
24
+ when: "preStop" | "postStop";
25
+ }
26
+ );
27
+ export type DeployConfigBaseExecute = DeployConfigBaseExecuteOnDeploy;
@@ -1,5 +1,9 @@
1
1
  import type { DBVariablesMode } from "../cloudRun/utils/database";
2
2
  import type { DeployConfigBase } from "./base";
3
+ import type {
4
+ DeployConfigBaseExecute,
5
+ DeployConfigBaseExecuteOnDeploy,
6
+ } from "./executeBase";
3
7
 
4
8
  export type Gcloudregion =
5
9
  | "asia-east1"
@@ -424,7 +428,7 @@ export type DeployConfigCloudRunJob =
424
428
  | DeployConfigCloudRunJobNormal
425
429
  | DeployConfigCloudRunJobWithSchedule;
426
430
 
427
- export type DeployConfigCloudRun = {
431
+ export type DeployConfigCloudRun = Omit<DeployConfigBase, "execute"> & {
428
432
  /**
429
433
  * cloud run deployment.
430
434
  *
@@ -469,7 +473,7 @@ export type DeployConfigCloudRun = {
469
473
  execute?: Record<string, DeployConfigCloudRunExecute | null>;
470
474
 
471
475
  debug?: boolean;
472
- } & DeployConfigBase;
476
+ };
473
477
 
474
478
  export type DeployConfigCloudRunVolumes = Record<
475
479
  string,
@@ -543,6 +547,7 @@ export type DeployConfigCloudRunExecuteOnDeploy =
543
547
  );
544
548
 
545
549
  export type DeployConfigCloudRunExecuteJob =
550
+ | DeployConfigBaseExecute
546
551
  | DeployConfigCloudRunExecuteJobScheduled
547
552
  | DeployConfigCloudRunExecuteOnDeploy;
548
553
 
@@ -573,6 +578,7 @@ export type DeployConfigCloudRunExecuteHttp = {
573
578
  } & WithSchedule;
574
579
 
575
580
  export type DeployConfigCloudRunExecute =
581
+ | DeployConfigBaseExecute
576
582
  | DeployConfigCloudRunExecuteJob
577
583
  | DeployConfigCloudRunExecuteHttp;
578
584
 
@@ -1,6 +1,6 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`getPipelineStages() should return all envs for SIMPLE_CONFIG1 1`] = `
3
+ exports[`getPipelineStages() > should return all envs for SIMPLE_CONFIG1 1`] = `
4
4
  [
5
5
  "setup",
6
6
  "setup dev",
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from "vitest";
1
2
  import { type DeployConfigKubernetesCluster } from "../..";
2
3
  import type { Config } from "../../types";
3
4
  import { getPipelineStages } from "../getPipelineStages";
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from "vitest";
1
2
  import {
2
3
  VariableValueContainingReferences,
3
4
  createVariableValueContainingReferencesFromString,
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from "vitest";
1
2
  import {
2
3
  VariableReference,
3
4
  VariableValueContainingReferences,
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from "vitest";
1
2
  import {
2
3
  UnresolvableReference,
3
4
  VariableReference,
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from "vitest";
1
2
  import {
2
3
  VariableReference,
3
4
  createVariableValueContainingReferencesFromString,
package/tsconfig.json CHANGED
@@ -10,5 +10,6 @@
10
10
  "esModuleInterop": true,
11
11
  "incremental": true
12
12
  },
13
- "include": ["./src", "tests"]
13
+ "include": ["./src"],
14
+ "exclude": ["**/__tests__", "**/*.test.ts", "**/*.test.tsx"]
14
15
  }
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var createArtifactsConfig_1 = require("../createArtifactsConfig");
7
- describe("createArtifactsConfig", function () {
8
- it("returns undefined if no artifacts or artifactsReports", function () {
9
- expect((0, createArtifactsConfig_1.createArtifactsConfig)(".")).toBeUndefined();
10
- });
11
- it("returns artifacts if no artifactsReports", function () {
12
- expect((0, createArtifactsConfig_1.createArtifactsConfig)(".", undefined, {
13
- paths: ["testpath"],
14
- reports: {
15
- coverage_report: {
16
- coverage_format: "cobertura",
17
- path: "some"
18
- },
19
- terraform: "something"
20
- }
21
- })).toMatchSnapshot();
22
- });
23
- it("returns junit parts of artifactsReports", function () {
24
- expect((0, createArtifactsConfig_1.createArtifactsConfig)(".", {
25
- junit: ["report.xml"]
26
- })).toMatchSnapshot();
27
- });
28
- it("merges junit files if both given", function () {
29
- var _a, _b;
30
- var result = (0, createArtifactsConfig_1.createArtifactsConfig)(".", {
31
- junit: ["partial-report.xml"]
32
- }, {
33
- paths: ["testpath"],
34
- reports: {
35
- junit: "full-report.xml",
36
- terraform: "something"
37
- }
38
- });
39
- expect(result).toMatchSnapshot();
40
- expect((_b = (_a = result === null || result === void 0 ? void 0 : result.artifacts) === null || _a === void 0 ? void 0 : _a.reports) === null || _b === void 0 ? void 0 : _b.junit).toHaveLength(2);
41
- });
42
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var testJob_1 = require("../testJob");
7
- describe("createCustomTestJobs", function () {
8
- var baseContext = {
9
- name: "testComponent",
10
- environment: {
11
- jobOnlyVars: {
12
- build: {}
13
- }
14
- },
15
- build: {
16
- config: {
17
- type: "custom",
18
- docker: {
19
- type: "custom"
20
- },
21
- jobImage: ""
22
- }
23
- }
24
- };
25
- it("throws error when not build type custom", function () {
26
- baseContext.build.config.type = "node";
27
- expect(function () {
28
- return (0, testJob_1.createCustomTestJobs)(baseContext);
29
- }).toThrowError("deploy config is not custom");
30
- baseContext.build.config.type = "custom";
31
- });
32
- it("returns empty array if no audit, lint, and test definition", function () {
33
- var jobs = (0, testJob_1.createCustomTestJobs)(baseContext);
34
- expect(jobs).toEqual([]);
35
- });
36
- });
@@ -1 +0,0 @@
1
- export {};