1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

fix: propagate error when parsing an image fails (#6706)

* fix: propagate error when parsing an image fails

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* Apply suggestions from code review

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-03-28 15:36:07 +02:00 committed by GitHub
parent 391f1ae487
commit db29d8b2ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View file

@ -453,9 +453,7 @@ OuterLoop:
cfg := config.NewDefaultConfiguration()
if err := ctx.AddImageInfos(c.Resource, cfg); err != nil {
if err != nil {
log.Log.Error(err, "failed to add image variables to context")
}
log.Log.Error(err, "failed to add image variables to context")
}
gvk, subresource := updatedResource.GroupVersionKind(), ""

View file

@ -109,7 +109,7 @@ func extract(obj interface{}, path []string, keyPath, valuePath string, fields [
value = resultStr
}
if imageInfo, err := imageutils.GetImageInfo(value, cfg); err != nil {
return fmt.Errorf("invalid image %s", value)
return fmt.Errorf("invalid image %s (%s)", value, err.Error())
} else {
(*imageInfos)[key] = ImageInfo{*imageInfo, pointer}
}