From 2a565f49c2a7cfc4dbb2394d7ded786f20256234 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Tue, 16 Jun 2020 10:52:13 +0200 Subject: auto-update: use image's arch Use the architecture of the local image when looking for a new image on a registry. It seems to be common practice on ARM to tweak the architecture choice to pull the correct image. Fixes: #6613 Signed-off-by: Valentin Rothberg --- pkg/autoupdate/autoupdate.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'pkg') diff --git a/pkg/autoupdate/autoupdate.go b/pkg/autoupdate/autoupdate.go index eca5c342c..0ec98d3b6 100644 --- a/pkg/autoupdate/autoupdate.go +++ b/pkg/autoupdate/autoupdate.go @@ -251,8 +251,19 @@ func newerImageAvailable(runtime *libpod.Runtime, img *image.Image, origName str return false, err } + data, err := img.Inspect(context.Background()) + if err != nil { + return false, err + } + sys := runtime.SystemContext() sys.AuthFilePath = options.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/libpod/issues/6613. + sys.ArchitectureChoice = data.Architecture + remoteImg, err := remoteRef.NewImage(context.Background(), sys) if err != nil { return false, err -- cgit v1.2.3-54-g00ecf From af3c4d88b405adb0353f8085298d25e3a5937ee3 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Tue, 16 Jun 2020 11:11:53 +0200 Subject: handlers/compat: fix lint error Fix a lint error of an used parameter. The error must have sneaked in with a PR that was merged after the recent linter enablement. Signed-off-by: Valentin Rothberg --- pkg/api/handlers/compat/images_build.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index 399c104e9..913994f46 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -40,7 +40,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { } } - anchorDir, err := extractTarFile(r, w) + anchorDir, err := extractTarFile(r) if err != nil { utils.InternalServerError(w, err) return @@ -241,7 +241,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { }) } -func extractTarFile(r *http.Request, w http.ResponseWriter) (string, error) { +func extractTarFile(r *http.Request) (string, error) { // build a home for the request body anchorDir, err := ioutil.TempDir("", "libpod_builder") if err != nil { -- cgit v1.2.3-54-g00ecf