From 73e949cc8943bed6128ff78d80cdb736591d1e66 Mon Sep 17 00:00:00 2001 From: Simon Castagna Date: Tue, 11 Nov 2025 14:40:04 +0100 Subject: [PATCH] Fix bug where assert artifact did not exit with non-zero on non-compliance --- cmd/kosli/assertArtifact.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/kosli/assertArtifact.go b/cmd/kosli/assertArtifact.go index 17ab03f6b..4ed484a4a 100644 --- a/cmd/kosli/assertArtifact.go +++ b/cmd/kosli/assertArtifact.go @@ -163,8 +163,9 @@ func printAssertAsTable(raw string, out io.Writer, page int) error { return err } scope := evaluationResult["scope"].(string) + isCompliant := evaluationResult["compliant"].(bool) - if evaluationResult["compliant"].(bool) { + if isCompliant { logger.Info("COMPLIANT") } else { logger.Info("Error: NON-COMPLIANT") @@ -245,5 +246,9 @@ func printAssertAsTable(raw string, out io.Writer, page int) error { } logger.Info(" See more details at %s", evaluationResult["html_url"].(string)) } + + if !isCompliant { + return fmt.Errorf("Artifact is not compliant") + } return nil }