From c63f6db61e2334cbe2be6600479a925794540457 Mon Sep 17 00:00:00 2001 From: 3wc <3wc@doesthisthing.work> Date: Mon, 11 Aug 2025 11:57:30 +0100 Subject: [PATCH] WARN on recipe linting errors during --chaos.. ..and show multiple linting errors instead of bailing on the first one. Re #497 --- cli/app/deploy.go | 6 +++++- pkg/lint/recipe.go | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cli/app/deploy.go b/cli/app/deploy.go index aa8b4062..72e45a58 100644 --- a/cli/app/deploy.go +++ b/cli/app/deploy.go @@ -108,7 +108,11 @@ checkout as-is. Recipe commit hashes are also supported as values for } if err := lint.LintForErrors(app.Recipe); err != nil { - log.Fatal(err) + if internal.Chaos { + log.Warn(err) + } else { + log.Fatal(err) + } } if err := validateSecrets(cl, app); err != nil { diff --git a/pkg/lint/recipe.go b/pkg/lint/recipe.go index 4f7f5e24..ae462a54 100644 --- a/pkg/lint/recipe.go +++ b/pkg/lint/recipe.go @@ -184,6 +184,8 @@ var LintRules = map[string][]LintRule{ func LintForErrors(recipe recipe.Recipe) error { log.Debugf("linting for critical errors in %s configs", recipe.Name) + var errors string + for level := range LintRules { if level != "error" { continue @@ -196,14 +198,18 @@ func LintForErrors(recipe recipe.Recipe) error { ok, err := rule.Function(recipe) if err != nil { - return fmt.Errorf("lint %s: %s", rule.Ref, err) + errors += fmt.Sprintf("\nlint %s: %s", rule.Ref, err) } if !ok { - return fmt.Errorf("lint error in %s configs: \"%s\" failed lint checks (%s)", recipe.Name, rule.Description, rule.Ref) + errors += fmt.Sprintf("\nlint error in %s configs: \"%s\" failed lint checks (%s)", recipe.Name, rule.Description, rule.Ref) } } } + if (len(errors) > 0) { + return fmt.Errorf(errors[1:]) + } + log.Debugf("linting successful, %s is well configured", recipe.Name) return nil