@catladder/pipeline 3.39.0 → 3.40.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/custom/testJob.js +13 -11
  2. package/dist/build/node/testJob.js +14 -12
  3. package/dist/build/rails/testJob.js +9 -7
  4. package/dist/build/types.d.ts +5 -0
  5. package/dist/constants.js +1 -1
  6. package/dist/deploy/cloudRun/createJobs/execute/onDeploy.js +13 -22
  7. package/dist/tsconfig.tsbuildinfo +1 -1
  8. package/examples/__snapshots__/automatic-releases.test.ts.snap +2 -2
  9. package/examples/__snapshots__/cloud-run-execute-script-on-deploy.test.ts.snap +2 -2
  10. package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +2 -2
  11. package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +2 -2
  12. package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +2 -2
  13. package/examples/__snapshots__/cloud-run-http2.test.ts.snap +2 -2
  14. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +2 -2
  15. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +2 -2
  16. package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +2 -2
  17. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +2 -2
  18. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +2 -2
  19. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +2 -2
  20. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +2 -2
  21. package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +2 -2
  22. package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +2 -2
  23. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +2 -2
  24. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +2 -2
  25. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +2 -2
  26. package/examples/__snapshots__/cloud-run-session-affinity.test.ts.snap +2 -2
  27. package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +2 -2
  28. package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +2 -2
  29. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +2 -2
  30. package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +2 -2
  31. package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +6 -6
  32. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +4 -4
  33. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +2 -2
  34. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +2 -2
  35. package/examples/__snapshots__/custom-deploy.test.ts.snap +2 -2
  36. package/examples/__snapshots__/custom-docker-file.test.ts.snap +2 -2
  37. package/examples/__snapshots__/custom-envs.test.ts.snap +4 -4
  38. package/examples/__snapshots__/custom-verify-job.test.ts.snap +2 -2
  39. package/examples/__snapshots__/git-submodule.test.ts.snap +2 -2
  40. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +2 -2
  41. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +2 -2
  42. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +4 -4
  43. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +2 -2
  44. package/examples/__snapshots__/local-dot-env.test.ts.snap +2 -2
  45. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +2 -2
  46. package/examples/__snapshots__/modify-generated-files.test.ts.snap +2 -2
  47. package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +2 -2
  48. package/examples/__snapshots__/multiline-var.test.ts.snap +6 -6
  49. package/examples/__snapshots__/native-app.test.ts.snap +4 -4
  50. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +2 -2
  51. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +2 -2
  52. package/examples/__snapshots__/override-secrets.test.ts.snap +2 -2
  53. package/examples/__snapshots__/referencing-other-vars.test.ts.snap +6 -6
  54. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +4 -4
  55. package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +2 -2
  56. package/examples/__snapshots__/workspace-api-www.test.ts.snap +2 -2
  57. package/examples/cloud-run-post-stop-job.ts +1 -1
  58. package/package.json +1 -1
  59. package/src/build/custom/__tests__/testJob.test.ts +70 -0
  60. package/src/build/custom/testJob.ts +3 -1
  61. package/src/build/node/testJob.ts +5 -3
  62. package/src/build/rails/testJob.ts +3 -1
  63. package/src/build/types.ts +6 -0
  64. package/src/deploy/cloudRun/createJobs/execute/onDeploy.ts +16 -25
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="api"
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd api
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -512,7 +512,7 @@ before_script:
512
512
  - export APP_PATH="api"
513
513
  - collapseable_section_end "injectvars"
514
514
  - cd api
515
- - yarn npm audit --environment production
515
+ - yarn npm audit --environment production --level critical
516
516
  rules:
517
517
  - when: never
518
518
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="app"
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd app
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -627,7 +627,7 @@ before_script:
627
627
  - export APP_PATH="app"
628
628
  - collapseable_section_end "injectvars"
629
629
  - cd app
630
- - yarn npm audit --environment production
630
+ - yarn npm audit --environment production --level critical
631
631
  rules:
632
632
  - when: never
