From db8a302e2cb2ca977bedbab3c6b86dfc8142cfd6 Mon Sep 17 00:00:00 2001 From: Dani Santos Date: Mon, 27 Nov 2023 09:59:51 -0500 Subject: [PATCH] capture exit code for sarif (#576) --- cmd/commands/root.go | 4 ++++ 1 file changed, 4 insertions(+) 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{}))