Merge pull request #839 from nalind/mediaType
manifests: set MediaType in OCI indexes
This commit is contained in:
		
						commit
						d3b6dbe9c6
					
				| 
						 | 
					@ -22,7 +22,7 @@ require (
 | 
				
			||||||
	github.com/onsi/ginkgo v1.16.5
 | 
						github.com/onsi/ginkgo v1.16.5
 | 
				
			||||||
	github.com/onsi/gomega v1.17.0
 | 
						github.com/onsi/gomega v1.17.0
 | 
				
			||||||
	github.com/opencontainers/go-digest v1.0.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/runc v1.0.2
 | 
				
			||||||
	github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
 | 
						github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
 | 
				
			||||||
	github.com/opencontainers/runtime-tools v0.9.0
 | 
						github.com/opencontainers/runtime-tools v0.9.0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -655,6 +655,8 @@ github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zM
 | 
				
			||||||
github.com/opencontainers/image-spec v1.0.1/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 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.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.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 v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
 | 
				
			||||||
github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
 | 
					github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,6 +74,7 @@ func Create() List {
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		oci: v1.Index{
 | 
							oci: v1.Index{
 | 
				
			||||||
			Versioned: imgspec.Versioned{SchemaVersion: 2},
 | 
								Versioned: imgspec.Versioned{SchemaVersion: 2},
 | 
				
			||||||
 | 
								MediaType: v1.MediaTypeImageIndex,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -373,6 +374,7 @@ func FromBlob(manifestBytes []byte) (List, error) {
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		oci: v1.Index{
 | 
							oci: v1.Index{
 | 
				
			||||||
			Versioned: imgspec.Versioned{SchemaVersion: 2},
 | 
								Versioned: imgspec.Versioned{SchemaVersion: 2},
 | 
				
			||||||
 | 
								MediaType: v1.MediaTypeImageIndex,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	switch manifestType {
 | 
						switch manifestType {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,6 +88,7 @@ func makeManifest(layer, config []byte) v1.Manifest {
 | 
				
			||||||
		Versioned: specs.Versioned{
 | 
							Versioned: specs.Versioned{
 | 
				
			||||||
			SchemaVersion: 2,
 | 
								SchemaVersion: 2,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							MediaType: v1.MediaTypeImageManifest,
 | 
				
			||||||
		Config: v1.Descriptor{
 | 
							Config: v1.Descriptor{
 | 
				
			||||||
			MediaType: v1.MediaTypeImageConfig,
 | 
								MediaType: v1.MediaTypeImageConfig,
 | 
				
			||||||
			Digest:    digest.Canonical.FromBytes(config),
 | 
								Digest:    digest.Canonical.FromBytes(config),
 | 
				
			||||||
| 
						 | 
					@ -182,6 +183,7 @@ func TestSupplemented(t *testing.T) {
 | 
				
			||||||
		Versioned: specs.Versioned{
 | 
							Versioned: specs.Versioned{
 | 
				
			||||||
			SchemaVersion: 2,
 | 
								SchemaVersion: 2,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							MediaType: v1.MediaTypeImageIndex,
 | 
				
			||||||
		Manifests: []v1.Descriptor{
 | 
							Manifests: []v1.Descriptor{
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				MediaType: v1.MediaTypeImageManifest,
 | 
									MediaType: v1.MediaTypeImageManifest,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,9 @@ import "github.com/opencontainers/image-spec/specs-go"
 | 
				
			||||||
type Index struct {
 | 
					type Index struct {
 | 
				
			||||||
	specs.Versioned
 | 
						specs.Versioned
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// MediaType specificies the type of this document data structure e.g. `application/vnd.oci.image.index.v1+json`
 | 
				
			||||||
 | 
						MediaType string `json:"mediaType,omitempty"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Manifests references platform specific manifests.
 | 
						// Manifests references platform specific manifests.
 | 
				
			||||||
	Manifests []Descriptor `json:"manifests"`
 | 
						Manifests []Descriptor `json:"manifests"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,9 @@ import "github.com/opencontainers/image-spec/specs-go"
 | 
				
			||||||
type Manifest struct {
 | 
					type Manifest struct {
 | 
				
			||||||
	specs.Versioned
 | 
						specs.Versioned
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// MediaType specificies the type of this document data structure e.g. `application/vnd.oci.image.manifest.v1+json`
 | 
				
			||||||
 | 
						MediaType string `json:"mediaType,omitempty"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Config references a configuration object for a container, by digest.
 | 
						// Config references a configuration object for a container, by digest.
 | 
				
			||||||
	// The referenced configuration object is a JSON blob that the runtime uses to set up the container.
 | 
						// The referenced configuration object is a JSON blob that the runtime uses to set up the container.
 | 
				
			||||||
	Config Descriptor `json:"config"`
 | 
						Config Descriptor `json:"config"`
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@ const (
 | 
				
			||||||
	// VersionMinor is for functionality in a backwards-compatible manner
 | 
						// VersionMinor is for functionality in a backwards-compatible manner
 | 
				
			||||||
	VersionMinor = 0
 | 
						VersionMinor = 0
 | 
				
			||||||
	// VersionPatch is for backwards-compatible bug fixes
 | 
						// VersionPatch is for backwards-compatible bug fixes
 | 
				
			||||||
	VersionPatch = 1
 | 
						VersionPatch = 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// VersionDev indicates development branch. Releases will be empty string.
 | 
						// VersionDev indicates development branch. Releases will be empty string.
 | 
				
			||||||
	VersionDev = "-dev"
 | 
						VersionDev = "-dev"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -340,7 +340,7 @@ github.com/onsi/gomega/types
 | 
				
			||||||
# github.com/opencontainers/go-digest v1.0.0
 | 
					# github.com/opencontainers/go-digest v1.0.0
 | 
				
			||||||
## explicit
 | 
					## explicit
 | 
				
			||||||
github.com/opencontainers/go-digest
 | 
					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
 | 
				
			||||||
## explicit
 | 
					## explicit
 | 
				
			||||||
github.com/opencontainers/image-spec/specs-go
 | 
					github.com/opencontainers/image-spec/specs-go
 | 
				
			||||||
github.com/opencontainers/image-spec/specs-go/v1
 | 
					github.com/opencontainers/image-spec/specs-go/v1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue