Skip to content

Commit

Permalink
Merge pull request #3600 from jedevc/exporter-simplify-oci-media-types
Browse files Browse the repository at this point in the history
exporter: remove wrappers for oci data types
  • Loading branch information
tonistiigi authored Feb 11, 2023
2 parents 2d4222b + a89f482 commit 4828fe2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 48 deletions.
70 changes: 23 additions & 47 deletions exporter/containerimage/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}

Expand Down Expand Up @@ -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,
},
}

Expand Down Expand Up @@ -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,
},
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/dockerfile/dockerfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6519,7 +6519,7 @@ FROM scratch
COPY --from=0 / /
`)

const expectedDigest = "sha256:9e36395384d073e711102b13bd0ba4b779ef6afbaf5cadeb77fe77dba8967d1f"
const expectedDigest = "sha256:23bfe9c494f4b4ae9368d989035c70b3a34aa0bfc991618b3e54dcce2eee4bf8"

dir, err := integration.Tmpdir(
t,
Expand Down

0 comments on commit 4828fe2

Please sign in to comment.