Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image: set MediaType in OCI manifests #3657

Merged
merged 1 commit into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.17.0
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.2-0.20210819154149-5ad6f50d6283
github.com/opencontainers/image-spec v1.0.2-0.20211123152302-43a7dee1ec31
github.com/opencontainers/runc v1.0.2
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
github.com/opencontainers/runtime-tools v0.9.0
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,9 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/image-spec v1.0.2-0.20210819154149-5ad6f50d6283 h1:TVzvdjOalkJBNkbpPVMAr4KV9QRf2IjfxdyxwAK78Gs=
github.com/opencontainers/image-spec v1.0.2-0.20210819154149-5ad6f50d6283/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/image-spec v1.0.2-0.20211123152302-43a7dee1ec31 h1:Wh4aR2I6JFwySre9m3iHJYuMnvUFE/HT6qAXozRWi/E=
github.com/opencontainers/image-spec v1.0.2-0.20211123152302-43a7dee1ec31/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
Expand Down
1 change: 1 addition & 0 deletions image.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ func (i *containerImageRef) createConfigsAndManifests() (v1.Image, v1.Manifest,
Versioned: specs.Versioned{
SchemaVersion: 2,
},
MediaType: v1.MediaTypeImageManifest,
Config: v1.Descriptor{
MediaType: v1.MediaTypeImageConfig,
},
Expand Down
1 change: 1 addition & 0 deletions internal/source/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func Create(ctx context.Context, sourcePath string, options CreateOptions) error
// Create and write the manifest.
manifest := specV1.Manifest{
Versioned: spec.Versioned{SchemaVersion: 2},
MediaType: specV1.MediaTypeImageManifest,
Config: specV1.Descriptor{
MediaType: MediaTypeSourceImageConfig,
Digest: configBlob.Digest,
Expand Down
1 change: 1 addition & 0 deletions pkg/blobcache/blobcache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func TestBlobCache(t *testing.T) {
Versioned: specs.Versioned{
SchemaVersion: 2,
},
MediaType: v1.MediaTypeImageManifest,
Config: v1.Descriptor{
MediaType: v1.MediaTypeImageConfig,
Digest: configInfo.Digest,
Expand Down
2 changes: 1 addition & 1 deletion tests/imgtype/imgtype.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func main() {
errors = true
continue
}
manifestType = v1.MediaTypeImageManifest
manifestType = oManifest.MediaType
configType = oManifest.Config.MediaType
case define.Dockerv2ImageManifest:
err = json.Unmarshal(manifest, &dManifest)
Expand Down
6 changes: 4 additions & 2 deletions tests/source.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ load helpers
# Inspect the index.json
run jq -r .manifests[0].mediaType $srcdir/index.json
expect_output "application/vnd.oci.image.manifest.v1+json"
run jq -r .manifests[0].size $srcdir/index.json
expect_output "199"
run jq -r .mediaType $srcdir/index.json
expect_output null # TODO: common#839 will change this to "application/vnd.oci.image.index.v1+json"
# Digest of manifest
run jq -r .manifests[0].digest $srcdir/index.json
manifestDigest=${output//sha256:/} # strip off the sha256 prefix
Expand All @@ -25,6 +25,8 @@ load helpers
expect_output "null"
run jq -r .config.mediaType $srcdir/blobs/sha256/$manifestDigest
expect_output "application/vnd.oci.source.image.config.v1+json"
run jq -r .mediaType $srcdir/blobs/sha256/$manifestDigest
expect_output "application/vnd.oci.image.manifest.v1+json"
run jq -r .config.size $srcdir/blobs/sha256/$manifestDigest
[ "$status" -eq 0 ] # let's not check the size (afraid of time-stamp impacts)
# Digest of config
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ github.com/onsi/gomega/matchers/support/goraph/util
github.com/onsi/gomega/types
# github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/go-digest
# github.com/opencontainers/image-spec v1.0.2-0.20210819154149-5ad6f50d6283
# github.com/opencontainers/image-spec v1.0.2-0.20211123152302-43a7dee1ec31
github.com/opencontainers/image-spec/specs-go
github.com/opencontainers/image-spec/specs-go/v1
# github.com/opencontainers/runc v1.0.2
Expand Down