Skip to content

Commit

Permalink
capture exit code for sarif (#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-santos-code committed Nov 27, 2023
1 parent 538937d commit db8a302
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ func runAudit(auditable ...kubeaudit.Auditable) func(cmd *cobra.Command, args []
log.WithError(err).Fatal("Error generating the SARIF output")
}
sarifReport.PrettyWrite(os.Stdout)

if report.HasErrors() {
os.Exit(rootConfig.exitCode)
}
return
case "json":
printOptions = append(printOptions, kubeaudit.WithFormatter(&log.JSONFormatter{}))
Expand Down

0 comments on commit db8a302

Please sign in to comment.