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:
805805 return_code=$?
806806 set -e
807807
808+ echo
809+
808810 # Runs for all the commits on main, including nightly builds:
809811 if [[ "$EVERGREEN_IS_PATCH" != "true" ]] && [[ "${project}" == "10gen-compass-main" ]]; then
810812 export JIRA_BASE_URL="https://jira.mongodb.org"
@@ -816,6 +818,8 @@ functions:
816818 cat .sbom/vulnerability-report.md
817819 fi
818820
821+ echo
822+
819823 # Fails if the report failed and is not a patch, including release branches:
820824 if [[ "$EVERGREEN_IS_PATCH" != "true" ]]; then
821825 exit $return_code
Original file line number Diff line number Diff line change @@ -6,12 +6,25 @@ const { glob } = require('glob');
66const { promisify } = require ( 'util' ) ;
77const execFile = promisify ( childProcess . execFile ) ;
88
9+ async function fileExists ( filePath ) {
10+ try {
11+ await fs . access ( filePath ) ;
12+ return true ;
13+ } catch {
14+ return false ;
15+ }
16+ }
17+
918async function snykTest ( cwd ) {
1019 const tmpPath = path . join ( os . tmpdir ( ) , 'tempfile-' + Date . now ( ) ) ;
1120
1221 let execErr ;
1322
1423 try {
24+ if ( ! ( await fileExists ( path . join ( cwd , `package.json` ) ) ) ) {
25+ return ;
26+ }
27+
1528 console . info ( `testing ${ cwd } ...` ) ;
1629 await fs . mkdir ( path . join ( cwd , `node_modules` ) , { recursive : true } ) ;
1730
@@ -26,7 +39,10 @@ async function snykTest(cwd) {
2639 '--dev' ,
2740 `--json-file-output=${ tmpPath } ` ,
2841 ] ,
29- { cwd }
42+ {
43+ cwd,
44+ maxBuffer : 50 /* MB */ * 1024 * 1024 , // default is 1 MB
45+ }
3046 ) ;
3147 } catch ( err ) {
3248 execErr = err ;
@@ -36,9 +52,8 @@ async function snykTest(cwd) {
3652 console . info ( `testing ${ cwd } done.` ) ;
3753 return res ;
3854 } 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.` ) ;
4257 } finally {
4358 try {
4459 await fs . rm ( tmpPath ) ;
You can’t perform that action at this time.
0 commit comments