cmd/mstorectl/imagecmd: added os/arch/variant option to repo client

This commit is contained in:
2026-03-17 16:54:23 +02:00
parent 629f4a5fa6
commit 5e66b92400
3 changed files with 16 additions and 11 deletions
+7 -10
View File
@@ -20,14 +20,6 @@ import (
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
const (
//MediaTypeOIIv1 = "application/vnd.oci.image.index.v1+json"
//MediaTypeDDMLv2 = "application/vnd.docker.distribution.manifest.list.v2+json"
// MediaTypeDDMv2 = "application/vnd.docker.distribution.manifest.v2+json"
// MediaTypeOIMv1 = "application/vnd.oci.image.manifest.v1+json"
)
type Loader struct {
cli *Client
}
@@ -38,7 +30,7 @@ func NewLoader(client *Client) *Loader {
}
}
func (down *Loader) Pull(ctx context.Context, rawref, dir, osname, arch string) error {
func (down *Loader) Pull(ctx context.Context, rawref, dir, osname, arch, variant string) error {
var err error
if osname == "" {
osname = runtime.GOOS
@@ -75,11 +67,16 @@ func (down *Loader) Pull(ctx context.Context, rawref, dir, osname, arch string)
}
for _, descr := range index.Manifests {
if descr.Platform != nil {
cond := descr.Platform.Architecture == arch
var cond bool
cond = descr.Platform.Architecture == arch
cond = cond && descr.Platform.OS == osname
if variant != "" {
cond = cond && descr.Platform.Variant == variant
}
if cond {
tag = descr.Digest.String()
digstr = descr.Digest.String()
break
}
}
}