diff --git a/Makefile b/Makefile index 8d5cdfcc..b448a58d 100644 --- a/Makefile +++ b/Makefile @@ -287,11 +287,13 @@ test-cloud-only-verbose: binary check-skopeo $(BATS) test-bats-sync: EXTENSIONS=sync test-bats-sync: binary binary-minimal check-skopeo $(BATS) $(NOTATION) $(COSIGN) $(BATS) --trace --print-output-on-failure test/blackbox/sync.bats + $(BATS) --trace --print-output-on-failure test/blackbox/sync_docker.bats .PHONY: test-bats-sync-verbose test-bats-sync-verbose: EXTENSIONS=sync test-bats-sync-verbose: binary binary-minimal check-skopeo $(BATS) $(NOTATION) $(COSIGN) $(BATS) --trace -t -x -p --verbose-run --print-output-on-failure --show-output-of-passing-tests test/blackbox/sync.bats + $(BATS) --trace -t -x -p --verbose-run --print-output-on-failure --show-output-of-passing-tests test/blackbox/sync_docker.bats .PHONY: test-bats-cve test-bats-cve: EXTENSIONS=search diff --git a/pkg/extensions/sync/utils.go b/pkg/extensions/sync/utils.go index c84692be..8b551cd1 100644 --- a/pkg/extensions/sync/utils.go +++ b/pkg/extensions/sync/utils.go @@ -18,6 +18,7 @@ import ( glob "github.com/bmatcuk/doublestar/v4" "github.com/containers/image/v5/docker" "github.com/containers/image/v5/docker/reference" + "github.com/containers/image/v5/manifest" "github.com/containers/image/v5/oci/layout" "github.com/containers/image/v5/types" guuid "github.com/gofrs/uuid" @@ -678,7 +679,8 @@ func descriptorEqual(desc1, desc2 ispec.Descriptor) bool { func isSupportedMediaType(mediaType string) bool { return mediaType == ispec.MediaTypeImageIndex || - mediaType == ispec.MediaTypeImageManifest + mediaType == ispec.MediaTypeImageManifest || + mediaType == manifest.DockerV2ListMediaType } func getImageRefManifest(ctx context.Context, upstreamCtx *types.SystemContext, imageRef types.ImageReference, diff --git a/test/blackbox/sync_docker.bats b/test/blackbox/sync_docker.bats new file mode 100644 index 00000000..46c23220 --- /dev/null +++ b/test/blackbox/sync_docker.bats @@ -0,0 +1,69 @@ +load helpers_sync + +function setup_file() { + # Verify prerequisites are available + if ! verify_prerequisites; then + exit 1 + fi + + # Setup zot server + local zot_root_dir=${BATS_FILE_TMPDIR}/zot + local zot_sync_ondemand_config_file=${BATS_FILE_TMPDIR}/zot_sync_ondemand_config.json + + mkdir -p ${zot_root_dir} + + cat >${zot_sync_ondemand_config_file} <