From 644b42c9144e19264037ac9f6e37013938da0631 Mon Sep 17 00:00:00 2001 From: Daniele Santos Date: Mon, 20 Nov 2023 18:06:24 -0500 Subject: [PATCH] capture exit code for sarif --- 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{}))