Update logic to choose manifest from manifest list to check for os version on Windows. Separate the logic for windows and unix to keep unix logic the same. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (cherry picked from commit 38aef56e1fcb8ea318df98c89cf002267b88a136) Signed-off-by: John Stephens <johnstep@docker.com>
30 lines
945 B
Go
30 lines
945 B
Go
// +build !windows
|
|
|
|
package distribution
|
|
|
|
import (
|
|
"runtime"
|
|
|
|
"github.com/docker/distribution"
|
|
"github.com/docker/distribution/context"
|
|
"github.com/docker/distribution/manifest/manifestlist"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func (ld *v2LayerDescriptor) open(ctx context.Context) (distribution.ReadSeekCloser, error) {
|
|
blobs := ld.repo.Blobs(ctx)
|
|
return blobs.Open(ctx, ld.digest)
|
|
}
|
|
|
|
func filterManifests(manifests []manifestlist.ManifestDescriptor) []manifestlist.ManifestDescriptor {
|
|
var matches []manifestlist.ManifestDescriptor
|
|
for _, manifestDescriptor := range manifests {
|
|
if manifestDescriptor.Platform.Architecture == runtime.GOARCH && manifestDescriptor.Platform.OS == runtime.GOOS {
|
|
matches = append(matches, manifestDescriptor)
|
|
|
|
logrus.Debugf("found match for %s/%s with media type %s, digest %s", runtime.GOOS, runtime.GOARCH, manifestDescriptor.MediaType, manifestDescriptor.Digest.String())
|
|
}
|
|
}
|
|
return matches
|
|
}
|