@catladder/pipeline 3.6.0 → 3.7.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 (64) hide show
  1. package/dist/build/artifacts/createBuildJobArtifact.js +1 -1
  2. package/dist/build/base/index.d.ts +2 -3
  3. package/dist/build/cache/getAllCacheConfigsFromConfig.js +2 -2
  4. package/dist/build/custom/buildJob.d.ts +2 -2
  5. package/dist/build/custom/index.d.ts +2 -2
  6. package/dist/build/custom/testJob.d.ts +2 -2
  7. package/dist/build/docker.d.ts +4 -4
  8. package/dist/build/index.d.ts +2 -2
  9. package/dist/build/node/buildJob.d.ts +5 -3
  10. package/dist/build/node/index.d.ts +4 -4
  11. package/dist/build/node/meteor.d.ts +2 -2
  12. package/dist/build/node/yarn.d.ts +1 -1
  13. package/dist/build/node/yarn.js +1 -1
  14. package/dist/build/rails/build.d.ts +2 -2
  15. package/dist/build/rails/index.d.ts +2 -2
  16. package/dist/build/sbom.d.ts +2 -2
  17. package/dist/constants.js +1 -1
  18. package/dist/context/createComponentContext.js +11 -4
  19. package/dist/context/getLabels.js +1 -1
  20. package/dist/deploy/cloudRun/createJobs/cloudRunJobs.js +2 -2
  21. package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +10 -7
  22. package/dist/deploy/cloudRun/createJobs/execute/onDeploy.d.ts +2 -3
  23. package/dist/deploy/cloudRun/createJobs/execute/onDeploy.js +4 -9
  24. package/dist/deploy/cloudRun/utils/getJobOrServiceArgs.d.ts +2 -0
  25. package/dist/deploy/cloudRun/utils/getJobOrServiceArgs.js +12 -0
  26. package/dist/deploy/kubernetes/kubeValues.d.ts +2 -2
  27. package/dist/deploy/kubernetes/kubeValues.js +1 -1
  28. package/dist/deploy/sbom.js +1 -1
  29. package/dist/deploy/types/googleCloudRun.d.ts +10 -0
  30. package/dist/pipeline/createJobsForComponent.js +1 -1
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/dist/types/config.d.ts +1 -1
  33. package/dist/types/context.d.ts +6 -1
  34. package/examples/__snapshots__/cloud-run-llama.test.ts.snap +624 -0
  35. package/examples/cloud-run-llama.test.ts +11 -0
  36. package/examples/cloud-run-llama.ts +40 -0
  37. package/package.json +1 -1
  38. package/src/build/artifacts/createBuildJobArtifact.ts +3 -1
  39. package/src/build/base/index.ts +5 -2
  40. package/src/build/cache/getAllCacheConfigsFromConfig.ts +7 -6
  41. package/src/build/custom/buildJob.ts +2 -2
  42. package/src/build/custom/index.ts +4 -2
  43. package/src/build/custom/testJob.ts +2 -2
  44. package/src/build/docker.ts +8 -4
  45. package/src/build/index.ts +5 -2
  46. package/src/build/node/buildJob.ts +5 -2
  47. package/src/build/node/index.ts +9 -4
  48. package/src/build/node/meteor.ts +5 -2
  49. package/src/build/node/yarn.ts +4 -2
  50. package/src/build/rails/build.ts +3 -7
  51. package/src/build/rails/index.ts +4 -2
  52. package/src/build/sbom.ts +4 -2
  53. package/src/context/createComponentContext.ts +22 -9
  54. package/src/context/getLabels.ts +4 -1
  55. package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +2 -2
  56. package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +7 -1
  57. package/src/deploy/cloudRun/createJobs/execute/onDeploy.ts +3 -13
  58. package/src/deploy/cloudRun/utils/getJobOrServiceArgs.ts +18 -0
  59. package/src/deploy/kubernetes/kubeValues.ts +13 -4
  60. package/src/deploy/sbom.ts +4 -3
  61. package/src/deploy/types/googleCloudRun.ts +11 -0
  62. package/src/pipeline/createJobsForComponent.ts +10 -2
  63. package/src/types/config.ts +1 -1
  64. package/src/types/context.ts +10 -1
@@ -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
@@ -53,7 +53,7 @@
53
53
  }
54
54
  ],
55
55
  "license": "MIT",
