add in a sum for total errors. 0 return 1 when there are any errors, so that it can break our CI pipeline when needed

This commit is contained in:
ruokai.lai 2017-03-07 12:11:20 +11:00
parent 84f74fa1ee
commit cca55ed764

View File

@ -270,6 +270,9 @@ func AnalyzeLocalImage(imageName string, minSeverity types.Priority, endpoint, m
fmt.Printf("%s No vulnerabilities were detected in your image\n", color.GreenString("Success!")) fmt.Printf("%s No vulnerabilities were detected in your image\n", color.GreenString("Success!"))
} else if !hasVisibleVulnerabilities { } else if !hasVisibleVulnerabilities {
fmt.Printf("%s No vulnerabilities matching the minimum severity level were detected in your image\n", color.YellowString("NOTE:")) fmt.Printf("%s No vulnerabilities matching the minimum severity level were detected in your image\n", color.YellowString("NOTE:"))
} else {
errorTotal := errors.New("total Errors: "+strconv.Itoa(len(vulnerabilities)))
return errorTotal
} }
return nil return nil