@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.
- package/dist/build/custom/testJob.js +1 -2
- package/dist/build/node/testJob.js +1 -2
- package/dist/build/rails/test.js +1 -2
- package/dist/constants.js +1 -1
- package/dist/pipeline/agent/createAgentReviewJob.js +1 -0
- package/dist/pipeline/agent/shared.d.ts +1 -1
- package/dist/pipeline/agent/shared.js +0 -1
- package/dist/pipeline/createMainPipeline.js +1 -0
- package/dist/pipeline/gitlab/cache.d.ts +9 -0
- package/dist/pipeline/gitlab/cache.js +47 -0
- package/dist/pipeline/gitlab/createGitlabJobs.js +7 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/jobs.d.ts +2 -3
- package/examples/__snapshots__/automatic-releases.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-http2.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +130 -22
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +9 -3
- package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +130 -22
- package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +381 -63
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +254 -42
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +127 -21
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +127 -21
- package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +93 -22
- package/examples/__snapshots__/custom-deploy.test.ts.snap +127 -21
- package/examples/__snapshots__/custom-envs.test.ts.snap +320 -32
- package/examples/__snapshots__/custom-verify-job.test.ts.snap +130 -22
- package/examples/__snapshots__/git-submodule.test.ts.snap +127 -21
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +127 -21
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +127 -21
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +254 -42
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +127 -21
- package/examples/__snapshots__/local-dot-env.test.ts.snap +127 -21
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +127 -21
- package/examples/__snapshots__/modify-generated-files.test.ts.snap +118 -14
- package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +118 -14
- package/examples/__snapshots__/multiline-var.test.ts.snap +381 -63
- package/examples/__snapshots__/native-app.test.ts.snap +257 -41
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +127 -21
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +127 -21
- package/examples/__snapshots__/override-secrets.test.ts.snap +127 -21
- package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +84 -22
- package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +84 -22
- package/examples/__snapshots__/referencing-other-vars.test.ts.snap +381 -63
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +248 -40
- package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +139 -29
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +139 -29
- package/package.json +1 -1
- package/src/build/custom/testJob.ts +0 -1
- package/src/build/node/testJob.ts +0 -1
- package/src/build/rails/test.ts +0 -1
- package/src/pipeline/agent/createAgentReviewJob.ts +1 -0
- package/src/pipeline/agent/shared.ts +2 -2
- package/src/pipeline/createMainPipeline.ts +1 -0
- package/src/pipeline/gitlab/cache.ts +49 -0
- package/src/pipeline/gitlab/createGitlabJobs.ts +7 -9
- 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
|
-
|
|
64
|
+
|
|
64
65
|
return getFullJobName({
|
|
65
66
|
type: "component",
|
|
66
67
|
name: referencedJobName,
|
|
67
68
|
baseName: componentName,
|
|
68
|
-
env
|
|
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
|
|
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
|
-
* -
|
|
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
|
|
44
|
+
envMode?: "jobPerEnv" | "stagePerEnv";
|
|
46
45
|
|
|
47
46
|
/**
|
|
48
47
|
* the stage of the job
|