@catladder/pipeline 3.6.0 → 3.8.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/artifacts/createBuildJobArtifact.js +1 -1
- package/dist/build/base/index.d.ts +2 -3
- package/dist/build/cache/getAllCacheConfigsFromConfig.js +2 -2
- package/dist/build/custom/buildJob.d.ts +2 -2
- package/dist/build/custom/index.d.ts +2 -2
- package/dist/build/custom/testJob.d.ts +2 -2
- package/dist/build/docker.d.ts +4 -4
- package/dist/build/index.d.ts +2 -2
- package/dist/build/node/buildJob.d.ts +5 -3
- package/dist/build/node/index.d.ts +4 -4
- package/dist/build/node/meteor.d.ts +2 -2
- package/dist/build/node/yarn.d.ts +1 -1
- package/dist/build/node/yarn.js +1 -1
- package/dist/build/rails/build.d.ts +2 -2
- package/dist/build/rails/index.d.ts +2 -2
- package/dist/build/sbom.d.ts +2 -2
- package/dist/constants.js +1 -1
- package/dist/context/createComponentContext.js +11 -4
- package/dist/context/getLabels.js +1 -1
- package/dist/deploy/cloudRun/createJobs/cloudRunJobs.js +2 -2
- package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +16 -9
- package/dist/deploy/cloudRun/createJobs/execute/onDeploy.d.ts +2 -3
- package/dist/deploy/cloudRun/createJobs/execute/onDeploy.js +4 -9
- package/dist/deploy/cloudRun/createJobs/healthCheck.d.ts +5 -0
- package/dist/deploy/cloudRun/createJobs/healthCheck.js +82 -0
- package/dist/deploy/cloudRun/utils/getJobOrServiceArgs.d.ts +2 -0
- package/dist/deploy/cloudRun/utils/getJobOrServiceArgs.js +12 -0
- package/dist/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/deploy/kubernetes/kubeValues.js +1 -1
- package/dist/deploy/sbom.js +1 -1
- package/dist/deploy/types/googleCloudRun.d.ts +80 -0
- package/dist/deploy/types/googleCloudRun.js +25 -0
- package/dist/pipeline/createJobsForComponent.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/context.d.ts +6 -1
- package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +1382 -0
- package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +1382 -0
- package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +1382 -0
- package/examples/__snapshots__/cloud-run-llama.test.ts.snap +624 -0
- package/examples/cloud-run-health-check-defaults.test.ts +11 -0
- package/examples/cloud-run-health-check-defaults.ts +28 -0
- package/examples/cloud-run-health-check-only-startup.test.ts +11 -0
- package/examples/cloud-run-health-check-only-startup.ts +38 -0
- package/examples/cloud-run-health-check.test.ts +11 -0
- package/examples/cloud-run-health-check.ts +45 -0
- package/examples/cloud-run-llama.test.ts +11 -0
- package/examples/cloud-run-llama.ts +40 -0
- package/package.json +1 -1
- package/src/build/artifacts/createBuildJobArtifact.ts +3 -1
- package/src/build/base/index.ts +5 -2
- package/src/build/cache/getAllCacheConfigsFromConfig.ts +7 -6
- package/src/build/custom/buildJob.ts +2 -2
- package/src/build/custom/index.ts +4 -2
- package/src/build/custom/testJob.ts +2 -2
- package/src/build/docker.ts +8 -4
- package/src/build/index.ts +5 -2
- package/src/build/node/buildJob.ts +5 -2
- package/src/build/node/index.ts +9 -4
- package/src/build/node/meteor.ts +5 -2
- package/src/build/node/yarn.ts +4 -2
- package/src/build/rails/build.ts +3 -7
- package/src/build/rails/index.ts +4 -2
- package/src/build/sbom.ts +4 -2
- package/src/context/createComponentContext.ts +22 -9
- package/src/context/getLabels.ts +4 -1
- package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +2 -2
- package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +13 -1
- package/src/deploy/cloudRun/createJobs/execute/onDeploy.ts +3 -13
- package/src/deploy/cloudRun/createJobs/healthCheck.ts +64 -0
- package/src/deploy/cloudRun/utils/getJobOrServiceArgs.ts +18 -0
- package/src/deploy/kubernetes/kubeValues.ts +13 -4
- package/src/deploy/sbom.ts +4 -3
- package/src/deploy/types/googleCloudRun.ts +112 -0
- package/src/pipeline/createJobsForComponent.ts +10 -2
- package/src/types/config.ts +1 -1
- package/src/types/context.ts +10 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Config } from "../src";
|
|
2
|
+
|
|
3
|
+
const config = {
|
|
4
|
+
appName: "test-app",
|
|
5
|
+
customerName: "pan",
|
|
6
|
+
components: {
|
|
7
|
+
www: {
|
|
8
|
+
dir: "www",
|
|
9
|
+
build: {
|
|
10
|
+
type: "node",
|
|
11
|
+
},
|
|
12
|
+
deploy: {
|
|
13
|
+
type: "google-cloudrun",
|
|
14
|
+
projectId: "google-project-id",
|
|
15
|
+
region: "europe-west6",
|
|
16
|
+
service: {
|
|
17
|
+
healthCheck: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
} satisfies Config;
|
|
23
|
+
|
|
24
|
+
export default config;
|
|
25
|
+
|
|
26
|
+
export const information = {
|
|
27
|
+
title: "Cloud Run: Health Check",
|
|
28
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createYamlLocalPipeline } from "./__utils__/helpers";
|
|
2
|
+
import config from "./cloud-run-health-check-only-startup";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This test is auto-generated.
|
|
6
|
+
* Modifications will be overwritten on every `yarn test` run!
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
it("matches snapshot for cloud-run-health-check-only-startup local pipeline YAML", async () => {
|
|
10
|
+
expect(await createYamlLocalPipeline(config)).toMatchSnapshot();
|
|
11
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Config } from "../src";
|
|
2
|
+
|
|
3
|
+
const config = {
|
|
4
|
+
appName: "test-app",
|
|
5
|
+
customerName: "pan",
|
|
6
|
+
components: {
|
|
7
|
+
www: {
|
|
8
|
+
dir: "www",
|
|
9
|
+
build: {
|
|
10
|
+
type: "node",
|
|
11
|
+
},
|
|
12
|
+
deploy: {
|
|
13
|
+
type: "google-cloudrun",
|
|
14
|
+
projectId: "google-project-id",
|
|
15
|
+
region: "europe-west6",
|
|
16
|
+
service: {
|
|
17
|
+
healthCheck: {
|
|
18
|
+
livenessProbe: false,
|
|
19
|
+
startupProbe: {
|
|
20
|
+
type: "http1",
|
|
21
|
+
failureThreshold: 43,
|
|
22
|
+
initialDelaySeconds: 4,
|
|
23
|
+
path: "/something2",
|
|
24
|
+
periodSeconds: 5,
|
|
25
|
+
timeoutSeconds: 6,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
} satisfies Config;
|
|
33
|
+
|
|
34
|
+
export default config;
|
|
35
|
+
|
|
36
|
+
export const information = {
|
|
37
|
+
title: "Cloud Run: Health Check",
|
|
38
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createYamlLocalPipeline } from "./__utils__/helpers";
|
|
2
|
+
import config from "./cloud-run-health-check";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This test is auto-generated.
|
|
6
|
+
* Modifications will be overwritten on every `yarn test` run!
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
it("matches snapshot for cloud-run-health-check local pipeline YAML", async () => {
|
|
10
|
+
expect(await createYamlLocalPipeline(config)).toMatchSnapshot();
|
|
11
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Config } from "../src";
|
|
2
|
+
|
|
3
|
+
const config = {
|
|
4
|
+
appName: "test-app",
|
|
5
|
+
customerName: "pan",
|
|
6
|
+
components: {
|
|
7
|
+
www: {
|
|
8
|
+
dir: "www",
|
|
9
|
+
build: {
|
|
10
|
+
type: "node",
|
|
11
|
+
},
|
|
12
|
+
deploy: {
|
|
13
|
+
type: "google-cloudrun",
|
|
14
|
+
projectId: "google-project-id",
|
|
15
|
+
region: "europe-west6",
|
|
16
|
+
service: {
|
|
17
|
+
healthCheck: {
|
|
18
|
+
livenessProbe: {
|
|
19
|
+
type: "http1",
|
|
20
|
+
failureThreshold: 42,
|
|
21
|
+
initialDelaySeconds: 1,
|
|
22
|
+
path: "/something",
|
|
23
|
+
periodSeconds: 2,
|
|
24
|
+
timeoutSeconds: 3,
|
|
25
|
+
},
|
|
26
|
+
startupProbe: {
|
|
27
|
+
type: "http1",
|
|
28
|
+
failureThreshold: 43,
|
|
29
|
+
initialDelaySeconds: 4,
|
|
30
|
+
path: "/something2",
|
|
31
|
+
periodSeconds: 5,
|
|
32
|
+
timeoutSeconds: 6,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
} satisfies Config;
|
|
40
|
+
|
|
41
|
+
export default config;
|
|
42
|
+
|
|
43
|
+
export const information = {
|
|
44
|
+
title: "Cloud Run: Health Check",
|
|
45
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createYamlLocalPipeline } from "./__utils__/helpers";
|
|
2
|
+
import config from "./cloud-run-llama";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This test is auto-generated.
|
|
6
|
+
* Modifications will be overwritten on every `yarn test` run!
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
it("matches snapshot for cloud-run-llama local pipeline YAML", async () => {
|
|
10
|
+
expect(await createYamlLocalPipeline(config)).toMatchSnapshot();
|
|
11
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Config } from "../src";
|
|
2
|
+
|
|
3
|
+
const config = {
|
|
4
|
+
appName: "my-ai-app",
|
|
5
|
+
customerName: "pan",
|
|
6
|
+
components: {
|
|
7
|
+
llm: {
|
|
8
|
+
dir: "llm",
|
|
9
|
+
build: false,
|
|
10
|
+
vars: {
|
|
11
|
+
secret: ["HF_TOKEN"],
|
|
12
|
+
},
|
|
13
|
+
deploy: {
|
|
14
|
+
type: "google-cloudrun",
|
|
15
|
+
projectId: "google-project-id",
|
|
16
|
+
region: "europe-west4", // verify in which regions GPUs are available, europe-west6 is not supported as of time of writing
|
|
17
|
+
service: {
|
|
18
|
+
image:
|
|
19
|
+
"us-docker.pkg.dev/deeplearning-platform-release/gcr.io/huggingface-text-generation-inference-cu124.2-3.ubuntu2204.py311",
|
|
20
|
+
args: [
|
|
21
|
+
"--model-id=meta-llama/Llama-3.2-1B-Instruct",
|
|
22
|
+
"--max-concurrent-requests=1",
|
|
23
|
+
],
|
|
24
|
+
cpu: 8,
|
|
25
|
+
|
|
26
|
+
noCpuThrottling: true, // must be set to true for GPUs
|
|
27
|
+
gpu: 1,
|
|
28
|
+
gpuType: "nvidia-l4",
|
|
29
|
+
memory: "32Gi",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
} satisfies Config;
|
|
35
|
+
|
|
36
|
+
export default config;
|
|
37
|
+
|
|
38
|
+
export const information = {
|
|
39
|
+
title: "Cloud Run: llama example",
|
|
40
|
+
};
|
package/package.json
CHANGED
|
@@ -41,7 +41,9 @@ const getArtifactsPathForComponent = (
|
|
|
41
41
|
additionalPaths?: string[],
|
|
42
42
|
): string[] => {
|
|
43
43
|
return [
|
|
44
|
-
...(c.build.
|
|
44
|
+
...(c.build.type !== "disabled"
|
|
45
|
+
? (c.build.config.artifactsPaths ?? [])
|
|
46
|
+
: []),
|
|
45
47
|
...(additionalPaths ?? []),
|
|
46
48
|
]?.flatMap((artifact) =>
|
|
47
49
|
c.build
|
package/src/build/base/index.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { sbomDeactivated } from "../../deploy/sbom";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
ComponentContextWithBuild,
|
|
4
|
+
WorkspaceContext,
|
|
5
|
+
} from "../../types/context";
|
|
3
6
|
import {
|
|
4
7
|
componentContextHasWorkspaceBuild,
|
|
5
8
|
componentContextIsStandaloneBuild,
|
|
@@ -16,7 +19,7 @@ import { APP_BUILD_JOB_NAME } from "./constants";
|
|
|
16
19
|
import { createAppBuildJob } from "./createAppBuildJob";
|
|
17
20
|
|
|
18
21
|
export const createComponentBuildJobs = (
|
|
19
|
-
context:
|
|
22
|
+
context: ComponentContextWithBuild,
|
|
20
23
|
definitions: {
|
|
21
24
|
appBuild?: AppBuildJobDefinition;
|
|
22
25
|
dockerBuild: DockerBuildJobDefinition;
|
|
@@ -16,12 +16,13 @@ export const getAllCacheConfigsFromConfig = (
|
|
|
16
16
|
? // also add cache configs of the components of that workspace
|
|
17
17
|
// FIXNME: this only works currently for the build config
|
|
18
18
|
// we would probably need to introduce a path to the right config property (build-->test or so)
|
|
19
|
-
context.components.flatMap<CacheConfig>(
|
|
20
|
-
|
|
21
|
-
ensureArray(componentContext.build.config.cache).map((c) => ({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
context.components.flatMap<CacheConfig>((componentContext) =>
|
|
20
|
+
componentContext.build.type !== "disabled"
|
|
21
|
+
? (ensureArray(componentContext.build.config.cache).map((c) => ({
|
|
22
|
+
...c,
|
|
23
|
+
baseDir: componentContext.build.dir,
|
|
24
|
+
})) ?? [])
|
|
25
|
+
: [],
|
|
25
26
|
)
|
|
26
27
|
: []),
|
|
27
28
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContextWithBuild } from "../../types/context";
|
|
2
2
|
import { getDockerBuildScriptWithBuiltInDockerFile } from "../docker";
|
|
3
3
|
import { isOfBuildType } from "../types";
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ import { createComponentBuildJobs } from "../base";
|
|
|
7
7
|
import { createBuildJobDefinition } from "../base/createBuildJobDefinition";
|
|
8
8
|
|
|
9
9
|
export const createCustomBuildJobs = (
|
|
10
|
-
context:
|
|
10
|
+
context: ComponentContextWithBuild,
|
|
11
11
|
): CatladderJob[] => {
|
|
12
12
|
const buildConfig = context.build.config;
|
|
13
13
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContextWithBuild } from "../../types";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
import { createCustomBuildJobs } from "./buildJob";
|
|
4
4
|
import { createCustomTestJobs } from "./testJob";
|
|
5
5
|
|
|
6
|
-
export const createCustomJobs = (
|
|
6
|
+
export const createCustomJobs = (
|
|
7
|
+
context: ComponentContextWithBuild,
|
|
8
|
+
): CatladderJob[] => {
|
|
7
9
|
return [...createCustomTestJobs(context), ...createCustomBuildJobs(context)];
|
|
8
10
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Artifacts } from "../../types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentContextWithBuild } from "../../types/context";
|
|
3
3
|
import type { CatladderJob } from "../../types/jobs";
|
|
4
4
|
import { ensureArray, notNil } from "../../utils";
|
|
5
5
|
import { createArtifactsConfig } from "../base/createArtifactsConfig";
|
|
@@ -13,7 +13,7 @@ const RUNNER_CUSTOM_TEST_VARIABLES = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export const createCustomTestJobs = (
|
|
16
|
-
context:
|
|
16
|
+
context: ComponentContextWithBuild,
|
|
17
17
|
): CatladderJob[] => {
|
|
18
18
|
// don't run tests after release
|
|
19
19
|
// TODO: this will be replaced by using rules
|
package/src/build/docker.ts
CHANGED
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
} from "../deploy/cloudRun/artifactsRegistry";
|
|
11
11
|
import { gcloudServiceAccountLoginCommands } from "../deploy/cloudRun/utils/gcloudServiceAccountLoginCommands";
|
|
12
12
|
import { getRunnerImage } from "../runner";
|
|
13
|
-
import type {
|
|
13
|
+
import type {
|
|
14
|
+
ComponentContext,
|
|
15
|
+
ComponentContextWithBuild,
|
|
16
|
+
DockerBuildJobDefinition,
|
|
17
|
+
} from "../types";
|
|
14
18
|
import type { CatladderJob } from "../types/jobs";
|
|
15
19
|
import { collapseableSection } from "../utils/gitlab";
|
|
16
20
|
import { createJobCacheFromCacheConfigs } from "./cache/createJobCache";
|
|
@@ -84,7 +88,7 @@ const getDockerAdditions = (build: BuildConfig) => {
|
|
|
84
88
|
: undefined,
|
|
85
89
|
};
|
|
86
90
|
};
|
|
87
|
-
export const getDockerBuildVariables = (context:
|
|
91
|
+
export const getDockerBuildVariables = (context: ComponentContextWithBuild) => {
|
|
88
92
|
return {
|
|
89
93
|
...getDockerAdditions(context.build.config),
|
|
90
94
|
APP_DIR: context.build.dir,
|
|
@@ -120,7 +124,7 @@ export const getDockerJobBaseProps = (): Pick<
|
|
|
120
124
|
};
|
|
121
125
|
|
|
122
126
|
export const createDockerBuildJobBase = (
|
|
123
|
-
context:
|
|
127
|
+
context: ComponentContextWithBuild,
|
|
124
128
|
{ script, cache, ...def }: DockerBuildJobDefinition,
|
|
125
129
|
): CatladderJob => {
|
|
126
130
|
return merge(
|
|
@@ -163,7 +167,7 @@ const BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
|
|
|
163
167
|
};
|
|
164
168
|
|
|
165
169
|
export const getDockerBuildScriptWithBuiltInDockerFile = (
|
|
166
|
-
context:
|
|
170
|
+
context: ComponentContextWithBuild,
|
|
167
171
|
defaultType?: BuildConfigDocker["type"],
|
|
168
172
|
) => {
|
|
169
173
|
const type =
|
package/src/build/index.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ComponentContextWithBuild,
|
|
3
|
+
WorkspaceContext,
|
|
4
|
+
} from "../types/context";
|
|
2
5
|
import type { EnvironmentContext } from "../types/environmentContext";
|
|
3
6
|
|
|
4
7
|
import type { CatladderJob } from "../types/jobs";
|
|
@@ -16,7 +19,7 @@ export * from "./types";
|
|
|
16
19
|
|
|
17
20
|
export type BuildTypes = {
|
|
18
21
|
[type in BuildConfigStandaloneType]: {
|
|
19
|
-
jobs: (context:
|
|
22
|
+
jobs: (context: ComponentContextWithBuild) => CatladderJob[];
|
|
20
23
|
defaults: (
|
|
21
24
|
envContext: EnvironmentContext,
|
|
22
25
|
) => Partial<Extract<BuildConfig, { type: type }>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
BuildContextStandalone,
|
|
3
|
+
ComponentContextWithBuild,
|
|
3
4
|
WorkspaceContext,
|
|
4
5
|
} from "../../types/context";
|
|
5
6
|
import {
|
|
@@ -19,7 +20,7 @@ import { getNodeCache, getYarnCache } from "./cache";
|
|
|
19
20
|
import { getDockerAppCopyAndBuildScript, getYarnInstall } from "./yarn";
|
|
20
21
|
|
|
21
22
|
export const createNodeBuildJobs = (
|
|
22
|
-
context:
|
|
23
|
+
context: ComponentContextWithBuild | WorkspaceContext,
|
|
23
24
|
): CatladderJob[] => {
|
|
24
25
|
if (context.type === "workspace") {
|
|
25
26
|
return createWorkspaceBuildJobs(context, {
|
|
@@ -47,8 +48,10 @@ export const createNodeBuildJobDefinition = (
|
|
|
47
48
|
});
|
|
48
49
|
};
|
|
49
50
|
|
|
51
|
+
type NewType = ComponentContextWithBuild;
|
|
52
|
+
|
|
50
53
|
export const createNodeDockerJobDefinition = (
|
|
51
|
-
context:
|
|
54
|
+
context: NewType,
|
|
52
55
|
): DockerBuildJobDefinition => {
|
|
53
56
|
// get the default docker built-in type based on the build type
|
|
54
57
|
const dockerDefaultBuiltIn: BuildConfigDocker["type"] =
|
package/src/build/node/index.ts
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ComponentContextWithBuild,
|
|
3
|
+
WorkspaceContext,
|
|
4
|
+
} from "../../types/context";
|
|
2
5
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
6
|
import { createNodeBuildJobs } from "./buildJob";
|
|
4
7
|
import { createMeteorBuildJobs } from "./meteor";
|
|
5
8
|
import { createNodeTestJobs } from "./testJob";
|
|
6
9
|
|
|
7
10
|
export const createNodeJobs = (
|
|
8
|
-
context:
|
|
11
|
+
context: ComponentContextWithBuild | WorkspaceContext,
|
|
9
12
|
): CatladderJob[] => {
|
|
10
13
|
return [...createNodeTestJobs(context), ...createNodeBuildJobs(context)];
|
|
11
14
|
};
|
|
12
15
|
|
|
13
16
|
export const createStorybookJobs = (
|
|
14
|
-
context:
|
|
17
|
+
context: ComponentContextWithBuild,
|
|
15
18
|
): CatladderJob[] => {
|
|
16
19
|
return [...createNodeBuildJobs(context)];
|
|
17
20
|
};
|
|
18
21
|
|
|
19
|
-
export const createMeteorJobs = (
|
|
22
|
+
export const createMeteorJobs = (
|
|
23
|
+
context: ComponentContextWithBuild,
|
|
24
|
+
): CatladderJob[] => {
|
|
20
25
|
return [...createNodeTestJobs(context), ...createMeteorBuildJobs(context)];
|
|
21
26
|
};
|
package/src/build/node/meteor.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { getRunnerImage } from "../../runner";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
ComponentContext,
|
|
4
|
+
ComponentContextWithBuild,
|
|
5
|
+
} from "../../types/context";
|
|
3
6
|
|
|
4
7
|
import type { CatladderJob } from "../../types/jobs";
|
|
5
8
|
|
|
@@ -23,7 +26,7 @@ const getMeteorCache = (context: ComponentContext): CacheConfig[] => [
|
|
|
23
26
|
},
|
|
24
27
|
];
|
|
25
28
|
export const createMeteorBuildJobs = (
|
|
26
|
-
context:
|
|
29
|
+
context: ComponentContextWithBuild,
|
|
27
30
|
): CatladderJob[] => {
|
|
28
31
|
const buildConfig = context.build.config;
|
|
29
32
|
|
package/src/build/node/yarn.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BashExpression } from "../../bash/BashExpression";
|
|
2
|
-
import type
|
|
2
|
+
import { type Context } from "../../types";
|
|
3
3
|
import { ensureArray } from "../../utils";
|
|
4
4
|
import { collapseableSection } from "../../utils/gitlab";
|
|
5
5
|
|
|
@@ -32,7 +32,9 @@ export const getYarnInstall = (
|
|
|
32
32
|
},
|
|
33
33
|
) => {
|
|
34
34
|
const postInstall =
|
|
35
|
-
context.type !== "workspace" &&
|
|
35
|
+
context.type !== "workspace" &&
|
|
36
|
+
context.build.type !== "disabled" &&
|
|
37
|
+
"postInstall" in context.build.config
|
|
36
38
|
? context.build.config.postInstall
|
|
37
39
|
: null;
|
|
38
40
|
return [
|
package/src/build/rails/build.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type BuildConfigRails,
|
|
4
|
-
type BuildContextStandalone,
|
|
5
|
-
type ComponentContext,
|
|
6
|
-
} from "../..";
|
|
1
|
+
import type { ComponentContextWithBuild } from "../..";
|
|
2
|
+
import { componentContextIsStandaloneBuild } from "../..";
|
|
7
3
|
import type { CatladderJob } from "../../types/jobs";
|
|
8
4
|
import { createComponentBuildJobs } from "../base";
|
|
9
5
|
import {
|
|
@@ -14,7 +10,7 @@ import {
|
|
|
14
10
|
import { isOfBuildType } from "../types";
|
|
15
11
|
|
|
16
12
|
export const createRailsBuildJobs = (
|
|
17
|
-
context:
|
|
13
|
+
context: ComponentContextWithBuild,
|
|
18
14
|
): CatladderJob[] => {
|
|
19
15
|
const buildConfig = context.build.config;
|
|
20
16
|
if (!isOfBuildType(buildConfig, "rails")) {
|
package/src/build/rails/index.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContextWithBuild } from "../../types";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
import { createRailsBuildJobs } from "./build";
|
|
4
4
|
import { createRailsTestJobs } from "./test";
|
|
5
5
|
|
|
6
|
-
export const createRailsJobs = (
|
|
6
|
+
export const createRailsJobs = (
|
|
7
|
+
context: ComponentContextWithBuild,
|
|
8
|
+
): CatladderJob[] => {
|
|
7
9
|
return [...createRailsTestJobs(context), ...createRailsBuildJobs(context)];
|
|
8
10
|
};
|
package/src/build/sbom.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { isStandaloneBuildConfig } from ".";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentContextWithBuild } from "../types/context";
|
|
3
3
|
import type { CatladderJob } from "../types/jobs";
|
|
4
4
|
import { ensureArrayOrNull } from "../utils";
|
|
5
5
|
|
|
6
6
|
export const SBOM_BUILD_JOB_NAME = "🧾 sbom";
|
|
7
7
|
export const SBOM_FILE = "__sbom.json";
|
|
8
8
|
|
|
9
|
-
export const createSbomBuildJob = (
|
|
9
|
+
export const createSbomBuildJob = (
|
|
10
|
+
context: ComponentContextWithBuild,
|
|
11
|
+
): CatladderJob => {
|
|
10
12
|
const buildConfig = context.build.config;
|
|
11
13
|
|
|
12
14
|
const defaultImage = "aquasec/trivy:0.38.3";
|
|
@@ -42,26 +42,31 @@ export const createComponentContext = async (
|
|
|
42
42
|
|
|
43
43
|
const componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
44
44
|
|
|
45
|
-
const resolvedBuildType =
|
|
46
|
-
componentConfigWithoutDefaults.build
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
const resolvedBuildType =
|
|
46
|
+
componentConfigWithoutDefaults.build === false
|
|
47
|
+
? false
|
|
48
|
+
: isStandaloneBuildConfig(componentConfigWithoutDefaults.build)
|
|
49
|
+
? componentConfigWithoutDefaults.build.type
|
|
50
|
+
: ctx.config.builds?.[componentConfigWithoutDefaults.build.from].type;
|
|
51
|
+
if (resolvedBuildType === undefined) {
|
|
51
52
|
throw new Error("build type not found, is the build config correct?");
|
|
52
53
|
}
|
|
53
54
|
const defaults: {
|
|
54
|
-
build: PartialDeep<BuildConfig>;
|
|
55
|
+
build: PartialDeep<BuildConfig | false>;
|
|
55
56
|
deploy: PartialDeep<DeployConfig>;
|
|
56
57
|
} = componentConfigWithoutDefaults.deploy
|
|
57
58
|
? {
|
|
58
|
-
build:
|
|
59
|
+
build:
|
|
60
|
+
resolvedBuildType &&
|
|
61
|
+
BUILD_TYPES[resolvedBuildType].defaults(envContext),
|
|
59
62
|
deploy: DEPLOY_TYPES[
|
|
60
63
|
componentConfigWithoutDefaults.deploy.type as DeployConfigType
|
|
61
64
|
].defaults(envContext as any),
|
|
62
65
|
}
|
|
63
66
|
: {
|
|
64
|
-
build:
|
|
67
|
+
build:
|
|
68
|
+
resolvedBuildType &&
|
|
69
|
+
BUILD_TYPES[resolvedBuildType].defaults(envContext),
|
|
65
70
|
deploy: {},
|
|
66
71
|
};
|
|
67
72
|
|
|
@@ -80,6 +85,14 @@ export const createComponentContext = async (
|
|
|
80
85
|
: []),
|
|
81
86
|
];
|
|
82
87
|
const _getBuildContext = (): BuildContextComponent => {
|
|
88
|
+
if (build === false) {
|
|
89
|
+
return {
|
|
90
|
+
type: "disabled",
|
|
91
|
+
getComponentDirs,
|
|
92
|
+
dir,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
83
96
|
if (isStandaloneBuildConfig(build)) {
|
|
84
97
|
return {
|
|
85
98
|
dir: dir,
|
package/src/context/getLabels.ts
CHANGED
|
@@ -14,7 +14,10 @@ export const getLabels = (context: ComponentContext) => {
|
|
|
14
14
|
"app-name": sanitize(context.fullConfig.appName),
|
|
15
15
|
"env-type": sanitize(context.environment.envType),
|
|
16
16
|
"env-name": sanitize(context.env),
|
|
17
|
-
"build-type":
|
|
17
|
+
"build-type":
|
|
18
|
+
context.build.type === "disabled"
|
|
19
|
+
? "disabled"
|
|
20
|
+
: sanitize(context.build.buildType),
|
|
18
21
|
...(context.fullConfig.meta?.labels ?? {}),
|
|
19
22
|
};
|
|
20
23
|
return labels;
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./common";
|
|
15
15
|
import { ENV_VARS_FILENAME } from "./constants";
|
|
16
16
|
import { createVolumeConfig } from "./volumes";
|
|
17
|
-
import {
|
|
17
|
+
import { getCloudRunServiceOrJobArgsArg } from "../utils/getJobOrServiceArgs";
|
|
18
18
|
|
|
19
19
|
export const getDeleteJobsScripts = (context: ComponentContext) => {
|
|
20
20
|
const commonArgs = getCommonCloudRunArgs(context);
|
|
@@ -44,7 +44,7 @@ export const getJobCreateScripts = (context: ComponentContext): string[] =>
|
|
|
44
44
|
const commonDeployArgsString = createArgsString(
|
|
45
45
|
{
|
|
46
46
|
command: `"${commandArray.join(",")}"`,
|
|
47
|
-
args:
|
|
47
|
+
args: getCloudRunServiceOrJobArgsArg(job.args),
|
|
48
48
|
labels: `"${makeLabelString(getLabels(context))},cloud-run-job-name=$current_job_name"`,
|
|
49
49
|
image: `"${job.image ?? commonImage}"`,
|
|
50
50
|
project,
|
|
@@ -3,6 +3,7 @@ import type { ComponentContext } from "../../../types/context";
|
|
|
3
3
|
|
|
4
4
|
import type { DeployConfigCloudRunService } from "../../types/googleCloudRun";
|
|
5
5
|
import { createArgsString } from "../utils/createArgsString";
|
|
6
|
+
import { getCloudRunServiceOrJobArgsArg } from "../utils/getJobOrServiceArgs";
|
|
6
7
|
import { getServiceName } from "../utils/getServiceName";
|
|
7
8
|
import {
|
|
8
9
|
gcloudRunCmd,
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
makeLabelString,
|
|
12
13
|
} from "./common";
|
|
13
14
|
import { ENV_VARS_FILENAME } from "./constants";
|
|
15
|
+
import { healthCheckCliArgs } from "./healthCheck";
|
|
14
16
|
import { createVolumeConfig } from "./volumes";
|
|
15
17
|
|
|
16
18
|
export const getServiceDeployScript = (
|
|
@@ -25,7 +27,10 @@ export const getServiceDeployScript = (
|
|
|
25
27
|
const customConfig = service !== true ? service : undefined;
|
|
26
28
|
const command =
|
|
27
29
|
service !== true
|
|
28
|
-
? (service?.command ??
|
|
30
|
+
? (service?.command ??
|
|
31
|
+
(context.build.type !== "disabled"
|
|
32
|
+
? context.build.config.startCommand
|
|
33
|
+
: undefined))
|
|
29
34
|
: undefined;
|
|
30
35
|
|
|
31
36
|
const commandArray = command
|
|
@@ -34,11 +39,14 @@ export const getServiceDeployScript = (
|
|
|
34
39
|
: command.split(" ")
|
|
35
40
|
: undefined;
|
|
36
41
|
const fullServiceName = serviceName.concat(nameSuffix ?? "");
|
|
42
|
+
|
|
37
43
|
const argsString = createArgsString(
|
|
38
44
|
{
|
|
39
45
|
// command as empty string resets it to default (uses the image's entrypoint)
|
|
40
46
|
command: commandArray ? '"' + commandArray.join(",") + '"' : '""',
|
|
47
|
+
args: getCloudRunServiceOrJobArgsArg(customConfig?.args),
|
|
41
48
|
...commonDeployArgs,
|
|
49
|
+
image: customConfig?.image ?? commonDeployArgs.image,
|
|
42
50
|
labels: makeLabelString({
|
|
43
51
|
...getLabels(context),
|
|
44
52
|
"cloud-run-service-name": fullServiceName,
|
|
@@ -61,6 +69,7 @@ export const getServiceDeployScript = (
|
|
|
61
69
|
"execution-environment": customConfig?.executionEnvironment,
|
|
62
70
|
gpu: customConfig?.gpu,
|
|
63
71
|
"gpu-type": customConfig?.gpuType,
|
|
72
|
+
...healthCheckCliArgs(customConfig?.healthCheck),
|
|
64
73
|
},
|
|
65
74
|
...createVolumeConfig(customConfig?.volumes, "service"),
|
|
66
75
|
);
|
|
@@ -97,5 +106,8 @@ const requiresBeta = (config: DeployConfigCloudRunService | undefined) => {
|
|
|
97
106
|
if (config.gpu && config.gpu > 0) {
|
|
98
107
|
return true;
|
|
99
108
|
}
|
|
109
|
+
if (config.healthCheck !== undefined) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
100
112
|
return false;
|
|
101
113
|
};
|