summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-06-25 10:51:30 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-07-13 13:52:46 +0200
commita8847c01fbdf022ebbd747653623700326d88666 (patch)
tree0a82d6a225862805b83926cd35b076585dd1eab5
parenteda8d1f584dec2194c6c4ada2ba32b8dbaeaeb3a (diff)
downloadpodman-a8847c01fbdf022ebbd747653623700326d88666.tar.gz
podman-a8847c01fbdf022ebbd747653623700326d88666.tar.bz2
podman-a8847c01fbdf022ebbd747653623700326d88666.zip
auto-update: use libimage for image checks
Use the `HasDifferentDigest()` method of the image to replace the previous checks if an image needs to be updated. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
-rw-r--r--pkg/autoupdate/autoupdate.go33
1 files changed, 1 insertions, 32 deletions
diff --git a/pkg/autoupdate/autoupdate.go b/pkg/autoupdate/autoupdate.go
index 85082dbbb..911e2280b 100644
--- a/pkg/autoupdate/autoupdate.go
+++ b/pkg/autoupdate/autoupdate.go
@@ -9,7 +9,6 @@ import (
"github.com/containers/common/pkg/config"
"github.com/containers/image/v5/docker"
"github.com/containers/image/v5/docker/reference"
- "github.com/containers/image/v5/manifest"
"github.com/containers/image/v5/transports/alltransports"
"github.com/containers/podman/v3/libpod"
"github.com/containers/podman/v3/libpod/define"
@@ -299,37 +298,7 @@ func newerRemoteImageAvailable(runtime *libpod.Runtime, img *libimage.Image, ori
return false, err
}
- data, err := img.Inspect(context.Background(), false)
- if err != nil {
- return false, err
- }
-
- sys := runtime.SystemContext()
- if authfile != "" {
- sys.AuthFilePath = authfile
- }
-
- // We need to account for the arch that the image uses. It seems
- // common on ARM to tweak this option to pull the correct image. See
- // github.com/containers/podman/issues/6613.
- sys.ArchitectureChoice = data.Architecture
-
- remoteImg, err := remoteRef.NewImage(context.Background(), sys)
- if err != nil {
- return false, err
- }
-
- rawManifest, _, err := remoteImg.Manifest(context.Background())
- if err != nil {
- return false, err
- }
-
- remoteDigest, err := manifest.Digest(rawManifest)
- if err != nil {
- return false, err
- }
-
- return img.Digest().String() != remoteDigest.String(), nil
+ return img.HasDifferentDigest(context.Background(), remoteRef)
}
// newerLocalImageAvailable returns true if the container and local image have different digests