diff --git a/internal/scan/scan.go b/internal/scan/scan.go index 1f956b8c..2dfd9c12 100644 --- a/internal/scan/scan.go +++ b/internal/scan/scan.go @@ -457,14 +457,16 @@ func walkDirScan(ctx context.Context, cfg *types.Config, tag *v1.TagReference, c klog.V(1).InfoS("scanning success", "image", getImage(res), "path", innerPath, "status", "success") } else { status := res.Status() - klog.InfoS("scanning "+status, - "image", getImage(res), - "path", innerPath, - "error", res.Error.Error, - "component", getComponent(res), - "tag", getTag(res), - "rpm", res.RPM, - "status", status) + for _, err := range res.Errors { + klog.InfoS("scanning "+status, + "image", getImage(res), + "path", innerPath, + "error", err.Error, + "component", getComponent(res), + "tag", getTag(res), + "rpm", res.RPM, + "status", status) + } } results.Append(res) return nil diff --git a/internal/types/types.go b/internal/types/types.go index 17743830..8c32dbd9 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -75,6 +75,7 @@ type ScanResult struct { Path string Skip bool Error *ValidationError + Errors []*ValidationError } type ScanResults struct { diff --git a/internal/types/types_scan_result.go b/internal/types/types_scan_result.go index c6c8daee..f3a4ef34 100644 --- a/internal/types/types_scan_result.go +++ b/internal/types/types_scan_result.go @@ -73,7 +73,12 @@ func (r *ScanResult) SetOS(info OSInfo) *ScanResult { } func (r *ScanResult) SetValidationError(err *ValidationError) *ScanResult { - r.Error = err + if r.Error != nil { + r.Errors = append(r.Errors, err) + } else { + r.Error = err + r.Errors = append(r.Errors, err) + } return r } diff --git a/internal/validations/validations.go b/internal/validations/validations.go index be2590ea..0a930808 100644 --- a/internal/validations/validations.go +++ b/internal/validations/validations.go @@ -411,6 +411,7 @@ checks: // See if the error is to be ignored. for _, list := range errIgnores { if list.Ignore(innerPath, err.Error) { + klog.Info("ignoring %s for ", err.Error, innerPath) continue checks } } @@ -432,10 +433,12 @@ checks: } } } - return res.SetValidationError(err) + res.SetValidationError(err) } } - + if res.Error != nil { + return res + } return res.Success() }