Merge pull request #3030 from reasonerjt/fix-jobservice-update-vuln-bug

Do not throw error if the scan result is unchanged
This commit is contained in:
Daniel Jiang 2017-08-11 13:26:15 +08:00 committed by GitHub
commit 1403fe09ff
2 changed files with 3 additions and 3 deletions

View File

@ -147,8 +147,8 @@ func UpdateImgScanOverview(digest, detailsKey string, sev models.Severity, compO
rec.DetailsKey = detailsKey
rec.UpdateTime = time.Now()
n, err := o.Update(rec, "Sev", "CompOverviewStr", "DetailsKey", "UpdateTime")
if n == 0 || err != nil {
_, err = o.Update(rec, "Sev", "CompOverviewStr", "DetailsKey", "UpdateTime")
if err != nil {
return fmt.Errorf("Failed to update scan overview record with digest: %s, error: %v", digest, err)
}
return nil

View File

@ -135,7 +135,7 @@ func (sh *SummarizeHandler) Enter() (string, error) {
layerName := sh.Context.layers[len(sh.Context.layers)-1].Name
logger.Infof("Top layer's name: %s, will use it to get the vulnerability result of image", layerName)
if err := clair.UpdateScanOverview(sh.Context.Digest, layerName); err != nil {
return "", nil
return "", err
}
return models.JobFinished, nil
}