func chooseDigestFromManifestList(sys *types.SystemContext, blob []byte) (digest.Digest, error) {
	wantedArch := runtime.GOARCH
	if sys != nil && sys.ArchitectureChoice != "" {
		wantedArch = sys.ArchitectureChoice
	}
	wantedOS := runtime.GOOS
	if sys != nil && sys.OSChoice != "" {
		wantedOS = sys.OSChoice
	}

	list := manifestList{}
	if err := json.Unmarshal(blob, &list); err != nil {
		return "", err
	}
	for _, d := range list.Manifests {
		if d.Platform.Architecture == wantedArch && d.Platform.OS == wantedOS {
			return d.Digest, nil
		}
	}
	return "", fmt.Errorf("no image found in manifest list for architecture %s, OS %s", wantedArch, wantedOS)
}
func chooseDigestFromManifestList(sys *types.SystemContext, blob []byte) (digest.Digest, error) {
	wantedArch := runtime.GOARCH
	if sys != nil && sys.ArchitectureChoice != "" {
		wantedArch = sys.ArchitectureChoice
	}
	wantedOS := runtime.GOOS
	if sys != nil && sys.OSChoice != "" {
		wantedOS = sys.OSChoice
	}

	list := manifestList{}
	if err := json.Unmarshal(blob, &list); err != nil {
		return "", err
	}
	for _, d := range list.Manifests {
		if d.Platform.Architecture == wantedArch && d.Platform.OS == wantedOS {
			return d.Digest, nil
		}
	}
	return "", fmt.Errorf("no image found in manifest list for architecture %s, OS %s", wantedArch, wantedOS)
}
// chooseDigestFromManifestList parses blob as a schema2 manifest list,
// and returns the digest of the image appropriate for the current environment.