From afc3b5efb9b43683963b211cd01ff82a0b308357 Mon Sep 17 00:00:00 2001 From: Sandro Schifferle Date: Wed, 20 Jul 2022 15:59:17 +0200 Subject: [PATCH 1/2] Switch from WARN to ERROR if errors exists Otherwise nobody understands the log why the build is failed if there are only warnings. --- kubeval/output.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubeval/output.go b/kubeval/output.go index f652cb1..a0be079 100644 --- a/kubeval/output.go +++ b/kubeval/output.go @@ -61,7 +61,7 @@ func newSTDOutputManager() *STDOutputManager { func (s *STDOutputManager) Put(result ValidationResult) error { if len(result.Errors) > 0 { for _, desc := range result.Errors { - kLog.Warn(result.FileName, "contains an invalid", result.Kind, fmt.Sprintf("(%s)", result.QualifiedName()), "-", desc.String()) + kLog.Error(result.FileName, "contains an invalid", result.Kind, fmt.Sprintf("(%s)", result.QualifiedName()), "-", desc.String()) } } else if result.Kind == "" { kLog.Success(result.FileName, "contains an empty YAML document") From f5cddc69201c3aaab5244a7a0c301eb50de931c7 Mon Sep 17 00:00:00 2001 From: Sandro Schifferle Date: Wed, 20 Jul 2022 16:01:19 +0200 Subject: [PATCH 2/2] Switch from WARN to ERROR Otherwise nobody understands the log why the build is failed if there are only warnings. --- log/log.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/log/log.go b/log/log.go index 680cda6..6c62033 100644 --- a/log/log.go +++ b/log/log.go @@ -18,6 +18,11 @@ func Warn(message ...string) { fmt.Printf("%s - %v\n", yellow("WARN"), strings.Join(message, " ")) } +func Error(message ...string) { + red := color.New(color.FgRed).SprintFunc() + fmt.Printf("%s - %v\n", yellow("ERR "), strings.Join(message, " ")) +} + func Error(message error) { if merr, ok := message.(*multierror.Error); ok { for _, serr := range merr.Errors {