diff --git a/exporter/containerimage/writer.go b/exporter/containerimage/writer.go index 068d86958f8f..0c0aef743abf 100644 --- a/exporter/containerimage/writer.go +++ b/exporter/containerimage/writer.go @@ -178,19 +178,11 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session return nil, err } - idx := struct { - // MediaType is reserved in the OCI spec but - // excluded from go types. - MediaType string `json:"mediaType,omitempty"` - - ocispecs.Index - }{ - MediaType: ocispecs.MediaTypeImageIndex, - Index: ocispecs.Index{ - Annotations: opts.Annotations.Platform(nil).Index, - Versioned: specs.Versioned{ - SchemaVersion: 2, - }, + idx := ocispecs.Index{ + MediaType: ocispecs.MediaTypeImageIndex, + Annotations: opts.Annotations.Platform(nil).Index, + Versioned: specs.Versioned{ + SchemaVersion: 2, }, } @@ -386,24 +378,16 @@ func (ic *ImageWriter) commitDistributionManifest(ctx context.Context, opts *Ima configType = images.MediaTypeDockerSchema2Config } - mfst := struct { - // MediaType is reserved in the OCI spec but - // excluded from go types. - MediaType string `json:"mediaType,omitempty"` - - ocispecs.Manifest - }{ - MediaType: manifestType, - Manifest: ocispecs.Manifest{ - Annotations: annotations.Manifest, - Versioned: specs.Versioned{ - SchemaVersion: 2, - }, - Config: ocispecs.Descriptor{ - Digest: configDigest, - Size: int64(len(config)), - MediaType: configType, - }, + mfst := ocispecs.Manifest{ + MediaType: manifestType, + Annotations: annotations.Manifest, + Versioned: specs.Versioned{ + SchemaVersion: 2, + }, + Config: ocispecs.Descriptor{ + Digest: configDigest, + Size: int64(len(config)), + MediaType: configType, }, } @@ -499,23 +483,15 @@ func (ic *ImageWriter) commitAttestationsManifest(ctx context.Context, opts *Ima MediaType: configType, } - mfst := struct { - // MediaType is reserved in the OCI spec but - // excluded from go types. - MediaType string `json:"mediaType,omitempty"` - - ocispecs.Manifest - }{ + mfst := ocispecs.Manifest{ MediaType: manifestType, - Manifest: ocispecs.Manifest{ - Versioned: specs.Versioned{ - SchemaVersion: 2, - }, - Config: ocispecs.Descriptor{ - Digest: configDigest, - Size: int64(len(config)), - MediaType: configType, - }, + Versioned: specs.Versioned{ + SchemaVersion: 2, + }, + Config: ocispecs.Descriptor{ + Digest: configDigest, + Size: int64(len(config)), + MediaType: configType, }, } diff --git a/frontend/dockerfile/dockerfile_test.go b/frontend/dockerfile/dockerfile_test.go index 9ba020f66150..57878604585f 100644 --- a/frontend/dockerfile/dockerfile_test.go +++ b/frontend/dockerfile/dockerfile_test.go @@ -6519,7 +6519,7 @@ FROM scratch COPY --from=0 / / `) - const expectedDigest = "sha256:9e36395384d073e711102b13bd0ba4b779ef6afbaf5cadeb77fe77dba8967d1f" + const expectedDigest = "sha256:23bfe9c494f4b4ae9368d989035c70b3a34aa0bfc991618b3e54dcce2eee4bf8" dir, err := integration.Tmpdir( t,