@catladder/pipeline 1.110.0 โ 1.110.2
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/base/__tests__/createArtifactsConfig.test.d.ts +1 -0
- package/dist/build/base/__tests__/createArtifactsConfig.test.js +40 -0
- package/dist/build/base/createArtifactsConfig.d.ts +4 -0
- package/dist/build/base/createArtifactsConfig.js +63 -0
- package/dist/build/custom/__tests__/testJob.test.d.ts +1 -0
- package/dist/build/custom/__tests__/testJob.test.js +37 -0
- package/dist/build/custom/testJob.d.ts +5 -1
- package/dist/build/custom/testJob.js +10 -23
- package/dist/build/node/testJob.js +15 -11
- package/dist/build/types.d.ts +39 -40
- package/dist/bundles/catladder-gitlab/index.js +3 -3
- package/dist/constants.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/gitlab-types.d.ts +13 -22
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +4 -0
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +4 -0
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +4 -0
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +8 -0
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +8 -0
- package/examples/__snapshots__/custom-deploy.ts.snap +4 -0
- package/examples/__snapshots__/custom-envs.ts.snap +4 -0
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +4 -0
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +4 -0
- package/examples/__snapshots__/kubernetes-with-cloud-sql.ts.snap +4 -0
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +8 -0
- package/examples/__snapshots__/kubernetes-with-mongodb.ts.snap +4 -0
- package/examples/__snapshots__/native-app.ts.snap +8 -0
- package/examples/__snapshots__/node-build-with-custom-image.ts.snap +4 -0
- package/examples/__snapshots__/wait-for-other-deploy.ts.snap +8 -0
- package/package.json +1 -1
- package/src/build/base/__tests__/__snapshots__/createArtifactsConfig.test.ts.snap +49 -0
- package/src/build/base/__tests__/createArtifactsConfig.test.ts +41 -0
- package/src/build/base/createArtifactsConfig.ts +34 -0
- package/src/build/custom/__tests__/testJob.test.ts +32 -0
- package/src/build/custom/testJob.ts +8 -21
- package/src/build/node/testJob.ts +21 -4
- package/src/build/types.ts +45 -46
- package/src/types/gitlab-types.ts +12 -12
|
@@ -123,6 +123,7 @@ cloudsql:
|
|
|
123
123
|
"policy": "pull-push",
|
|
124
124
|
},
|
|
125
125
|
],
|
|
126
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
126
127
|
"interruptible": true,
|
|
127
128
|
"needs": [],
|
|
128
129
|
"retry": {
|
|
@@ -532,6 +533,7 @@ cloudsql:
|
|
|
532
533
|
},
|
|
533
534
|
"api ๐ก audit": {
|
|
534
535
|
"allow_failure": true,
|
|
536
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
535
537
|
"interruptible": true,
|
|
536
538
|
"needs": [],
|
|
537
539
|
"retry": {
|
|
@@ -832,6 +834,7 @@ cloudsql:
|
|
|
832
834
|
"policy": "pull-push",
|
|
833
835
|
},
|
|
834
836
|
],
|
|
837
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
835
838
|
"interruptible": true,
|
|
836
839
|
"needs": [],
|
|
837
840
|
"retry": {
|
|
@@ -1241,6 +1244,7 @@ cloudsql:
|
|
|
1241
1244
|
},
|
|
1242
1245
|
"api ๐ก audit": {
|
|
1243
1246
|
"allow_failure": true,
|
|
1247
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
1244
1248
|
"interruptible": true,
|
|
1245
1249
|
"needs": [],
|
|
1246
1250
|
"retry": {
|
|
@@ -119,6 +119,7 @@ cronjobs:
|
|
|
119
119
|
"policy": "pull-push",
|
|
120
120
|
},
|
|
121
121
|
],
|
|
122
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
122
123
|
"interruptible": true,
|
|
123
124
|
"needs": [],
|
|
124
125
|
"retry": {
|
|
@@ -518,6 +519,7 @@ cronjobs:
|
|
|
518
519
|
},
|
|
519
520
|
"api ๐ก audit": {
|
|
520
521
|
"allow_failure": true,
|
|
522
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
521
523
|
"interruptible": true,
|
|
522
524
|
"needs": [],
|
|
523
525
|
"retry": {
|
|
@@ -735,6 +737,7 @@ application:
|
|
|
735
737
|
"policy": "pull-push",
|
|
736
738
|
},
|
|
737
739
|
],
|
|
740
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
738
741
|
"interruptible": true,
|
|
739
742
|
"needs": [],
|
|
740
743
|
"retry": {
|
|
@@ -1120,6 +1123,7 @@ application:
|
|
|
1120
1123
|
},
|
|
1121
1124
|
"www ๐ก audit": {
|
|
1122
1125
|
"allow_failure": true,
|
|
1126
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
1123
1127
|
"interruptible": true,
|
|
1124
1128
|
"needs": [],
|
|
1125
1129
|
"retry": {
|
|
@@ -1413,6 +1417,7 @@ cronjobs: {}
|
|
|
1413
1417
|
"policy": "pull-push",
|
|
1414
1418
|
},
|
|
1415
1419
|
],
|
|
1420
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
1416
1421
|
"interruptible": true,
|
|
1417
1422
|
"needs": [],
|
|
1418
1423
|
"retry": {
|
|
@@ -1806,6 +1811,7 @@ cronjobs: {}
|
|
|
1806
1811
|
},
|
|
1807
1812
|
"api ๐ก audit": {
|
|
1808
1813
|
"allow_failure": true,
|
|
1814
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
1809
1815
|
"interruptible": true,
|
|
1810
1816
|
"needs": [],
|
|
1811
1817
|
"retry": {
|
|
@@ -2023,6 +2029,7 @@ application:
|
|
|
2023
2029
|
"policy": "pull-push",
|
|
2024
2030
|
},
|
|
2025
2031
|
],
|
|
2032
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
2026
2033
|
"interruptible": true,
|
|
2027
2034
|
"needs": [],
|
|
2028
2035
|
"retry": {
|
|
@@ -2408,6 +2415,7 @@ application:
|
|
|
2408
2415
|
},
|
|
2409
2416
|
"www ๐ก audit": {
|
|
2410
2417
|
"allow_failure": true,
|
|
2418
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
2411
2419
|
"interruptible": true,
|
|
2412
2420
|
"needs": [],
|
|
2413
2421
|
"retry": {
|
|
@@ -139,6 +139,7 @@ mongodb:
|
|
|
139
139
|
"policy": "pull-push",
|
|
140
140
|
},
|
|
141
141
|
],
|
|
142
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
142
143
|
"interruptible": true,
|
|
143
144
|
"needs": [],
|
|
144
145
|
"retry": {
|
|
@@ -580,6 +581,7 @@ mongodb:
|
|
|
580
581
|
},
|
|
581
582
|
"api ๐ก audit": {
|
|
582
583
|
"allow_failure": true,
|
|
584
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
583
585
|
"interruptible": true,
|
|
584
586
|
"needs": [],
|
|
585
587
|
"retry": {
|
|
@@ -896,6 +898,7 @@ mongodb:
|
|
|
896
898
|
"policy": "pull-push",
|
|
897
899
|
},
|
|
898
900
|
],
|
|
901
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
899
902
|
"interruptible": true,
|
|
900
903
|
"needs": [],
|
|
901
904
|
"retry": {
|
|
@@ -1337,6 +1340,7 @@ mongodb:
|
|
|
1337
1340
|
},
|
|
1338
1341
|
"api ๐ก audit": {
|
|
1339
1342
|
"allow_failure": true,
|
|
1343
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
1340
1344
|
"interruptible": true,
|
|
1341
1345
|
"needs": [],
|
|
1342
1346
|
"retry": {
|
|
@@ -22,6 +22,7 @@ exports[`matches snapshot 1`] = `
|
|
|
22
22
|
"policy": "pull-push",
|
|
23
23
|
},
|
|
24
24
|
],
|
|
25
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
25
26
|
"interruptible": true,
|
|
26
27
|
"needs": [],
|
|
27
28
|
"retry": {
|
|
@@ -352,6 +353,7 @@ _ALL_ENV_VAR_KEYS: '["ENV_SHORT","APP_DIR","ENV_TYPE","BUILD_INFO_ID","BUILD_INF
|
|
|
352
353
|
},
|
|
353
354
|
"api ๐ก audit": {
|
|
354
355
|
"allow_failure": true,
|
|
356
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
355
357
|
"interruptible": true,
|
|
356
358
|
"needs": [],
|
|
357
359
|
"retry": {
|
|
@@ -479,6 +481,7 @@ _ALL_ENV_VAR_KEYS: '["ENV_SHORT","APP_DIR","ENV_TYPE","BUILD_INFO_ID","BUILD_INF
|
|
|
479
481
|
"policy": "pull-push",
|
|
480
482
|
},
|
|
481
483
|
],
|
|
484
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
482
485
|
"interruptible": true,
|
|
483
486
|
"needs": [],
|
|
484
487
|
"retry": {
|
|
@@ -701,6 +704,7 @@ EOF",
|
|
|
701
704
|
},
|
|
702
705
|
"app ๐ก audit": {
|
|
703
706
|
"allow_failure": true,
|
|
707
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
704
708
|
"interruptible": true,
|
|
705
709
|
"needs": [],
|
|
706
710
|
"retry": {
|
|
@@ -904,6 +908,7 @@ EOF",
|
|
|
904
908
|
"policy": "pull-push",
|
|
905
909
|
},
|
|
906
910
|
],
|
|
911
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
907
912
|
"interruptible": true,
|
|
908
913
|
"needs": [],
|
|
909
914
|
"retry": {
|
|
@@ -1234,6 +1239,7 @@ _ALL_ENV_VAR_KEYS: '["ENV_SHORT","APP_DIR","ENV_TYPE","BUILD_INFO_ID","BUILD_INF
|
|
|
1234
1239
|
},
|
|
1235
1240
|
"api ๐ก audit": {
|
|
1236
1241
|
"allow_failure": true,
|
|
1242
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
1237
1243
|
"interruptible": true,
|
|
1238
1244
|
"needs": [],
|
|
1239
1245
|
"retry": {
|
|
@@ -1361,6 +1367,7 @@ _ALL_ENV_VAR_KEYS: '["ENV_SHORT","APP_DIR","ENV_TYPE","BUILD_INFO_ID","BUILD_INF
|
|
|
1361
1367
|
"policy": "pull-push",
|
|
1362
1368
|
},
|
|
1363
1369
|
],
|
|
1370
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
1364
1371
|
"interruptible": true,
|
|
1365
1372
|
"needs": [],
|
|
1366
1373
|
"retry": {
|
|
@@ -1583,6 +1590,7 @@ EOF",
|
|
|
1583
1590
|
},
|
|
1584
1591
|
"app ๐ก audit": {
|
|
1585
1592
|
"allow_failure": true,
|
|
1593
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
1586
1594
|
"interruptible": true,
|
|
1587
1595
|
"needs": [],
|
|
1588
1596
|
"retry": {
|
|
@@ -22,6 +22,7 @@ exports[`matches snapshot 1`] = `
|
|
|
22
22
|
"policy": "pull-push",
|
|
23
23
|
},
|
|
24
24
|
],
|
|
25
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
25
26
|
"interruptible": true,
|
|
26
27
|
"needs": [],
|
|
27
28
|
"retry": {
|
|
@@ -352,6 +353,7 @@ _ALL_ENV_VAR_KEYS: '["ENV_SHORT","APP_DIR","ENV_TYPE","BUILD_INFO_ID","BUILD_INF
|
|
|
352
353
|
},
|
|
353
354
|
"www ๐ก audit": {
|
|
354
355
|
"allow_failure": true,
|
|
356
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
355
357
|
"interruptible": true,
|
|
356
358
|
"needs": [],
|
|
357
359
|
"retry": {
|
|
@@ -551,6 +553,7 @@ _ALL_ENV_VAR_KEYS: '["ENV_SHORT","APP_DIR","ENV_TYPE","BUILD_INFO_ID","BUILD_INF
|
|
|
551
553
|
"policy": "pull-push",
|
|
552
554
|
},
|
|
553
555
|
],
|
|
556
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
554
557
|
"interruptible": true,
|
|
555
558
|
"needs": [],
|
|
556
559
|
"retry": {
|
|
@@ -881,6 +884,7 @@ _ALL_ENV_VAR_KEYS: '["ENV_SHORT","APP_DIR","ENV_TYPE","BUILD_INFO_ID","BUILD_INF
|
|
|
881
884
|
},
|
|
882
885
|
"www ๐ก audit": {
|
|
883
886
|
"allow_failure": true,
|
|
887
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
884
888
|
"interruptible": true,
|
|
885
889
|
"needs": [],
|
|
886
890
|
"retry": {
|
|
@@ -22,6 +22,7 @@ exports[`matches snapshot 1`] = `
|
|
|
22
22
|
"policy": "pull-push",
|
|
23
23
|
},
|
|
24
24
|
],
|
|
25
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
25
26
|
"interruptible": true,
|
|
26
27
|
"needs": [],
|
|
27
28
|
"retry": {
|
|
@@ -181,6 +182,7 @@ exports[`matches snapshot 1`] = `
|
|
|
181
182
|
},
|
|
182
183
|
"api ๐ก audit": {
|
|
183
184
|
"allow_failure": true,
|
|
185
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
184
186
|
"interruptible": true,
|
|
185
187
|
"needs": [],
|
|
186
188
|
"retry": {
|
|
@@ -308,6 +310,7 @@ exports[`matches snapshot 1`] = `
|
|
|
308
310
|
"policy": "pull-push",
|
|
309
311
|
},
|
|
310
312
|
],
|
|
313
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
311
314
|
"interruptible": true,
|
|
312
315
|
"needs": [],
|
|
313
316
|
"retry": {
|
|
@@ -471,6 +474,7 @@ exports[`matches snapshot 1`] = `
|
|
|
471
474
|
},
|
|
472
475
|
"www ๐ก audit": {
|
|
473
476
|
"allow_failure": true,
|
|
477
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
474
478
|
"interruptible": true,
|
|
475
479
|
"needs": [],
|
|
476
480
|
"retry": {
|
|
@@ -670,6 +674,7 @@ exports[`matches snapshot 1`] = `
|
|
|
670
674
|
"policy": "pull-push",
|
|
671
675
|
},
|
|
672
676
|
],
|
|
677
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
673
678
|
"interruptible": true,
|
|
674
679
|
"needs": [],
|
|
675
680
|
"retry": {
|
|
@@ -829,6 +834,7 @@ exports[`matches snapshot 1`] = `
|
|
|
829
834
|
},
|
|
830
835
|
"api ๐ก audit": {
|
|
831
836
|
"allow_failure": true,
|
|
837
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
832
838
|
"interruptible": true,
|
|
833
839
|
"needs": [],
|
|
834
840
|
"retry": {
|
|
@@ -956,6 +962,7 @@ exports[`matches snapshot 1`] = `
|
|
|
956
962
|
"policy": "pull-push",
|
|
957
963
|
},
|
|
958
964
|
],
|
|
965
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
959
966
|
"interruptible": true,
|
|
960
967
|
"needs": [],
|
|
961
968
|
"retry": {
|
|
@@ -1119,6 +1126,7 @@ exports[`matches snapshot 1`] = `
|
|
|
1119
1126
|
},
|
|
1120
1127
|
"www ๐ก audit": {
|
|
1121
1128
|
"allow_failure": true,
|
|
1129
|
+
"image": "path/to/docker/jobs-default:the-version",
|
|
1122
1130
|
"interruptible": true,
|
|
1123
1131
|
"needs": [],
|
|
1124
1132
|
"retry": {
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`createArtifactsConfig merges junit files if both given 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"artifacts": {
|
|
6
|
+
"paths": [
|
|
7
|
+
"testpath",
|
|
8
|
+
],
|
|
9
|
+
"reports": {
|
|
10
|
+
"junit": [
|
|
11
|
+
"partial-report.xml",
|
|
12
|
+
"full-report.xml",
|
|
13
|
+
],
|
|
14
|
+
"terraform": "something",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
exports[`createArtifactsConfig returns artifacts if no artifactsReports 1`] = `
|
|
21
|
+
{
|
|
22
|
+
"artifacts": {
|
|
23
|
+
"paths": [
|
|
24
|
+
"testpath",
|
|
25
|
+
],
|
|
26
|
+
"reports": {
|
|
27
|
+
"coverage_report": {
|
|
28
|
+
"coverage_format": "cobertura",
|
|
29
|
+
"path": "some",
|
|
30
|
+
},
|
|
31
|
+
"junit": [],
|
|
32
|
+
"terraform": "something",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
exports[`createArtifactsConfig returns junit parts of artifactsReports 1`] = `
|
|
39
|
+
{
|
|
40
|
+
"artifacts": {
|
|
41
|
+
"paths": [],
|
|
42
|
+
"reports": {
|
|
43
|
+
"junit": [
|
|
44
|
+
"report.xml",
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createArtifactsConfig } from "../createArtifactsConfig";
|
|
2
|
+
|
|
3
|
+
describe("createArtifactsConfig", () => {
|
|
4
|
+
it("returns undefined if no artifacts or artifactsReports", () => {
|
|
5
|
+
expect(createArtifactsConfig(".")).toBeUndefined();
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it("returns artifacts if no artifactsReports", () => {
|
|
9
|
+
expect(
|
|
10
|
+
createArtifactsConfig(".", undefined, {
|
|
11
|
+
paths: ["testpath"],
|
|
12
|
+
reports: {
|
|
13
|
+
coverage_report: { coverage_format: "cobertura", path: "some" },
|
|
14
|
+
terraform: "something",
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("returns junit parts of artifactsReports", () => {
|
|
21
|
+
expect(
|
|
22
|
+
createArtifactsConfig(".", { junit: ["report.xml"] })
|
|
23
|
+
).toMatchSnapshot();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("merges junit files if both given", () => {
|
|
27
|
+
const result = createArtifactsConfig(
|
|
28
|
+
".",
|
|
29
|
+
{ junit: ["partial-report.xml"] },
|
|
30
|
+
{
|
|
31
|
+
paths: ["testpath"],
|
|
32
|
+
reports: {
|
|
33
|
+
junit: "full-report.xml",
|
|
34
|
+
terraform: "something",
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
expect(result).toMatchSnapshot();
|
|
39
|
+
expect(result?.artifacts?.reports?.junit).toHaveLength(2);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
import type { BuildConfigArtifactsReports } from "../types";
|
|
3
|
+
import type { Artifacts } from "../../types";
|
|
4
|
+
import type { OptionalArtifacts } from "../custom/testJob";
|
|
5
|
+
|
|
6
|
+
export const createArtifactsConfig = (
|
|
7
|
+
rootPath: string,
|
|
8
|
+
artifactsReports?: BuildConfigArtifactsReports,
|
|
9
|
+
artifacts?: Artifacts
|
|
10
|
+
): OptionalArtifacts =>
|
|
11
|
+
artifactsReports || artifacts
|
|
12
|
+
? {
|
|
13
|
+
artifacts: {
|
|
14
|
+
paths: [],
|
|
15
|
+
...artifacts,
|
|
16
|
+
reports: {
|
|
17
|
+
...artifacts?.reports,
|
|
18
|
+
junit: [
|
|
19
|
+
artifactsReports?.junit,
|
|
20
|
+
Array.isArray(artifacts?.reports?.junit) &&
|
|
21
|
+
artifacts?.reports?.junit,
|
|
22
|
+
typeof artifacts?.reports?.junit === "string" && [
|
|
23
|
+
artifacts?.reports?.junit,
|
|
24
|
+
],
|
|
25
|
+
]
|
|
26
|
+
.filter(Array.isArray)
|
|
27
|
+
.reduce(
|
|
28
|
+
(acc, curr) => [...acc, ...curr.map((p) => join(rootPath, p))],
|
|
29
|
+
[]
|
|
30
|
+
),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
: undefined;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Context } from "../../..";
|
|
2
|
+
import { createCustomTestJobs } from "../testJob";
|
|
3
|
+
|
|
4
|
+
describe("createCustomTestJobs", () => {
|
|
5
|
+
const componentConfig: Context["componentConfig"] = {
|
|
6
|
+
dir: ".",
|
|
7
|
+
build: { type: "custom", docker: { type: "custom" }, jobImage: "" },
|
|
8
|
+
deploy: {},
|
|
9
|
+
} as Context["componentConfig"];
|
|
10
|
+
const baseContext: Context = {
|
|
11
|
+
componentName: "testComponent",
|
|
12
|
+
environment: {
|
|
13
|
+
jobOnlyVars: {
|
|
14
|
+
build: {},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
componentConfig,
|
|
18
|
+
} as Context;
|
|
19
|
+
|
|
20
|
+
it("throws error when not build type custom", () => {
|
|
21
|
+
componentConfig.build.type = "node";
|
|
22
|
+
expect(() => createCustomTestJobs(baseContext)).toThrowError(
|
|
23
|
+
"deploy config is not custom"
|
|
24
|
+
);
|
|
25
|
+
componentConfig.build.type = "custom";
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("returns empty array if no audit, lint, and test definition", () => {
|
|
29
|
+
const jobs = createCustomTestJobs(baseContext);
|
|
30
|
+
expect(jobs).toEqual([]);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { join } from "path";
|
|
2
1
|
import type { Context } from "../../types/context";
|
|
3
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
4
3
|
import { ensureArray, notNil } from "../../utils";
|
|
5
4
|
import { isOfBuildType } from "../types";
|
|
6
|
-
import type { BuildConfigArtifactsReports } from "../types";
|
|
7
5
|
import type { Artifacts } from "../../types";
|
|
6
|
+
import { createArtifactsConfig } from "../base/createArtifactsConfig";
|
|
8
7
|
|
|
9
8
|
const RUNNER_CUSTOM_TEST_VARIABLES = {
|
|
10
9
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
@@ -48,7 +47,8 @@ export const createCustomTestJobs = (context: Context): CatladderJob[] => {
|
|
|
48
47
|
allow_failure: true,
|
|
49
48
|
...createArtifactsConfig(
|
|
50
49
|
context.componentConfig.dir,
|
|
51
|
-
buildConfig.audit?.artifactsReports
|
|
50
|
+
buildConfig.audit?.artifactsReports,
|
|
51
|
+
buildConfig.audit?.artifacts
|
|
52
52
|
),
|
|
53
53
|
}
|
|
54
54
|
: null;
|
|
@@ -62,7 +62,8 @@ export const createCustomTestJobs = (context: Context): CatladderJob[] => {
|
|
|
62
62
|
script: [...(ensureArray(buildConfig.lint?.command) ?? [])],
|
|
63
63
|
...createArtifactsConfig(
|
|
64
64
|
context.componentConfig.dir,
|
|
65
|
-
buildConfig.lint?.artifactsReports
|
|
65
|
+
buildConfig.lint?.artifactsReports,
|
|
66
|
+
buildConfig.lint?.artifacts
|
|
66
67
|
),
|
|
67
68
|
}
|
|
68
69
|
: null;
|
|
@@ -75,30 +76,16 @@ export const createCustomTestJobs = (context: Context): CatladderJob[] => {
|
|
|
75
76
|
script: [...(ensureArray(buildConfig.test?.command) ?? [])],
|
|
76
77
|
...createArtifactsConfig(
|
|
77
78
|
context.componentConfig.dir,
|
|
78
|
-
buildConfig.test?.artifactsReports
|
|
79
|
+
buildConfig.test?.artifactsReports,
|
|
80
|
+
buildConfig.test?.artifacts
|
|
79
81
|
),
|
|
80
82
|
}
|
|
81
83
|
: null;
|
|
82
84
|
return [auditJob, lintJob, testJob].filter(notNil);
|
|
83
85
|
};
|
|
84
86
|
|
|
85
|
-
type OptionalArtifacts =
|
|
87
|
+
export type OptionalArtifacts =
|
|
86
88
|
| {
|
|
87
89
|
artifacts: Artifacts;
|
|
88
90
|
}
|
|
89
91
|
| undefined;
|
|
90
|
-
|
|
91
|
-
const createArtifactsConfig = (
|
|
92
|
-
rootPath: string,
|
|
93
|
-
artifactsReports?: BuildConfigArtifactsReports
|
|
94
|
-
): OptionalArtifacts =>
|
|
95
|
-
artifactsReports
|
|
96
|
-
? {
|
|
97
|
-
artifacts: {
|
|
98
|
-
paths: [],
|
|
99
|
-
reports: {
|
|
100
|
-
junit: artifactsReports?.junit?.map((p) => join(rootPath, p)) ?? [],
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
}
|
|
104
|
-
: undefined;
|
|
@@ -5,6 +5,7 @@ import { ensureArray, notNil } from "../../utils";
|
|
|
5
5
|
import { getNodeCache } from "./cache";
|
|
6
6
|
import { NODE_RUNNER_BUILD_VARIABLES } from "./constants";
|
|
7
7
|
import { getYarnInstall } from "./yarn";
|
|
8
|
+
import { createArtifactsConfig } from "../base/createArtifactsConfig";
|
|
8
9
|
|
|
9
10
|
export const createNodeTestJobs = (context: Context): CatladderJob[] => {
|
|
10
11
|
// don't run tests after release
|
|
@@ -13,7 +14,7 @@ export const createNodeTestJobs = (context: Context): CatladderJob[] => {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const buildConfig = context.componentConfig.build;
|
|
16
|
-
|
|
17
|
+
const defaultImage = getRunnerImage("jobs-default");
|
|
17
18
|
const base: Omit<CatladderJob, "script" | "name"> = {
|
|
18
19
|
variables: {
|
|
19
20
|
APP_PATH: context.componentConfig.dir,
|
|
@@ -30,8 +31,8 @@ export const createNodeTestJobs = (context: Context): CatladderJob[] => {
|
|
|
30
31
|
buildConfig.audit !== false
|
|
31
32
|
? {
|
|
32
33
|
name: "๐ก audit",
|
|
33
|
-
|
|
34
34
|
...base,
|
|
35
|
+
image: buildConfig.audit?.jobImage ?? defaultImage,
|
|
35
36
|
cache: undefined, // audit does not need yarn install and no cache
|
|
36
37
|
script: [
|
|
37
38
|
`cd ${context.componentConfig.dir}`,
|
|
@@ -42,6 +43,11 @@ export const createNodeTestJobs = (context: Context): CatladderJob[] => {
|
|
|
42
43
|
]),
|
|
43
44
|
],
|
|
44
45
|
allow_failure: true,
|
|
46
|
+
...createArtifactsConfig(
|
|
47
|
+
context.componentConfig.dir,
|
|
48
|
+
buildConfig.audit?.artifactsReports,
|
|
49
|
+
buildConfig.audit?.artifacts
|
|
50
|
+
),
|
|
45
51
|
}
|
|
46
52
|
: null;
|
|
47
53
|
|
|
@@ -49,14 +55,19 @@ export const createNodeTestJobs = (context: Context): CatladderJob[] => {
|
|
|
49
55
|
buildConfig.lint !== false
|
|
50
56
|
? {
|
|
51
57
|
name: "๐ฎ lint",
|
|
52
|
-
|
|
53
58
|
...base,
|
|
59
|
+
image: buildConfig.lint?.jobImage ?? defaultImage,
|
|
54
60
|
cache: getNodeCache(context),
|
|
55
61
|
script: [
|
|
56
62
|
`cd ${context.componentConfig.dir}`,
|
|
57
63
|
...yarnInstall,
|
|
58
64
|
...(ensureArray(buildConfig.lint?.command) ?? ["yarn lint"]),
|
|
59
65
|
],
|
|
66
|
+
...createArtifactsConfig(
|
|
67
|
+
context.componentConfig.dir,
|
|
68
|
+
buildConfig.lint?.artifactsReports,
|
|
69
|
+
buildConfig.lint?.artifacts
|
|
70
|
+
),
|
|
60
71
|
}
|
|
61
72
|
: null;
|
|
62
73
|
const testJob: CatladderJob | null =
|
|
@@ -65,13 +76,19 @@ export const createNodeTestJobs = (context: Context): CatladderJob[] => {
|
|
|
65
76
|
name: "๐งช test",
|
|
66
77
|
|
|
67
78
|
...base,
|
|
68
|
-
image:
|
|
79
|
+
image:
|
|
80
|
+
buildConfig.test?.jobImage ?? getRunnerImage("jobs-testing-chrome"),
|
|
69
81
|
cache: getNodeCache(context),
|
|
70
82
|
script: [
|
|
71
83
|
`cd ${context.componentConfig.dir}`,
|
|
72
84
|
...yarnInstall,
|
|
73
85
|
...(ensureArray(buildConfig.test?.command) ?? ["yarn test"]),
|
|
74
86
|
],
|
|
87
|
+
...createArtifactsConfig(
|
|
88
|
+
context.componentConfig.dir,
|
|
89
|
+
buildConfig.test?.artifactsReports,
|
|
90
|
+
buildConfig.test?.artifacts
|
|
91
|
+
),
|
|
75
92
|
}
|
|
76
93
|
: null;
|
|
77
94
|
return [auditJob, lintJob, testJob].filter(notNil);
|