633
633
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="api"
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd api
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -317,7 +317,7 @@ before_script:
317
317
  - export APP_PATH="api"
318
318
  - collapseable_section_end "injectvars"
319
319
  - cd api
320
- - yarn npm audit --environment production
320
+ - yarn npm audit --environment production --level critical
321
321
  rules:
322
322
  - when: never
323
323
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="api"
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd api
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -317,7 +317,7 @@ before_script:
317
317
  - export APP_PATH="api"
318
318
  - collapseable_section_end "injectvars"
319
319
  - cd api
320
- - yarn npm audit --environment production
320
+ - yarn npm audit --environment production --level critical
321
321
  rules:
322
322
  - when: never
323
323
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="app1"
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd app1
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -578,7 +578,7 @@ before_script:
578
578
  - export APP_PATH="app1"
579
579
  - collapseable_section_end "injectvars"
580
580
  - cd app1
581
- - yarn npm audit --environment production
581
+ - yarn npm audit --environment production --level critical
582
582
  rules:
583
583
  - when: never
584
584
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -1764,7 +1764,7 @@ before_script:
1764
1764
  - export APP_PATH="app2"
1765
1765
  - collapseable_section_end "injectvars"
1766
1766
  - cd app2
1767
- - yarn npm audit --environment production
1767
+ - yarn npm audit --environment production --level critical
1768
1768
  rules:
1769
1769
  - when: never
1770
1770
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -2246,7 +2246,7 @@ before_script:
2246
2246
  - export APP_PATH="app2"
2247
2247
  - collapseable_section_end "injectvars"
2248
2248
  - cd app2
2249
- - yarn npm audit --environment production
2249
+ - yarn npm audit --environment production --level critical
2250
2250
  rules:
2251
2251
  - when: never
2252
2252
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -3492,7 +3492,7 @@ before_script:
3492
3492
  - export APP_PATH="kube"
3493
3493
  - collapseable_section_end "injectvars"
3494
3494
  - cd kube
3495
- - yarn npm audit --environment production
3495
+ - yarn npm audit --environment production --level critical
3496
3496
  rules:
3497
3497
  - when: never
3498
3498
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -4200,7 +4200,7 @@ before_script:
4200
4200
  - export APP_PATH="kube"
4201
4201
  - collapseable_section_end "injectvars"
4202
4202
  - cd kube
4203
- - yarn npm audit --environment production
4203
+ - yarn npm audit --environment production --level critical
4204
4204
  rules:
4205
4205
  - when: never
4206
4206
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -117,7 +117,7 @@ before_script:
117
117
  - export LANG="en_US.UTF-8"
118
118
  - collapseable_section_end "injectvars"
119
119
  - cd app
120
- - yarn npm audit --environment production
120
+ - yarn npm audit --environment production --level critical
121
121
  rules:
122
122
  - when: never
123
123
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -416,7 +416,7 @@ before_script:
416
416
  - export LANG="en_US.UTF-8"
417
417
  - collapseable_section_end "injectvars"
418
418
  - cd app
419
- - yarn npm audit --environment production
419
+ - yarn npm audit --environment production --level critical
420
420
  rules:
421
421
  - when: never
422
422
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -1090,7 +1090,7 @@ before_script:
1090
1090
  - export APP_PATH="api"
1091
1091
  - collapseable_section_end "injectvars"
1092
1092
  - cd api
1093
- - yarn npm audit --environment production
1093
+ - yarn npm audit --environment production --level critical
1094
1094
  rules:
1095
1095
  - when: never
1096
1096
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -1504,7 +1504,7 @@ before_script:
1504
1504
  - export APP_PATH="api"
1505
1505
  - collapseable_section_end "injectvars"
1506
1506
  - cd api
1507
- - yarn npm audit --environment production
1507
+ - yarn npm audit --environment production --level critical
1508
1508
  rules:
1509
1509
  - when: never
1510
1510
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="www"
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd www
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -530,7 +530,7 @@ before_script:
530
530
  - export APP_PATH="www"
531
531
  - collapseable_section_end "injectvars"
532
532
  - cd www
