@catladder/pipeline 3.25.0 → 3.26.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 (73) hide show
  1. package/dist/build/custom/testJob.js +1 -2
  2. package/dist/build/node/testJob.js +1 -2
  3. package/dist/build/rails/test.js +1 -2
  4. package/dist/constants.js +1 -1
  5. package/dist/pipeline/agent/createAgentReviewJob.js +1 -0
  6. package/dist/pipeline/agent/shared.d.ts +1 -1
  7. package/dist/pipeline/agent/shared.js +0 -1
  8. package/dist/pipeline/createMainPipeline.js +1 -0
  9. package/dist/pipeline/gitlab/cache.d.ts +9 -0
  10. package/dist/pipeline/gitlab/cache.js +47 -0
  11. package/dist/pipeline/gitlab/createGitlabJobs.js +7 -7
  12. package/dist/tsconfig.tsbuildinfo +1 -1
  13. package/dist/types/jobs.d.ts +2 -3
  14. package/examples/__snapshots__/automatic-releases.test.ts.snap +127 -21
  15. package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +127 -21
  16. package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +127 -21
  17. package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +127 -21
  18. package/examples/__snapshots__/cloud-run-http2.test.ts.snap +127 -21
  19. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +127 -21
  20. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +127 -21
  21. package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +130 -22
  22. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +127 -21
  23. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +127 -21
  24. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +127 -21
  25. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +127 -21
  26. package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +127 -21
  27. package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +127 -21
  28. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +127 -21
  29. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +127 -21
  30. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +127 -21
  31. package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +9 -3
  32. package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +130 -22
  33. package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +127 -21
  34. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +127 -21
  35. package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +127 -21
  36. package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +381 -63
  37. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +254 -42
  38. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +127 -21
  39. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +127 -21
  40. package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +93 -22
  41. package/examples/__snapshots__/custom-deploy.test.ts.snap +127 -21
  42. package/examples/__snapshots__/custom-envs.test.ts.snap +320 -32
  43. package/examples/__snapshots__/custom-verify-job.test.ts.snap +130 -22
  44. package/examples/__snapshots__/git-submodule.test.ts.snap +127 -21
  45. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +127 -21
  46. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +127 -21
  47. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +254 -42
  48. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +127 -21
  49. package/examples/__snapshots__/local-dot-env.test.ts.snap +127 -21
  50. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +127 -21
  51. package/examples/__snapshots__/modify-generated-files.test.ts.snap +118 -14
  52. package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +118 -14
  53. package/examples/__snapshots__/multiline-var.test.ts.snap +381 -63
  54. package/examples/__snapshots__/native-app.test.ts.snap +257 -41
  55. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +127 -21
  56. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +127 -21
  57. package/examples/__snapshots__/override-secrets.test.ts.snap +127 -21
  58. package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +84 -22
  59. package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +84 -22
  60. package/examples/__snapshots__/referencing-other-vars.test.ts.snap +381 -63
  61. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +248 -40
  62. package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +139 -29
  63. package/examples/__snapshots__/workspace-api-www.test.ts.snap +139 -29
  64. package/package.json +1 -1
  65. package/src/build/custom/testJob.ts +0 -1
  66. package/src/build/node/testJob.ts +0 -1
  67. package/src/build/rails/test.ts +0 -1
  68. package/src/pipeline/agent/createAgentReviewJob.ts +1 -0
  69. package/src/pipeline/agent/shared.ts +2 -2
  70. package/src/pipeline/createMainPipeline.ts +1 -0
  71. package/src/pipeline/gitlab/cache.ts +49 -0
  72. package/src/pipeline/gitlab/createGitlabJobs.ts +7 -9
  73. package/src/types/jobs.ts +2 -3
@@ -15,6 +15,7 @@ import { collapseableSection } from "../../utils/gitlab";
15
15
  import { removeUndefined } from "../../utils/removeUndefined";
16
16
  import type { AllCatladderJobs } from "../createAllJobs";
17
17
  import { getBashVariable } from "../../bash/BashExpression";
18
+ import { addCacheFallback } from "./cache";
18
19
 
19
20
  export type GitlabJobWithContext = {
20
21
  gitlabJob: GitlabJobDef;
@@ -60,12 +61,12 @@ const getFullReferencedJobNameFromComponent = (
60
61
  `unknown job referenced: '${referencedJobName}' from '${env}:${componentName}'`,
61
62
  );
62
63
  }
63
- const envToSet = referencedJob.envMode !== "none" ? env : null;
64
+
64
65
  return getFullJobName({
65
66
  type: "component",
66
67
  name: referencedJobName,
67
68
  baseName: componentName,
68
- env: envToSet,
69
+ env,
69
70
  allJobs,
70
71
  });
71
72
  };
@@ -84,13 +85,12 @@ const getFullReferencedJobNameFromWorkspace = (
84
85
  `unknown job referenced: '${referencedJobName}' from workspace ${env}:${workspaceName}'`,
85
86
  );
86
87
  }
87
- const envToSet = referencedJob.envMode !== "none" ? env : null;
88
88
 
89
89
  return getFullJobName({
90
90
  type: "workspace",
91
91
  name: referencedJobName,
92
92
  baseName: workspaceName,
93
- env: envToSet,
93
+ env,
94
94
  allJobs,
95
95
  });
96
96
  };
@@ -116,6 +116,7 @@ export const makeGitlabJob = (
116
116
  variables,
117
117
  runnerVariables,
118
118
  when,
119
+ cache,
119
120
  ...rest
120
121
  } = job;
121
122
  const stage =
@@ -133,8 +134,7 @@ export const makeGitlabJob = (
133
134
  type: context.type,
134
135
  name,
135
136
  baseName: context.name,
136
- env:
137
- envMode !== "none" && context.type !== "agent" ? context.env : undefined,
137
+ env: context.type !== "agent" ? context.env : undefined,
138
138
  allJobs,
139
139
  });
140
140
 
@@ -186,11 +186,11 @@ export const makeGitlabJob = (
186
186
  ? [{ when }]
187
187
  : []),
188
188
  ];
189
-
190
189
  const gitlabJob: GitlabJobDef = {
191
190
  retry: BASE_RETRY,
192
191
  interruptible: true,
193
192
  ...rest,
193
+ cache: cache ? addCacheFallback(cache, context) : undefined,
194
194
  rules: rules.length > 0 ? rules : undefined,
195
195
  variables: {
196
196
  ...legacyRunnerVariables,
@@ -283,8 +283,6 @@ export const createGitlabJobs = async (
283
283
  allJobs: AllCatladderJobs,
284
284
  baseRules?: GitlabRule[],
285
285
  ): Promise<AllGitlabJobs> => {
286
- // TODO: add workspace jobs
287
-
288
286
  return [
289
287
  ...allJobs.workspaces,
290
288
  ...allJobs.components,
package/src/types/jobs.ts CHANGED
@@ -38,11 +38,10 @@ export type CatladderJob<S = BaseStage> = {
38
38
  name: string;
39
39
  /**
40
40
  * envMode sets the behavior of the job regarding multiple envs:
41
- * - none: the job does not run per env, but once for all envs
42
- * - jobPerEnv: the job runs once per env
41
+ * - jobPerEnv: the job runs once per env (default)
43
42
  * - stagePerEnv: the job runs once per env and is organized in its own stage. This mproves usability in gitlab, but works the same as `jobPerEnv`
44
43
  */
45
- envMode: "jobPerEnv" | "stagePerEnv" | "none";
44
+ envMode?: "jobPerEnv" | "stagePerEnv";
46
45
 
47
46
  /**
48
47
  * the stage of the job