Fix looking up images with other architectures.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1978556
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2021-07-02 11:46:27 +02:00
parent ac740c649b
commit 37570b7b75
7 changed files with 11 additions and 12 deletions

2
go.mod
View File

@ -12,7 +12,7 @@ require (
github.com/containernetworking/cni v0.8.1
github.com/containernetworking/plugins v0.9.1
github.com/containers/buildah v1.21.0
github.com/containers/common v0.38.13
github.com/containers/common v0.38.14
github.com/containers/conmon v2.0.20+incompatible
github.com/containers/image/v5 v5.12.0
github.com/containers/ocicrypt v1.1.1

4
go.sum
View File

@ -218,8 +218,8 @@ github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRD
github.com/containers/buildah v1.21.0 h1:LuwuqRPjan3X3AIdGwfkEkqMgmrDMNpQznFqNdHgCz8=
github.com/containers/buildah v1.21.0/go.mod h1:yPdlpVd93T+i91yGxrJbW1YOWrqN64j5ZhHOZmHUejs=
github.com/containers/common v0.38.4/go.mod h1:egfpX/Y3+19Dz4Wa1eRZDdgzoEOeneieF9CQppKzLBg=
github.com/containers/common v0.38.13 h1:TfdLHVspQl2+t4sD4vUDY1PuJGWIXif6zJOGlu1ExYc=
github.com/containers/common v0.38.13/go.mod h1:egfpX/Y3+19Dz4Wa1eRZDdgzoEOeneieF9CQppKzLBg=
github.com/containers/common v0.38.14 h1:6fp6+NpG/JhhGboRuUuc4fDaXHoHnSW9n/qL2iGQlLA=
github.com/containers/common v0.38.14/go.mod h1:egfpX/Y3+19Dz4Wa1eRZDdgzoEOeneieF9CQppKzLBg=
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
github.com/containers/image/v5 v5.12.0 h1:1hNS2QkzFQ4lH3GYQLyAXB0acRMhS1Ubm6oV++8vw4w=

View File

@ -63,14 +63,14 @@ func (r *Runtime) compileImageFilters(ctx context.Context, filters []string) ([]
switch key {
case "after", "since":
img, _, err := r.LookupImage(value, nil)
img, _, err := r.LookupImage(value, &LookupImageOptions{IgnorePlatform: true})
if err != nil {
return nil, errors.Wrapf(err, "could not find local image for filter %q", filter)
}
filterFuncs = append(filterFuncs, filterAfter(img.Created()))
case "before":
img, _, err := r.LookupImage(value, nil)
img, _, err := r.LookupImage(value, &LookupImageOptions{IgnorePlatform: true})
if err != nil {
return nil, errors.Wrapf(err, "could not find local image for filter %q", filter)
}

View File

@ -61,7 +61,7 @@ func (r *Runtime) Pull(ctx context.Context, name string, pullPolicy config.PullP
if pullPolicy == config.PullPolicyAlways {
return nil, errors.Errorf("pull policy is always but image has been referred to by ID (%s)", name)
}
local, _, err := r.LookupImage(name, nil)
local, _, err := r.LookupImage(name, &LookupImageOptions{IgnorePlatform: true})
if err != nil {
return nil, err
}
@ -136,9 +136,8 @@ func (r *Runtime) Pull(ctx context.Context, name string, pullPolicy config.PullP
}
localImages := []*Image{}
lookupOptions := &LookupImageOptions{IgnorePlatform: true}
for _, name := range pulledImages {
local, _, err := r.LookupImage(name, lookupOptions)
local, _, err := r.LookupImage(name, &LookupImageOptions{IgnorePlatform: true})
if err != nil {
return nil, errors.Wrapf(err, "error locating pulled image %q name in containers storage", name)
}

View File

@ -74,7 +74,7 @@ func (r *Runtime) Save(ctx context.Context, names []string, format, path string,
// saveSingleImage saves the specified image name to the specified path.
// Supported formats are "oci-archive", "oci-dir" and "docker-dir".
func (r *Runtime) saveSingleImage(ctx context.Context, name, format, path string, options *SaveOptions) error {
image, imageName, err := r.LookupImage(name, nil)
image, imageName, err := r.LookupImage(name, &LookupImageOptions{IgnorePlatform: true})
if err != nil {
return err
}
@ -155,7 +155,7 @@ func (r *Runtime) saveDockerArchive(ctx context.Context, names []string, path st
visitedNames := make(map[string]bool) // filters duplicate names
for _, name := range names {
// Look up local images.
image, imageName, err := r.LookupImage(name, nil)
image, imageName, err := r.LookupImage(name, &LookupImageOptions{IgnorePlatform: true})
if err != nil {
return err
}

View File

@ -1,4 +1,4 @@
package version
// Version is the version of the build.
const Version = "0.38.13"
const Version = "0.38.14"

2
vendor/modules.txt vendored
View File

@ -91,7 +91,7 @@ github.com/containers/buildah/pkg/overlay
github.com/containers/buildah/pkg/parse
github.com/containers/buildah/pkg/rusage
github.com/containers/buildah/util
# github.com/containers/common v0.38.13
# github.com/containers/common v0.38.14
github.com/containers/common/libimage
github.com/containers/common/libimage/manifests
github.com/containers/common/pkg/apparmor