533
- - yarn npm audit --environment production
533
+ - yarn npm audit --environment production --level critical
534
534
  rules:
535
535
  - when: never
536
536
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="www"
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd www
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -532,7 +532,7 @@ before_script:
532
532
  - export APP_PATH="www"
533
533
  - collapseable_section_end "injectvars"
534
534
  - cd www
535
- - yarn npm audit --environment production
535
+ - yarn npm audit --environment production --level critical
536
536
  rules:
537
537
  - when: never
538
538
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="app"
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd app
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -535,7 +535,7 @@ before_script:
535
535
  - export APP_PATH="app"
536
536
  - collapseable_section_end "injectvars"
537
537
  - cd app
538
- - yarn npm audit --environment production
538
+ - yarn npm audit --environment production --level critical
539
539
  rules:
540
540
  - when: never
541
541
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="app1"
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd app1
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -555,7 +555,7 @@ before_script:
555
555
  - export APP_PATH="app1"
556
556
  - collapseable_section_end "injectvars"
557
557
  - cd app1
558
- - yarn npm audit --environment production
558
+ - yarn npm audit --environment production --level critical
559
559
  rules:
560
560
  - when: never
561
561
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -1672,7 +1672,7 @@ before_script:
1672
1672
  - export APP_PATH="app2"
1673
1673
  - collapseable_section_end "injectvars"
1674
1674
  - cd app2
1675
- - yarn npm audit --environment production
1675
+ - yarn npm audit --environment production --level critical
1676
1676
  rules:
1677
1677
  - when: never
1678
1678
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -2121,7 +2121,7 @@ before_script:
2121
2121
  - export APP_PATH="app2"
2122
2122
  - collapseable_section_end "injectvars"
2123
2123
  - cd app2
2124
- - yarn npm audit --environment production
2124
+ - yarn npm audit --environment production --level critical
2125
2125
  rules:
2126
2126
  - when: never
2127
2127
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -3268,7 +3268,7 @@ before_script:
3268
3268
  - export APP_PATH="kube"
3269
3269
  - collapseable_section_end "injectvars"
3270
3270
  - cd kube
3271
- - yarn npm audit --environment production
3271
+ - yarn npm audit --environment production --level critical
3272
3272
  rules:
3273
3273
  - when: never
3274
3274
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -3797,7 +3797,7 @@ before_script:
3797
3797
  - export APP_PATH="kube"
3798
3798
  - collapseable_section_end "injectvars"
3799
3799
  - cd kube
3800
- - yarn npm audit --environment production
3800
+ - yarn npm audit --environment production --level critical
3801
3801
  rules:
3802
3802
  - when: never
3803
3803
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="api"
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd api
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -368,7 +368,7 @@ before_script:
368
368
  - export APP_PATH="api"
369
369
  - collapseable_section_end "injectvars"
370
370
  - cd api
371
- - yarn npm audit --environment production
371
+ - yarn npm audit --environment production --level critical
372
372
  rules:
373
373
  - when: never
374
374
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -918,7 +918,7 @@ before_script:
918
918
  - export APP_PATH="www"
919
919
  - collapseable_section_end "injectvars"
920
920
  - cd www
921
- - yarn npm audit --environment production
921
+ - yarn npm audit --environment production --level critical
922
922
  rules:
923
923
  - when: never
924
924
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -1172,7 +1172,7 @@ before_script:
1172
1172
  - export APP_PATH="www"
1173
1173
  - collapseable_section_end "injectvars"
1174
1174
  - cd www
1175
- - yarn npm audit --environment production
1175
+ - yarn npm audit --environment production --level critical
1176
1176
  rules:
1177
1177
  - when: never
1178
1178
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="."
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd .
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -314,7 +314,7 @@ before_script:
314
314
  - export APP_PATH="."
315
315
  - collapseable_section_end "injectvars"
316
316
  - cd .
317
- - yarn npm audit --environment production
317
+ - yarn npm audit --environment production --level critical
318
318
  rules:
319
319
  - when: never
