Skip to content

Commit

Permalink
csmock-snyk-plugin: no supported projects fix
Browse files Browse the repository at this point in the history
Fix: https://issues.redhat.com/browse/OSH-329

If no supported project is detected using the snyk plugin, it no longer crashes but it does return 0
  • Loading branch information
jperezdealgaba authored Oct 10, 2023
1 parent e1a8936 commit 73cf7c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion py/plugins/snyk.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ def scan_hook(results, mock, props):
mock.exec_chroot_cmd("/bin/rm -fv %s" % auth_token_dst)

# check exit code of snyk code itself
if ec not in [0, 1]:
if ec == 3:
# If there are no supported project, we just return a successful scan without results
results.print_with_ts("snyk-code: no supported projects detected")
return 0
elif ec not in [0, 1]:
results.error("snyk code returned unexpected exit status: %d" % ec, ec=ec)

# returning non-zero would prevent csmock from archiving SNYK_LOG
Expand Down

0 comments on commit 73cf7c7

Please sign in to comment.