summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorjannfis <jann@mistrust.net>2023-01-21 11:38:29 -0500
committerGitHub <noreply@github.com>2023-01-21 11:38:29 -0500
commitfc2ceb409a06101a99616ce344511745b302b45a (patch)
tree67efe01794a4955640a07b1a659d1f705836c89b /pkg
parent98e5e9d5b31a9b49bb4715e823bc46286d3f6f14 (diff)
fix: Also request OCI media type image index (#524)
Signed-off-by: jannfis <jann@mistrust.net> Signed-off-by: jannfis <jann@mistrust.net>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/registry/client.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/pkg/registry/client.go b/pkg/registry/client.go
index 30c1fee..eb0ad31 100644
--- a/pkg/registry/client.go
+++ b/pkg/registry/client.go
@@ -24,6 +24,7 @@ import (
"github.com/distribution/distribution/v3/registry/client/transport"
"github.com/opencontainers/go-digest"
+ ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
"go.uber.org/ratelimit"
@@ -35,6 +36,15 @@ import (
// TODO: Check image's architecture and OS
+// knownMediaTypes is the list of media types we can process
+var knownMediaTypes = []string{
+ ocischema.SchemaVersion.MediaType,
+ schema1.MediaTypeSignedManifest,
+ schema2.SchemaVersion.MediaType,
+ manifestlist.SchemaVersion.MediaType,
+ ociv1.MediaTypeImageIndex,
+}
+
// RegistryClient defines the methods we need for querying container registries
type RegistryClient interface {
NewRepository(nameInRepository string) error
@@ -159,11 +169,10 @@ func (clt *registryClient) ManifestForTag(tagStr string) (distribution.Manifest,
if err != nil {
return nil, err
}
- mediaType := []string{ocischema.SchemaVersion.MediaType, schema1.MediaTypeSignedManifest, schema2.SchemaVersion.MediaType, manifestlist.SchemaVersion.MediaType}
manifest, err := manService.Get(
context.Background(),
digest.FromString(tagStr),
- distribution.WithTag(tagStr), distribution.WithManifestMediaTypes(mediaType))
+ distribution.WithTag(tagStr), distribution.WithManifestMediaTypes(knownMediaTypes))
if err != nil {
return nil, err
}
@@ -176,11 +185,10 @@ func (clt *registryClient) ManifestForDigest(dgst digest.Digest) (distribution.M
if err != nil {
return nil, err
}
- mediaType := []string{ocischema.SchemaVersion.MediaType, schema1.MediaTypeSignedManifest, schema2.SchemaVersion.MediaType, manifestlist.SchemaVersion.MediaType}
manifest, err := manService.Get(
context.Background(),
dgst,
- distribution.WithManifestMediaTypes(mediaType))
+ distribution.WithManifestMediaTypes(knownMediaTypes))
if err != nil {
return nil, err
}