containers / image

Work with containers' images
Apache License 2.0
842 stars 365 forks source link

OCI image index loose the artifactType property on copy #2460

Open AlbanBedel opened 4 days ago

AlbanBedel commented 4 days ago

When copying an OCI image index with the artifactType property set it is re-written to a new version without the artifactType property.

To reproduce:

$ echo '{"schemaVersion": 2, "manifests": [],    "mediaType": "application/vnd.oci.image.index.v1+json","artifactType": "application/vnd.test.index.v1+json"}' | oras manifest push --oci-layout artifact:v1 -
$ skopeo copy -a oci:artifact:v1 oci:artifact-copy:v1
$ skopeo inspect --raw oci:artifact-copy:v1

Notice the missing artifactType and the removal of all extra white spaces in the copied manifest.

mtrmac commented 4 days ago

Thanks for your report. What version of c/image and Skopeo is this?

AlbanBedel commented 4 days ago

Latest main commit of skopeo which use v5.31.1.

AlbanBedel commented 4 days ago

Looking at the code in copyMultipleImages the issue stem from OCI1IndexPublic.PublicClone which rely on OCI1IndexPublicFromComponents so it only copy the mediaType, manifests list and annotations. So I suppose the same issue will happen with the subject field as well, or any other fields that might be added in the future.

mtrmac commented 3 days ago

Ah, thanks. I was looking at the single-arch image copy path.