|
@@ -178,7 +178,7 @@ func (is *imageSource) ResolveImageConfig(ctx context.Context, ref string, opt l
|
|
case source.ResolveModePreferLocal:
|
|
case source.ResolveModePreferLocal:
|
|
img, err := is.resolveLocal(ref)
|
|
img, err := is.resolveLocal(ref)
|
|
if err == nil {
|
|
if err == nil {
|
|
- if img.Architecture != opt.Platform.Architecture || img.Variant != opt.Platform.Variant || img.OS != opt.Platform.OS {
|
|
|
|
|
|
+ if !platformMatches(img, opt.Platform) {
|
|
logrus.WithField("ref", ref).Debugf("Requested build platform %s does not match local image platform %s, checking remote",
|
|
logrus.WithField("ref", ref).Debugf("Requested build platform %s does not match local image platform %s, checking remote",
|
|
path.Join(opt.Platform.OS, opt.Platform.Architecture, opt.Platform.Variant),
|
|
path.Join(opt.Platform.OS, opt.Platform.Architecture, opt.Platform.Variant),
|
|
path.Join(img.OS, img.Architecture, img.Variant),
|
|
path.Join(img.OS, img.Architecture, img.Variant),
|
|
@@ -273,7 +273,7 @@ func (p *puller) resolveLocal() {
|
|
ref := p.src.Reference.String()
|
|
ref := p.src.Reference.String()
|
|
img, err := p.is.resolveLocal(ref)
|
|
img, err := p.is.resolveLocal(ref)
|
|
if err == nil {
|
|
if err == nil {
|
|
- if img.Architecture != p.platform.Architecture || img.Variant != p.platform.Variant || img.OS != p.platform.OS {
|
|
|
|
|
|
+ if !platformMatches(img, &p.platform) {
|
|
logrus.WithField("ref", ref).Debugf("Requested build platform %s does not match local image platform %s, not resolving",
|
|
logrus.WithField("ref", ref).Debugf("Requested build platform %s does not match local image platform %s, not resolving",
|
|
path.Join(p.platform.OS, p.platform.Architecture, p.platform.Variant),
|
|
path.Join(p.platform.OS, p.platform.Architecture, p.platform.Variant),
|
|
path.Join(img.OS, img.Architecture, img.Variant),
|
|
path.Join(img.OS, img.Architecture, img.Variant),
|
|
@@ -947,3 +947,13 @@ func ensureManifestRequested(ctx context.Context, res remotes.Resolver, ref stri
|
|
res.Resolve(ctx, ref)
|
|
res.Resolve(ctx, ref)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func platformMatches(img *image.Image, p *ocispec.Platform) bool {
|
|
|
|
+ if img.Architecture != p.Architecture {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ if img.Variant != "" && img.Variant != p.Variant {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ return img.OS == p.OS
|
|
|
|
+}
|