diff --git a/cmd/commands/root.go b/cmd/commands/root.go index a599baa0..bd5f6c75 100644 --- a/cmd/commands/root.go +++ b/cmd/commands/root.go @@ -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{}))