320
320
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -115,7 +115,7 @@ before_script:
115
115
  - export APP_PATH="."
116
116
  - collapseable_section_end "injectvars"
117
117
  - cd .
118
- - yarn npm audit --environment production
118
+ - yarn npm audit --environment production --level critical
119
119
  rules:
120
120
  - when: never
121
121
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -312,7 +312,7 @@ before_script:
312
312
  - export APP_PATH="."
313
313
  - collapseable_section_end "injectvars"
314
314
  - cd .
315
- - yarn npm audit --environment production
315
+ - yarn npm audit --environment production --level critical
316
316
  rules:
317
317
  - when: never
318
318
  if: $CI_PIPELINE_SOURCE == "trigger"
@@ -29,7 +29,7 @@ const config = {
29
29
  },
30
30
  },
31
31
  execute: {
32
- ["drop-db"]: {
32
+ ["drop-db-on-stop"]: {
33
33
  type: "job",
34
34
  job: "drop-db",
35
35
  when: "postStop",
package/package.json CHANGED
@@ -53,7 +53,7 @@
53
53
  }
54
54
  ],
55
55
  "license": "MIT",
56
- "version": "3.39.0",
56
+ "version": "3.40.0",
57
57
  "scripts": {
58
58
  "build:tsc": "yarn tsc",
59
59
  "build": "yarn build:compile && yarn build:inline-variables",
@@ -27,4 +27,74 @@ describe("createCustomTestJobs", () => {
27
27
  const jobs = createCustomTestJobs(baseContext);
28
28
  expect(jobs).toEqual([]);
29
29
  });
30
+
31
+ it("sets allow_failure on audit job to true by default", () => {
32
+ const context = {
33
+ ...baseContext,
34
+ build: {
35
+ ...baseContext.build,
36
+ config: {
37
+ ...baseContext.build.config,
38
+ audit: { command: "audit-cmd" },
39
+ },
40
+ },
41
+ } as ComponentContext<BuildContextStandalone>;
42
+ const jobs = createCustomTestJobs(context);
43
+ const auditJob = jobs.find((j) => j.name.includes("audit"));
44
+ expect(auditJob?.allow_failure).toBe(true);
45
+ });
46
+
47
+ it("respects allowFailure: false on audit job", () => {
48
+ const context = {
49
+ ...baseContext,
50
+ build: {
51
+ ...baseContext.build,
52
+ config: {
53
+ ...baseContext.build.config,
54
+ audit: { command: "audit-cmd", allowFailure: false },
55
+ },
56
+ },
57
+ } as ComponentContext<BuildContextStandalone>;
58
+ const jobs = createCustomTestJobs(context);
59
+ const auditJob = jobs.find((j) => j.name.includes("audit"));
60
+ expect(auditJob?.allow_failure).toBe(false);
61
+ });
62
+
63
+ it("passes allowFailure through to lint and test jobs", () => {
64
+ const context = {
65
+ ...baseContext,
66
+ build: {
67
+ ...baseContext.build,
68
+ config: {
69
+ ...baseContext.build.config,
70
+ lint: { command: "lint-cmd", allowFailure: true },
71
+ test: { command: "test-cmd", allowFailure: true },
72
+ },
73
+ },
74
+ } as ComponentContext<BuildContextStandalone>;
75
+ const jobs = createCustomTestJobs(context);
76
+ const lintJob = jobs.find((j) => j.name.includes("lint"));
77
+ const testJob = jobs.find((j) => j.name.includes("test"));
78
+ expect(lintJob?.allow_failure).toBe(true);
79
+ expect(testJob?.allow_failure).toBe(true);
80
+ });
81
+
82
+ it("leaves allow_failure undefined on lint and test jobs when not configured", () => {
83
+ const context = {
84
+ ...baseContext,
85
+ build: {
86
+ ...baseContext.build,
87
+ config: {
88
+ ...baseContext.build.config,
89
+ lint: { command: "lint-cmd" },
90
+ test: { command: "test-cmd" },
91
+ },
92
+ },
93
+ } as ComponentContext<BuildContextStandalone>;
94
+ const jobs = createCustomTestJobs(context);
95
+ const lintJob = jobs.find((j) => j.name.includes("lint"));
96
+ const testJob = jobs.find((j) => j.name.includes("test"));
97
+ expect(lintJob?.allow_failure).toBeUndefined();
98
+ expect(testJob?.allow_failure).toBeUndefined();
99
+ });
30
100
  });
