Skip to content

Commit

Permalink
Merge pull request #42951 from crazy-max/build-local-normalized
Browse files Browse the repository at this point in the history
buildkit: normalize build target and local platform
  • Loading branch information
thaJeztah committed Oct 20, 2021
2 parents c87b941 + b4e056d commit 693697b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions builder/builder-next/adapters/containerimage/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/containerd/containerd/remotes/docker"
"github.com/containerd/containerd/remotes/docker/schema1"
distreference "github.com/docker/distribution/reference"
dimages "github.com/docker/docker/daemon/images"
"github.com/docker/docker/distribution"
"github.com/docker/docker/distribution/metadata"
"github.com/docker/docker/distribution/xfer"
Expand Down Expand Up @@ -853,11 +854,11 @@ func resolveModeToString(rm source.ResolveMode) string {
}

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
return dimages.OnlyPlatformWithFallback(*p).Match(ocispec.Platform{
Architecture: img.Architecture,
OS: img.OS,
OSVersion: img.OSVersion,
OSFeatures: img.OSFeatures,
Variant: img.Variant,
})
}

0 comments on commit 693697b

Please sign in to comment.