fix: MetaDB fixes related to Docker media types (#2934)

* fix: update download counters for docker media types

closes #2929

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

* fix: handle docker config mediatype in MetaDB

The OS/Arch/Layer History information was not written to MetaDB

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

---------

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
This commit is contained in:
Andrei Aaron
2025-02-03 08:29:55 +02:00
committed by GitHub
parent 4fcd1079f7
commit ea6b6dab23
5 changed files with 272 additions and 3 deletions
+3 -1
View File
@@ -7,6 +7,7 @@ import (
v1 "github.com/opencontainers/image-spec/specs-go/v1"
zcommon "zotregistry.dev/zot/pkg/common"
"zotregistry.dev/zot/pkg/compat"
"zotregistry.dev/zot/pkg/log"
mTypes "zotregistry.dev/zot/pkg/meta/types"
"zotregistry.dev/zot/pkg/storage"
@@ -117,7 +118,8 @@ func OnGetManifest(name, reference, mediaType string, body []byte,
return nil
}
if !(mediaType == v1.MediaTypeImageManifest || mediaType == v1.MediaTypeImageIndex) {
if !(mediaType == v1.MediaTypeImageManifest || mediaType == v1.MediaTypeImageIndex ||
compat.IsCompatibleManifestMediaType(mediaType) || compat.IsCompatibleManifestListMediaType(mediaType)) {
return nil
}
+2 -1
View File
@@ -321,7 +321,8 @@ func SetImageMetaFromInput(ctx context.Context, repo, reference, mediaType strin
return err
}
if manifestContent.Config.MediaType == ispec.MediaTypeImageConfig {
if manifestContent.Config.MediaType == ispec.MediaTypeImageConfig ||
compat.IsCompatibleConfigMediaType(manifestContent.Config.MediaType) {
configBlob, err := imageStore.GetBlobContent(repo, manifestContent.Config.Digest)
if err != nil {
return err