@@ -48,7 +48,7 @@ export const createCustomTestJobs = (
48
48
  image: buildConfig.audit?.jobImage ?? buildConfig.jobImage,
49
49
  cache: undefined,
50
50
  script: [...ensureArray(buildConfig.audit?.command)],
51
- allow_failure: true,
51
+ allow_failure: buildConfig.audit?.allowFailure ?? true,
52
52
  ...createArtifactsConfig(
53
53
  context.build.dir,
54
54
  buildConfig.audit?.artifactsReports,
@@ -68,6 +68,7 @@ export const createCustomTestJobs = (
68
68
  },
69
69
  image: buildConfig.lint?.jobImage ?? buildConfig.jobImage,
70
70
  script: [...ensureArray(buildConfig.lint?.command)],
71
+ allow_failure: buildConfig.lint?.allowFailure,
71
72
  ...createArtifactsConfig(
72
73
  context.build.dir,
73
74
  buildConfig.lint?.artifactsReports,
@@ -86,6 +87,7 @@ export const createCustomTestJobs = (
86
87
  },
87
88
  image: buildConfig.test?.jobImage ?? buildConfig.jobImage,
88
89
  script: [...ensureArray(buildConfig.test?.command)],
90
+ allow_failure: buildConfig.test?.allowFailure,
89
91
  ...createArtifactsConfig(
90
92
  context.build.dir,
91
93
  buildConfig.test?.artifactsReports,
@@ -59,11 +59,11 @@ export const createNodeTestJobs = (
59
59
  `cd ${context.build.dir}`,
60
60
  ...(ensureArrayOrNull(buildConfig.audit?.command) ?? [
61
61
  context.packageManagerInfo.isClassic
62
- ? "yarn audit"
63
- : "yarn npm audit --environment production", // yarn 2
62
+ ? "yarn audit --level critical"
63
+ : "yarn npm audit --environment production --level critical", // yarn 2
64
64
  ]),
65
65
  ],
66
- allow_failure: true,
66
+ allow_failure: buildConfig.audit?.allowFailure ?? true,
67
67
  ...createArtifactsConfig(
68
68
  context.build.dir,
69
69
  buildConfig.audit?.artifactsReports,
@@ -88,6 +88,7 @@ export const createNodeTestJobs = (
88
88
  ...yarnInstall,
89
89
  ...(ensureArrayOrNull(buildConfig.lint?.command) ?? ["yarn lint"]),
90
90
  ],
91
+ allow_failure: buildConfig.lint?.allowFailure,
91
92
  ...createArtifactsConfig(
92
93
  context.build.dir,
93
94
  buildConfig.lint?.artifactsReports,
@@ -114,6 +115,7 @@ export const createNodeTestJobs = (
114
115
  ...yarnInstall,
115
116
  ...(ensureArrayOrNull(buildConfig.test?.command) ?? ["yarn test"]),
116
117
  ],
118
+ allow_failure: buildConfig.test?.allowFailure,
117
119
  ...createArtifactsConfig(
118
120
  context.build.dir,
119
121
  buildConfig.test?.artifactsReports,
@@ -57,7 +57,7 @@ export const createRailsTestJobs = (
57
57
  "bundle audit check",
58
58
  ]),
59
59
  ],
60
- allow_failure: true,
60
+ allow_failure: buildConfig.audit?.allowFailure ?? true,
61
61
  }
62
62
  : null;
63
63
 
@@ -77,6 +77,7 @@ export const createRailsTestJobs = (
77
77
  "bundle exec rubocop",
78
78
  ]),
79
79
  ],
80
+ allow_failure: buildConfig.lint?.allowFailure,
80
81
  }
81
82
  : null;
82
83
  const testJob: CatladderJob | null =
@@ -97,6 +98,7 @@ export const createRailsTestJobs = (
97
98
  "bundle exec rspec",
98
99
  ]),
