diff --git a/cmd/cli/kubectl-kyverno/utils/common/common.go b/cmd/cli/kubectl-kyverno/utils/common/common.go index de9f509598..0e454af633 100644 --- a/cmd/cli/kubectl-kyverno/utils/common/common.go +++ b/cmd/cli/kubectl-kyverno/utils/common/common.go @@ -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(), "" diff --git a/pkg/utils/api/image.go b/pkg/utils/api/image.go index 260b803c2f..8e3107ed20 100644 --- a/pkg/utils/api/image.go +++ b/pkg/utils/api/image.go @@ -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} }