Add report name to vuln report fixes #129 (#133)

This commit is contained in:
Darrian 2018-09-06 13:51:32 +01:00 committed by Jess Frazelle
parent 1328dc17a0
commit 809456d47e
2 changed files with 5 additions and 0 deletions

View file

@ -58,6 +58,7 @@ type Vulnerability struct {
// VulnerabilityReport represents the result of a vulnerability scan of a repo.
type VulnerabilityReport struct {
Name string
RegistryURL string
Repo string
Tag string

View file

@ -42,6 +42,8 @@ func (c *Clair) Vulnerabilities(r *registry.Registry, repo, tag string) (Vulnera
}
}
report.Name = filteredLayers[0].Digest.String()
vl, err := c.GetLayer(filteredLayers[0].Digest.String(), true, true)
if err != nil {
return report, err
@ -93,6 +95,8 @@ func (c *Clair) VulnerabilitiesV3(r *registry.Registry, repo, tag string) (Vulne
return report, nil
}
report.Name = layers[0].Digest.String()
clairLayers := []*clairpb.PostAncestryRequest_PostLayer{}
for i := len(layers) - 1; i >= 0; i-- {
// Form the clair layer.