oci-fetch
oci-fetch copied to clipboard
oci-fetch: Fix wrong oci layout
oci fetch is generating a wrong oci layout (doesn't pass oci-image-tool validation) because oci-fetch was writing inside the refs/ dir the manifest
instead of the descriptor.
This patch fixes this doing multiple things:
- write a descriptor inside the refs/ dir
- save the manifest as a blob inside blobs/ dir
- keep the retrieved manifest data (without unmarshall/marshall) since this will change the file digests.
- remove leading / in tar entries
This has been tested by temporary uncommenting the docker v2.2 mediaTypes in
lib/schema/mediatype.go
yet, we have almost the same stuff in skopeo (working exactly the same as this repo+this commit does) and this sounds a really waste of resources :/ containers/image will soon have the ability to do what this repo does with just like 2 function calls, I know Simone is working on his OCI store with a custom client.... would be awesome to move everything to containers/image..
so me, Simone and Derek did the same thing 3 times and we fix each other bug :)
This binary here will eventually directly use containers/image to retrieve an OCI image...instead of replicating the whole logic of saving to an image-layout...
@runcom I agree. I'll go for https://github.com/containers/image and suggest to use skopeo or just let oci-fetch become a https://github.com/containers/image example usage.
@dgonyeo @philips If you prefer let's discuss it in https://groups.google.com/forum/?hl=en#!forum/containers-dev google group
I also think this tool isn't going to work if Docker Hub returns version 2 schema 1 manifests because they're not compatible with OCI v1 manifest
@runcom that's correct, but I don't know how an OCI-only fetching tool would handle that.
It would not :)