mirror of https://github.com/docker/buildx.git
Added application/vnd.docker.distribution.manifest.v2+json mediatype to the list of mediatypes we return the original bytes for when calling *Resolver.Combine rather than adding it to a newly created manifest list
Signed-off-by: Tim Smith <tismith@rvohealth.com>
This commit is contained in:
parent
2e7da01560
commit
0808747add
|
@ -61,23 +61,7 @@ func testImagetoolsCopyManifest(t *testing.T, sb integration.Sandbox) {
|
|||
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))
|
||||
|
||||
cmd = buildxCmd(sb, withArgs("imagetools", "inspect", target2+"@"+string(idx2.Manifests[0].Digest), "--raw"))
|
||||
dt, err = cmd.CombinedOutput()
|
||||
require.NoError(t, err, string(dt))
|
||||
|
||||
var mfst2 ocispecs.Manifest
|
||||
err = json.Unmarshal(dt, &mfst2)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, images.MediaTypeDockerSchema2Manifest, mfst2.MediaType)
|
||||
|
||||
require.Equal(t, mfst.Config.Digest, mfst2.Config.Digest)
|
||||
require.Equal(t, len(mfst.Layers), len(mfst2.Layers))
|
||||
for i := range mfst.Layers {
|
||||
require.Equal(t, mfst.Layers[i].Digest, mfst2.Layers[i].Digest)
|
||||
}
|
||||
require.Equal(t, images.MediaTypeDockerSchema2Manifest, idx2.MediaType)
|
||||
}
|
||||
|
||||
func testImagetoolsCopyIndex(t *testing.T, sb integration.Sandbox) {
|
||||
|
@ -161,7 +145,15 @@ func testImagetoolsInspectAndFilter(t *testing.T, sb integration.Sandbox) {
|
|||
mfst = idx.Manifests[1]
|
||||
require.Equal(t, "linux/arm64", platforms.Format(*mfst.Platform))
|
||||
|
||||
// create amd64 only image
|
||||
cmd = buildxCmd(sb, withArgs("imagetools", "inspect", target+"@"+string(idx.Manifests[1].Digest), "--raw"))
|
||||
dt, err = cmd.CombinedOutput()
|
||||
require.NoError(t, err, string(dt))
|
||||
|
||||
var armMfst ocispecs.Manifest
|
||||
err = json.Unmarshal(dt, &armMfst)
|
||||
require.NoError(t, err)
|
||||
|
||||
// create arm64 only image
|
||||
cmd = buildxCmd(sb, withArgs("imagetools", "create", "-t", target+"-arm64", target+"@"+string(idx.Manifests[1].Digest)))
|
||||
dt, err = cmd.CombinedOutput()
|
||||
require.NoError(t, err, string(dt))
|
||||
|
@ -170,14 +162,12 @@ func testImagetoolsInspectAndFilter(t *testing.T, sb integration.Sandbox) {
|
|||
dt, err = cmd.CombinedOutput()
|
||||
require.NoError(t, err, string(dt))
|
||||
|
||||
var idx2 ocispecs.Index
|
||||
var idx2 ocispecs.Manifest
|
||||
err = json.Unmarshal(dt, &idx2)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, 1, len(idx2.Manifests))
|
||||
|
||||
require.Equal(t, idx.Manifests[1].Digest, idx2.Manifests[0].Digest)
|
||||
require.Equal(t, platforms.Format(*idx.Manifests[1].Platform), platforms.Format(*idx2.Manifests[0].Platform))
|
||||
require.Equal(t, armMfst.Config.Digest, idx2.Config.Digest)
|
||||
require.Equal(t, armMfst.MediaType, idx2.MediaType)
|
||||
}
|
||||
|
||||
func testImagetoolsAnnotation(t *testing.T, sb integration.Sandbox) {
|
||||
|
|
|
@ -79,7 +79,7 @@ func (r *Resolver) Combine(ctx context.Context, srcs []*Source, ann []string) ([
|
|||
|
||||
// on single source, return original bytes
|
||||
if len(srcs) == 1 && len(ann) == 0 {
|
||||
if mt := srcs[0].Desc.MediaType; mt == images.MediaTypeDockerSchema2ManifestList || mt == ocispec.MediaTypeImageIndex {
|
||||
if mt := srcs[0].Desc.MediaType; mt == images.MediaTypeDockerSchema2ManifestList || mt == images.MediaTypeDockerSchema2Manifest || mt == ocispec.MediaTypeImageIndex {
|
||||
return dts[0], srcs[0].Desc, nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue