0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2025-02-17 23:45:36 -05:00

fix(sync): also add docker v2 mediatype as supported in sync (#1084)

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu 2022-12-22 19:23:49 +02:00 committed by GitHub
parent 85a7053d9c
commit 50bdc2f402
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View file

@ -680,7 +680,8 @@ func descriptorEqual(desc1, desc2 ispec.Descriptor) bool {
func isSupportedMediaType(mediaType string) bool {
return mediaType == ispec.MediaTypeImageIndex ||
mediaType == ispec.MediaTypeImageManifest ||
mediaType == manifest.DockerV2ListMediaType
mediaType == manifest.DockerV2ListMediaType ||
mediaType == manifest.DockerV2Schema2MediaType
}
func getImageRefManifest(ctx context.Context, upstreamCtx *types.SystemContext, imageRef types.ImageReference,

View file

@ -53,13 +53,12 @@ function teardown_file() {
}
# sync image
@test "sync docker image on demand" {
run skopeo --insecure-policy copy --src-tls-verify=false \
@test "sync docker image list on demand" {
run skopeo --insecure-policy copy --multi-arch=all --src-tls-verify=false \
docker://127.0.0.1:8090/registry \
oci:${TEST_DATA_DIR}
[ "$status" -eq 0 ]
run curl http://127.0.0.1:8090/v2/_catalog
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.repositories[]') = '"registry"' ]
@ -67,3 +66,17 @@ function teardown_file() {
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
}
@test "sync docker image on demand" {
run skopeo --insecure-policy copy --src-tls-verify=false \
docker://127.0.0.1:8090/archlinux \
oci:${TEST_DATA_DIR}
[ "$status" -eq 0 ]
run curl http://127.0.0.1:8090/v2/_catalog
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.repositories[0]') = '"archlinux"' ]
run curl http://127.0.0.1:8090/v2/registry/tags/list
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
}