File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -805,6 +805,8 @@ functions:
805
805
return_code=$?
806
806
set -e
807
807
808
+ echo
809
+
808
810
# Runs for all the commits on main, including nightly builds:
809
811
if [[ "$EVERGREEN_IS_PATCH" != "true" ]] && [[ "${project}" == "10gen-compass-main" ]]; then
810
812
export JIRA_BASE_URL="https://jira.mongodb.org"
@@ -816,6 +818,8 @@ functions:
816
818
cat .sbom/vulnerability-report.md
817
819
fi
818
820
821
+ echo
822
+
819
823
# Fails if the report failed and is not a patch, including release branches:
820
824
if [[ "$EVERGREEN_IS_PATCH" != "true" ]]; then
821
825
exit $return_code
Original file line number Diff line number Diff line change @@ -6,12 +6,25 @@ const { glob } = require('glob');
6
6
const { promisify } = require ( 'util' ) ;
7
7
const execFile = promisify ( childProcess . execFile ) ;
8
8
9
+ async function fileExists ( filePath ) {
10
+ try {
11
+ await fs . access ( filePath ) ;
12
+ return true ;
13
+ } catch {
14
+ return false ;
15
+ }
16
+ }
17
+
9
18
async function snykTest ( cwd ) {
10
19
const tmpPath = path . join ( os . tmpdir ( ) , 'tempfile-' + Date . now ( ) ) ;
11
20
12
21
let execErr ;
13
22
14
23
try {
24
+ if ( ! ( await fileExists ( path . join ( cwd , `package.json` ) ) ) ) {
25
+ return ;
26
+ }
27
+
15
28
console . info ( `testing ${ cwd } ...` ) ;
16
29
await fs . mkdir ( path . join ( cwd , `node_modules` ) , { recursive : true } ) ;
17
30
@@ -26,7 +39,10 @@ async function snykTest(cwd) {
26
39
'--dev' ,
27
40
`--json-file-output=${ tmpPath } ` ,
28
41
] ,
29
- { cwd }
42
+ {
43
+ cwd,
44
+ maxBuffer : 50 /* MB */ * 1024 * 1024 , // default is 1 MB
45
+ }
30
46
) ;
31
47
} catch ( err ) {
32
48
execErr = err ;
@@ -36,9 +52,8 @@ async function snykTest(cwd) {
36
52
console . info ( `testing ${ cwd } done.` ) ;
37
53
return res ;
38
54
} catch ( err ) {
39
- console . error (
40
- `testing ${ cwd } failed. ${ err . message } . Exec error: ${ execErr } `
41
- ) ;
55
+ console . error ( `Snyk failed to create a json report for ${ cwd } :` , execErr ) ;
56
+ throw new Error ( `Testing ${ cwd } failed.` ) ;
42
57
} finally {
43
58
try {
44
59
await fs . rm ( tmpPath ) ;
You can’t perform that action at this time.
0 commit comments