99
100
  ],
101
+ allow_failure: buildConfig.test?.allowFailure,
100
102
  runnerVariables: {
101
103
  RAILS_ENV: "test",
102
104
  DATABASE_URL: "postgresql://postgres@database",
@@ -81,6 +81,12 @@ export type TestJobCustom = {
81
81
  * additional vars for this job runner
82
82
  */
83
83
  runnerVariables?: Record<string, string>;
84
+
85
+ /**
86
+ * Whether the job is allowed to fail without blocking the pipeline.
87
+ * Defaults to `true` for audit jobs, `undefined` (not set) for lint and test jobs.
88
+ */
89
+ allowFailure?: boolean;
84
90
  };
85
91
 
86
92
  export type BuildConfigBase = {
@@ -13,10 +13,9 @@ import {
13
13
  getCommonCloudRunArgs,
14
14
  } from "../common";
15
15
 
16
- type Execute = {
17
- jobName: StringOrBashExpression;
18
- config: DeployConfigCloudRunExecuteOnDeploy | DeployConfigBaseExecuteOnDeploy;
19
- };
16
+ type Execute =
17
+ | DeployConfigCloudRunExecuteOnDeploy
18
+ | DeployConfigBaseExecuteOnDeploy;
20
19
  export const getOnDeployExecuteScript = (
21
20
  context: ComponentContext,
22
21
  when: DeployConfigCloudRunExecuteOnDeploy["when"],
@@ -24,7 +23,7 @@ export const getOnDeployExecuteScript = (
24
23
  const executes = getExecutes(context);
25
24
 
26
25
  return executes
27
- .filter(({ config }) => config.when === when)
26
+ .filter((config) => config.when === when)
28
27
  .flatMap((execute) => {
29
28
  return getJobRunScriptForExecute(context, execute);
30
29
  });
@@ -39,12 +38,7 @@ const getExecutes = (context: ComponentContext): Execute[] => {
39
38
  if (!value) {
40
39
  return [];
41
40
  }
42
- return [
43
- {
44
- jobName: key,
45
- config: value,
46
- } as Execute,
47
- ];
41
+ return [value as Execute];
48
42
  }),
49
43
  ];
50
44
  };
@@ -61,25 +55,22 @@ const getLegacyExecutes = (context: ComponentContext): Execute[] => {
61
55
  }
62
56
  return [
63
57
  {
64
- jobName,
65
- config: {
66
- job: jobName,
67
- type: "job",
68
- when: job.when,
69
- ...(job.when === "preDeploy" || job.when === "postDeploy"
70
- ? {
71
- waitForCompletion: job.waitForCompletion,
72
- }
73
- : {}),
74
- } as Execute["config"],
75
- },
58
+ job: jobName,
59
+ type: "job",
60
+ when: job.when,
61
+ ...(job.when === "preDeploy" || job.when === "postDeploy"
62
+ ? {
63
+ waitForCompletion: job.waitForCompletion,
64
+ }
65
+ : {}),
66
+ } as Execute,
76
67
  ];
77
68
  });
78
69
  };
79
70
 
80
71
  const getJobRunScriptForExecute = (
81
72
  context: ComponentContext,
82
- { jobName, config }: Execute,
73
+ config: Execute,
83
74
  ): string[] => {
84
75
  const type = config.type;
85
76
  if (type === "script") {
@@ -100,7 +91,7 @@ const getJobRunScriptForExecute = (
100
91
  wait: waitForCompletion === true ? true : undefined,
101
92
  args: getCloudRunServiceOrJobArgsArg(config.args),
102
93
  });
103
- const fullJobName = getFullJobName(context, jobName);
94
+ const fullJobName = getFullJobName(context, config.job);
104
95
  return [
105
96
  `${gcloudRunCmd()} jobs execute ${fullJobName.toString()} ${argString}`,
106
97
  ];