From 0e031822391e0038589ec0b4e33efb212ff55621 Mon Sep 17 00:00:00 2001 From: Chuck Ha Date: Tue, 3 Jul 2018 17:42:39 -0400 Subject: [PATCH] Return a non-zero status code for failed plugins Fixes #404 Signed-off-by: Chuck Ha --- cmd/sonobuoy/app/status.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/sonobuoy/app/status.go b/cmd/sonobuoy/app/status.go index 41faedfcb..68e0a770c 100644 --- a/cmd/sonobuoy/app/status.go +++ b/cmd/sonobuoy/app/status.go @@ -80,10 +80,21 @@ func getStatus(cmd *cobra.Command, args []string) { } else { err = printSummary(os.Stdout, status) } + if err != nil { errlog.LogError(err) os.Exit(1) } + os.Exit(exitCode(status)) +} + +func exitCode(status *aggregation.Status) int { + switch status.Status { + case aggregation.FailedStatus: + return 1 + default: + return 0 + } } func humanReadableStatus(str string) string {