@catladder/pipeline 1.109.1 → 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.
- package/dist/build/node/buildJob.js +10 -7
- package/dist/build/rails/test.js +7 -7
- package/dist/build/types.d.ts +5 -1
- package/dist/bundles/catladder-gitlab/index.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/deploy/types/kubernetes.d.ts +3 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/__snapshots__/node-build-with-custom-image.ts.snap +1808 -0
- package/examples/node-build-with-custom-image.ts +25 -0
- package/package.json +1 -1
- package/src/build/node/buildJob.ts +3 -0
- package/src/build/rails/test.ts +6 -3
- package/src/build/types.ts +5 -1
- package/src/deploy/types/kubernetes.ts +3 -0
|
@@ -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
|
@@ -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
|
},
|
package/src/build/rails/test.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
80
|
+
image:
|
|
81
|
+
buildConfig.test?.jobImage ?? buildConfig.jobImage ?? defaultImage,
|
|
79
82
|
script: [
|
|
80
83
|
`cd ${context.componentConfig.dir}`,
|
|
81
84
|
...bundlerInstall,
|
package/src/build/types.ts
CHANGED
|
@@ -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:
|
|
149
|
+
jobImage: GitlabJobImage;
|
|
146
150
|
jobServices?: GitlabJobService[];
|
|
147
151
|
|
|
148
152
|
docker: BuildConfigCustomDocker;
|
|
@@ -140,6 +140,9 @@ export type KubernetesRedirect = {
|
|
|
140
140
|
path?: string;
|
|
141
141
|
/**
|
|
142
142
|
* optional nginx config snippet, defaults to a 301 redirect to the environment host name name with the request path appended
|
|
143
|
+
*
|
|
144
|
+
* important: to get a literal `$` use `$$` to prevent variable expansion by gitlab
|
|
145
|
+
* see https://docs.gitlab.com/ee/ci/variables/#use-the--character-in-cicd-variables
|
|
143
146
|
*/
|
|
144
147
|
rule?: string;
|
|
145
148
|
};
|