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 }