56
- "version": "3.6.0",
56
+ "version": "3.7.0",
57
57
  "scripts": {
58
58
  "build:tsc": "yarn tsc",
59
59
  "build": "yarn build:compile && yarn build:inline-variables",
@@ -41,7 +41,9 @@ const getArtifactsPathForComponent = (
41
41
  additionalPaths?: string[],
42
42
  ): string[] => {
43
43
  return [
44
- ...(c.build.config.artifactsPaths ?? []),
44
+ ...(c.build.type !== "disabled"
45
+ ? (c.build.config.artifactsPaths ?? [])
46
+ : []),
45
47
  ...(additionalPaths ?? []),
46
48
  ]?.flatMap((artifact) =>
47
49
  c.build
@@ -1,5 +1,8 @@
1
1
  import { sbomDeactivated } from "../../deploy/sbom";
2
- import type { WorkspaceContext } from "../../types/context";
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: ComponentContext,
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
- (componentContext) =>
21
- ensureArray(componentContext.build.config.cache).map((c) => ({
22
- ...c,
23
- baseDir: componentContext.build.dir,
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 { ComponentContext } from "../../types/context";
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: ComponentContext,
10
+ context: ComponentContextWithBuild,
11
11
  ): CatladderJob[] => {
12
12
  const buildConfig = context.build.config;
13
13
 
@@ -1,8 +1,10 @@
1
- import type { ComponentContext } from "../../types/context";
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 = (context: ComponentContext): CatladderJob[] => {
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 { ComponentContext } from "../../types/context";
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: ComponentContext,
16
+ context: ComponentContextWithBuild,
17
17
  ): CatladderJob[] => {
18
18
  // don't run tests after release
19
19
  // TODO: this will be replaced by using rules
@@ -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 { ComponentContext, DockerBuildJobDefinition } from "../types";
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: ComponentContext) => {
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: ComponentContext,
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: ComponentContext,
170
+ context: ComponentContextWithBuild,
167
171
  defaultType?: BuildConfigDocker["type"],
168
172
  ) => {
169
173
  const type =
@@ -1,4 +1,7 @@
1
- import type { ComponentContext, WorkspaceContext } from "../types/context";
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: ComponentContext) => CatladderJob[];
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: ComponentContext | WorkspaceContext,
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: ComponentContext,
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"] =
@@ -1,21 +1,26 @@
1
- import type { ComponentContext, WorkspaceContext } from "../../types/context";
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: ComponentContext | WorkspaceContext,
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: ComponentContext,
17
+ context: ComponentContextWithBuild,
15
18
  ): CatladderJob[] => {
16
19
  return [...createNodeBuildJobs(context)];
17
20
  };
18
21
 
19
- export const createMeteorJobs = (context: ComponentContext): CatladderJob[] => {
22
+ export const createMeteorJobs = (
23
+ context: ComponentContextWithBuild,
24
+ ): CatladderJob[] => {
20
25
  return [...createNodeTestJobs(context), ...createMeteorBuildJobs(context)];
21
26
  };
@@ -1,5 +1,8 @@
1
1
  import { getRunnerImage } from "../../runner";
2
- import type { ComponentContext } from "../../types/context";
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: ComponentContext,
29
+ context: ComponentContextWithBuild,
27
30
  ): CatladderJob[] => {
28
31
  const buildConfig = context.build.config;
29
32
 
@@ -1,5 +1,5 @@
1
1
  import { BashExpression } from "../../bash/BashExpression";
2
- import type { Context } from "../../types";
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" && "postInstall" in context.build.config
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 [
@@ -1,9 +1,5 @@
1
- import {
2
- componentContextIsStandaloneBuild,
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: ComponentContext,
13
+ context: ComponentContextWithBuild,
18
14
  ): CatladderJob[] => {
19
15
  const buildConfig = context.build.config;
20
16
  if (!isOfBuildType(buildConfig, "rails")) {
@@ -1,8 +1,10 @@
1
- import type { ComponentContext } from "../../types";
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 = (context: ComponentContext): CatladderJob[] => {
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 { ComponentContext } from "../types/context";
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 = (context: ComponentContext): CatladderJob => {
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 = isStandaloneBuildConfig(
46
- componentConfigWithoutDefaults.build,
47
- )
48
- ? componentConfigWithoutDefaults.build.type
49
- : ctx.config.builds?.[componentConfigWithoutDefaults.build.from].type;
50
- if (!resolvedBuildType) {
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: BUILD_TYPES[resolvedBuildType].defaults(envContext),
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: BUILD_TYPES[resolvedBuildType].defaults(envContext),
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,
@@ -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": sanitize(context.build.buildType),
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 { getCloudRunJobArgsArg } from "./execute/onDeploy";
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: getCloudRunJobArgsArg(job.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,
@@ -25,7 +26,10 @@ export const getServiceDeployScript = (
25
26
  const customConfig = service !== true ? service : undefined;
26
27
  const command =
27
28
  service !== true
28
- ? (service?.command ?? context.build.config.startCommand)
29
+ ? (service?.command ??
30
+ (context.build.type !== "disabled"
31
+ ? context.build.config.startCommand
32
+ : undefined))
29
33
  : undefined;
30
34
 
31
35
  const commandArray = command
@@ -38,7 +42,9 @@ export const getServiceDeployScript = (
38
42
  {
39
43
  // command as empty string resets it to default (uses the image's entrypoint)
40
44
  command: commandArray ? '"' + commandArray.join(",") + '"' : '""',
45
+ args: getCloudRunServiceOrJobArgsArg(customConfig?.args),
41
46
  ...commonDeployArgs,
47
+ image: customConfig?.image ?? commonDeployArgs.image,
42
48
  labels: makeLabelString({
43
49
  ...getLabels(context),
44
50
  "cloud-run-service-name": fullServiceName,
@@ -3,8 +3,10 @@ import type { ComponentContext } from "../../../../types/context";
3
3
  import type {
4
4
  DeployConfigCloudRunExecuteOnDeploy,
5
5
  DeployConfigCloudRunJob,
6
+ DeployConfigCloudRunService,
6
7
  } from "../../../types/googleCloudRun";
7
8
  import { createArgsString } from "../../utils/createArgsString";
9
+ import { getCloudRunServiceOrJobArgsArg } from "../../utils/getJobOrServiceArgs";
8
10
  import { getFullJobName } from "../../utils/jobName";
9
11
  import { getCloudRunJobsWithNames } from "../cloudRunJobs";
10
12
  import {
@@ -93,20 +95,8 @@ const getJobRunScriptForExecute = (
93
95
  const argString = createArgsString({
94
96
  ...commonArgs,
95
97
  wait: waitForCompletion === true ? true : undefined,
96
- args: getCloudRunJobArgsArg(config.args),
98
+ args: getCloudRunServiceOrJobArgsArg(config.args),
97
99
  });
98
100
  const fullJobName = getFullJobName(context, jobName);
99
101
  return `${gcloudRunCmd()} jobs execute ${fullJobName.toString()} ${argString}`;
100
102
  };
101
-
102
- export const getCloudRunJobArgsArg = (
103
- args:
104
- | DeployConfigCloudRunExecuteOnDeploy["args"]
105
- | DeployConfigCloudRunJob["args"],
106
- ) => {
107
- return args !== undefined
108
- ? args.length > 0
109
- ? args?.map((arg) => `"${arg}"`).join(",")
110
- : ""
111
- : undefined;
112
- };
@@ -0,0 +1,18 @@
1
+ import type {
2
+ DeployConfigCloudRunExecuteOnDeploy,
3
+ DeployConfigCloudRunJob,
4
+ DeployConfigCloudRunService,
5
+ } from "../../types";
6
+
7
+ export const getCloudRunServiceOrJobArgsArg = (
8
+ args:
9
+ | DeployConfigCloudRunExecuteOnDeploy["args"]
10
+ | DeployConfigCloudRunJob["args"]
11
+ | DeployConfigCloudRunService["args"],
12
+ ) => {
13
+ return args !== undefined
14
+ ? args.length > 0
15
+ ? args?.map((arg) => `"${arg}"`).join(",")
16
+ : ""
17
+ : undefined;
18
+ };
@@ -1,6 +1,9 @@
1
1
  import { merge } from "lodash";
2
2
 
3
- import type { ComponentContext } from "../../types/context";
3
+ import type {
4
+ BuildContextComponent,
5
+ ComponentContext,
6
+ } from "../../types/context";
4
7
  import { mergeWithMergingArrays } from "../../utils";
5
8
  import type { DeployConfigKubernetesValues } from "../types";
6
9
  import { isOfDeployType } from "../types";
@@ -13,7 +16,7 @@ import { createKubeEnv } from "./kubeEnv";
13
16
  import { createMongodbBaseConfig } from "./mongodb";
14
17
 
15
18
  const createAppConfig = (
16
- context: ComponentContext,
19
+ context: ComponentContext<BuildContextComponent>,
17
20
  application: DeployConfigKubernetesValues["application"],
18
21
  ): DeployConfigKubernetesValues["application"] => {
19
22
  if (application === false) {
@@ -27,7 +30,11 @@ const createAppConfig = (
27
30
  return mergeWithMergingArrays(
28
31
  {
29
32
  host: context.environment.envVars.HOSTNAME,
30
- command: command ?? context.build.config.startCommand,
33
+ command:
34
+ command ??
35
+ (context.build.type !== "disabled"
36
+ ? context.build.config.startCommand
37
+ : undefined),
31
38
  livenessProbe: {
32
39
  httpGet: {
33
40
  path: healthRoute ?? "__health",
@@ -55,7 +62,9 @@ const removeFalsy = <T>(record?: Record<string, false | T>) => {
55
62
  );
56
63
  };
57
64
 
58
- export const createKubeValues = (context: ComponentContext) => {
65
+ export const createKubeValues = (
66
+ context: ComponentContext<BuildContextComponent>,
67
+ ) => {
59
68
  const deployConfig = context.deploy?.config;
60
69
  if (!deployConfig) {
61
70
  return [];
@@ -6,9 +6,10 @@ import {
6
6
  } from "../types/context";
7
7
 
8
8
  export const sbomDeactivated = (context: ComponentContext) =>
9
- componentContextIsStandaloneBuild(context) &&
10
- context.build.config.type === "custom" &&
11
- context.build.config.sbom === false;
9
+ context.build.type === "disabled" ||
10
+ (componentContextIsStandaloneBuild(context) &&
11
+ context.build.config.type === "custom" &&
12
+ context.build.config.sbom === false);
12
13
 
13
14
  export const getDependencyTrackUploadScript = (
14
15
  context: ComponentContext,
@@ -180,6 +180,17 @@ export type DeployConfigCloudRunService = {
180
180
  * gpu type to use. Refer to https://cloud.google.com/run/docs/configuring/services/gpu#gcloud for defaults
181
181
  */
182
182
  gpuType?: string;
183
+
184
+ /**
185
+ * the image to use. Defaults to the image from the build.
186
+ *
187
+ * If you specify an image, you usually want to disable the build by setting build: false
188
+ */
189
+ image?: string;
190
+ /**
191
+ * args to pass to the command
192
+ */
193
+ args?: string[];
183
194
  } & DeployConfigCloudRunWithVolumes &
184
195
  DeployConfigCloudRunNetworkConfig;
185
196
 
@@ -1,6 +1,9 @@
1
1
  import { BUILD_TYPES } from "../build";
2
2
  import { DEPLOY_TYPES } from "../deploy";
3
- import type { ComponentContext } from "../types/context";
3
+ import type {
4
+ ComponentContext,
5
+ ComponentContextWithBuild,
6
+ } from "../types/context";
4
7
  import type { CatladderJob } from "../types/jobs";
5
8
 
6
9
  const injectDefaultVarsInCustomJobs = (
@@ -24,7 +27,12 @@ const getCustomJobs = (context: ComponentContext) => {
24
27
  export const createJobsForComponentContext = (
25
28
  context: ComponentContext,
26
29
  ): CatladderJob[] => {
27
- const buildJobs = BUILD_TYPES[context.build.buildType].jobs(context);
30
+ const buildJobs =
31
+ context.build.type !== "disabled"
32
+ ? BUILD_TYPES[context.build.buildType].jobs(
33
+ context as ComponentContextWithBuild,
34
+ )
35
+ : [];
28
36
  const deployJobs =
29
37
  context.componentConfig.deploy !== false
30
38
  ? DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context)
@@ -83,7 +83,7 @@ export type DefaultEnvConfig = {
83
83
  /**
84
84
  * how the app is built and its runtime
85
85
  */
86
- build: BuildConfig;
86
+ build: BuildConfig | false;
87
87
  /**
88
88
  * environment variables
89
89
  */