@catladder/pipeline 1.109.2 → 1.110.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.
@@ -0,0 +1,25 @@
1
+ import type { Config } from "../src";
2
+ import { createAllPipelines } from "./__utils__/helpers";
3
+
4
+ const config: Config = {
5
+ appName: "test-app",
6
+ customerName: "pan",
7
+ components: {
8
+ www: {
9
+ dir: "www",
10
+ build: {
11
+ type: "node",
12
+ jobImage: "my-custom-image",
13
+ },
14
+ deploy: {
15
+ type: "google-cloudrun",
16
+ projectId: "asdf",
17
+ region: "asia-east1",
18
+ },
19
+ },
20
+ },
21
+ };
22
+
23
+ it("matches snapshot", async () => {
24
+ expect(await createAllPipelines(config)).toMatchSnapshot();
25
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@catladder/pipeline",
3
- "version": "1.109.2",
3
+ "version": "1.110.0",
4
4
  "scripts": {
5
5
  "build:tsc": "yarn tsc",
6
6
  "build": "yarn build:compile && yarn build:inline-variables && yarn build:bundle",
@@ -9,6 +9,7 @@ import { getNextCache, getNodeCache, getYarnCache } from "./cache";
9
9
  import { NODE_RUNNER_BUILD_VARIABLES } from "./constants";
10
10
  import { getDockerAppCopyAndBuildScript, getYarnInstall } from "./yarn";
11
11
  import type { CatladderJob } from "../../types/jobs";
12
+ import { getRunnerImage } from "../../runner";
12
13
 
13
14
  export const createNodeBuildJobs = (context: Context): CatladderJob[] => {
14
15
  const buildConfig = context.componentConfig.build;
@@ -17,10 +18,12 @@ export const createNodeBuildJobs = (context: Context): CatladderJob[] => {
17
18
  throw new Error("deploy config is not node, node-static or storybook");
18
19
  }
19
20
 
21
+ const defaultImage = getRunnerImage("jobs-default");
20
22
  const yarnInstall = getYarnInstall(context);
21
23
  const appBuildJob: CatladderJob | null =
22
24
  buildConfig.buildCommand !== null
23
25
  ? createBuildJob(context, {
26
+ image: buildConfig.jobImage ?? defaultImage,
24
27
  variables: {
25
28
  ...NODE_RUNNER_BUILD_VARIABLES,
26
29
  },
@@ -39,7 +39,8 @@ export const createRailsTestJobs = (context: Context): CatladderJob[] => {
39
39
 
40
40
  ...base,
41
41
  cache: undefined, // audit does not need bundle install and no cache
42
- image: buildConfig.audit?.jobImage ?? defaultImage,
42
+ image:
43
+ buildConfig.audit?.jobImage ?? buildConfig.jobImage ?? defaultImage,
43
44
  script: [
44
45
  `cd ${context.componentConfig.dir}`,
45
46
  ...(ensureArray(buildConfig.audit?.command) ?? [
@@ -58,7 +59,8 @@ export const createRailsTestJobs = (context: Context): CatladderJob[] => {
58
59
 
59
60
  ...base,
60
61
  cache: bundlerCache,
61
- image: buildConfig.lint?.jobImage ?? defaultImage,
62
+ image:
63
+ buildConfig.lint?.jobImage ?? buildConfig.jobImage ?? defaultImage,
62
64
  script: [
63
65
  `cd ${context.componentConfig.dir}`,
64
66
  ...bundlerInstall,
@@ -75,7 +77,8 @@ export const createRailsTestJobs = (context: Context): CatladderJob[] => {
75
77
 
76
78
  ...base,
77
79
  cache: bundlerCache,
78
- image: buildConfig.test?.jobImage ?? defaultImage,
80
+ image:
81
+ buildConfig.test?.jobImage ?? buildConfig.jobImage ?? defaultImage,
79
82
  script: [
80
83
  `cd ${context.componentConfig.dir}`,
81
84
  ...bundlerInstall,
@@ -93,6 +93,10 @@ export type BuildConfigBase = {
93
93
  * tags for the underlying job runner (e.g gitlab)
94
94
  */
95
95
  jobTags?: string[];
96
+ /**
97
+ * custom image to use
98
+ */
99
+ jobImage?: GitlabJobImage;
96
100
  };
97
101
 
98
102
  export type BuildConfigNodeBase = BuildConfigBase & {
@@ -142,7 +146,7 @@ export type BuildConfigCustom = Omit<
142
146
  "lint" | "test" | "audit"
143
147
  > & {
144
148
  type: "custom";
145
- jobImage: string;
149
+ jobImage: GitlabJobImage;
146
150
  jobServices?: GitlabJobService[];
147
151
 
148
152
  docker: BuildConfigCustomDocker;