Skip to content

Commit 73e949c

Browse files
committed
Fix bug where assert artifact did not exit with non-zero on non-compliance
1 parent 76296af commit 73e949c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/kosli/assertArtifact.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,9 @@ func printAssertAsTable(raw string, out io.Writer, page int) error {
163163
return err
164164
}
165165
scope := evaluationResult["scope"].(string)
166+
isCompliant := evaluationResult["compliant"].(bool)
166167

167-
if evaluationResult["compliant"].(bool) {
168+
if isCompliant {
168169
logger.Info("COMPLIANT")
169170
} else {
170171
logger.Info("Error: NON-COMPLIANT")
@@ -245,5 +246,9 @@ func printAssertAsTable(raw string, out io.Writer, page int) error {
245246
}
246247
logger.Info(" See more details at %s", evaluationResult["html_url"].(string))
247248
}
249+
250+
if !isCompliant {
251+
return fmt.Errorf("Artifact is not compliant")
252+
}
248253
return nil
249254
}

0 commit comments

Comments
 (0)