Repository navigation
tests: add imagetools tests for copying manifests and indexes - #2013
Conversation
Signed-off-by: Justin Chadwell <me@jedevc.com>
| var idx2 ocispecs.Index | ||
| err = json.Unmarshal(dt, &idx2) | ||
| require.NoError(t, err) | ||
| require.Equal(t, images.MediaTypeDockerSchema2ManifestList, idx2.MediaType) | ||
| require.Equal(t, 1, len(idx2.Manifests)) |
There was a problem hiding this comment.
Out of curiosity: is this case actually correct? If the imagetools create input is only a single manifest, do we expect to create an index containing just it? Or would we expect to just copy it unchanged?
There was a problem hiding this comment.
Hum I would say we just copy it unchanged imo. It looks linked to #1797 (comment) where we default to OCI now?
There was a problem hiding this comment.
Hm, I don't think this is oci/docker media type confusion, it seems like this was always present before that PR?
I think maybe we want the just copy behaviour agreed, I think it's worth merging this PR to track the current behaviour, then fixing that as a followup, if we agree that's worth doing?
There was a problem hiding this comment.
Hm, I don't think this is oci/docker media type confusion, it seems like this was always present before that PR?
Ah right indeed this is for manifest list / index case.
I think maybe we want the just copy behaviour agreed,
I took a further look and we already return the original manifest for a single source:
buildx/util/imagetools/create.go
Lines 79 to 84 in 296832c
But seems we hit this case instead:
buildx/util/imagetools/create.go
Lines 115 to 121 in 296832c
I think it's worth merging this PR to track the current behaviour, then fixing that as a followup, if we agree that's worth doing?
Yes sounds good for a follow-up 👍
While in the process of investigating, #1660, realized we didn't have any tests for it.
I've added some tests to ensure that manifests and indexes are copied with their digests preserved intact.