regclient / regclient

Docker and OCI Registry Client in Go and tooling using those libraries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Issue] OCI data types used in regctl are not the same with those from spec.

peusebiu opened this issue · comments

Current Behavior

Currently in the spec https://github.com/opencontainers/image-spec/blob/main/specs-go/v1/descriptor.go#L27 the order of keys is Mediatype, Digest, Size and so on.

In regctl the order is Mediatype, Size, Digest https://github.com/regclient/regclient/blob/main/types/descriptor.go#L25

Is this intended?

I want to use regctl as a library, but because of this issue, oci images pushed with regctl have different digests than the ones pushed with other clients that imports the types from spec.

Expected Behavior

Expected regctl oci data types to be the same as those from spec.

The order was probably pulled in from distribution/distribution that adjusted their values to align with the spec a while back: distribution/distribution#3810

Note that reproducibility of generated images between different tools, or even different versions of the same tool, isn't guaranteed. You'd need some kind of canonical JSON output, in addition to reproducible compression of image layers.

FYI, regclient maintains its own types separate from the spec to be a leading implementation, adding features to prove them out, before the spec adopts them. I'll have the fix merged shortly.