Merge pull request #928 from AkihiroSuda/oci-rc6

vendor: OCI Image Spec v1.0.0-rc6
This commit is contained in:
Kenfe-Mickaël Laventure 2017-05-30 10:09:28 -07:00 committed by GitHub
commit 0e56c47f8c
11 changed files with 97 additions and 107 deletions

View File

@ -104,24 +104,20 @@ var checkpointCommand = cli.Command{
return err return err
} }
} }
var index ocispec.ImageIndex var index ocispec.Index
for _, d := range append(checkpoint.Descriptors, additionalDescriptors...) { for _, d := range append(checkpoint.Descriptors, additionalDescriptors...) {
index.Manifests = append(index.Manifests, ocispec.ManifestDescriptor{ index.Manifests = append(index.Manifests, ocispec.Descriptor{
Descriptor: ocispec.Descriptor{
MediaType: d.MediaType, MediaType: d.MediaType,
Size: d.Size_, Size: d.Size_,
Digest: d.Digest, Digest: d.Digest,
}, Platform: &ocispec.Platform{
Platform: ocispec.Platform{
OS: runtime.GOOS, OS: runtime.GOOS,
Architecture: runtime.GOARCH, Architecture: runtime.GOARCH,
}, },
}) })
} }
// add image to the index // add image to the index
index.Manifests = append(index.Manifests, ocispec.ManifestDescriptor{ index.Manifests = append(index.Manifests, image.Target)
Descriptor: image.Target,
})
// checkpoint rw layer // checkpoint rw layer
snapshotter, err := getSnapshotter(context) snapshotter, err := getSnapshotter(context)
if err != nil { if err != nil {
@ -135,13 +131,11 @@ var checkpointCommand = cli.Command{
if err != nil { if err != nil {
return err return err
} }
index.Manifests = append(index.Manifests, ocispec.ManifestDescriptor{ rw.Platform = &ocispec.Platform{
Descriptor: rw,
Platform: ocispec.Platform{
OS: runtime.GOOS, OS: runtime.GOOS,
Architecture: runtime.GOARCH, Architecture: runtime.GOARCH,
}, }
}) index.Manifests = append(index.Manifests, rw)
data, err := json.Marshal(index) data, err := json.Marshal(index)
if err != nil { if err != nil {
return err return err

View File

@ -132,7 +132,7 @@ var runCommand = cli.Command{
} }
var spec []byte var spec []byte
if checkpointIndex != "" { if checkpointIndex != "" {
var index ocispec.ImageIndex var index ocispec.Index
r, err := content.Reader(ctx, checkpointIndex) r, err := content.Reader(ctx, checkpointIndex)
if err != nil { if err != nil {
return err return err
@ -146,7 +146,7 @@ var runCommand = cli.Command{
for _, m := range index.Manifests { for _, m := range index.Manifests {
switch m.MediaType { switch m.MediaType {
case images.MediaTypeContainerd1Checkpoint: case images.MediaTypeContainerd1Checkpoint:
fkingo := m.Descriptor fkingo := m
checkpoint = &fkingo checkpoint = &fkingo
case images.MediaTypeContainerd1CheckpointConfig: case images.MediaTypeContainerd1CheckpointConfig:
if r, err = content.Reader(ctx, m.Digest); err != nil { if r, err = content.Reader(ctx, m.Digest); err != nil {
@ -159,7 +159,7 @@ var runCommand = cli.Command{
} }
case images.MediaTypeDockerSchema2Manifest: case images.MediaTypeDockerSchema2Manifest:
// make sure we have the original image that was used during checkpoint // make sure we have the original image that was used during checkpoint
diffIDs, err := images.RootFS(ctx, content, m.Descriptor) diffIDs, err := images.RootFS(ctx, content, m)
if err != nil { if err != nil {
return err return err
} }
@ -169,7 +169,7 @@ var runCommand = cli.Command{
} }
} }
case ocispec.MediaTypeImageLayer: case ocispec.MediaTypeImageLayer:
rw = m.Descriptor rw = m
} }
} }
if mounts, err = snapshotter.Mounts(ctx, id); err != nil { if mounts, err = snapshotter.Mounts(ctx, id); err != nil {

View File

@ -28,7 +28,7 @@ github.com/pkg/errors v0.8.0
github.com/nightlyone/lockfile 1d49c987357a327b5b03aa84cbddd582c328615d github.com/nightlyone/lockfile 1d49c987357a327b5b03aa84cbddd582c328615d
github.com/opencontainers/go-digest 21dfd564fd89c944783d00d069f33e3e7123c448 github.com/opencontainers/go-digest 21dfd564fd89c944783d00d069f33e3e7123c448
golang.org/x/sys f3918c30c5c2cb527c0b071a27c35120a6c0719a golang.org/x/sys f3918c30c5c2cb527c0b071a27c35120a6c0719a
github.com/opencontainers/image-spec v1.0.0-rc5 github.com/opencontainers/image-spec v1.0.0-rc6
github.com/containerd/continuity f4ad4294c92f596c9241947c416d1297f9faf3ea github.com/containerd/continuity f4ad4294c92f596c9241947c416d1297f9faf3ea
golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c
github.com/BurntSushi/toml v0.2.0-21-g9906417 github.com/BurntSushi/toml v0.2.0-21-g9906417

View File

@ -7,7 +7,7 @@
The OCI Image Format project creates and maintains the software shipping container image format spec (OCI Image Format). The OCI Image Format project creates and maintains the software shipping container image format spec (OCI Image Format).
The specification can be found [here](spec.md). **[The specification can be found here](spec.md).**
This repository also provides [Go types](specs-go), [intra-blob validation tooling, and JSON Schema](schema). This repository also provides [Go types](specs-go), [intra-blob validation tooling, and JSON Schema](schema).
The Go types and validation should be compatible with the current Go release; earlier Go releases are not supported. The Go types and validation should be compatible with the current Go release; earlier Go releases are not supported.
@ -42,22 +42,13 @@ To support this UX the OCI Image Format contains sufficient information to launc
A: Distribution, for example using HTTP as both Docker v2.2 and AppC do today, is currently out of scope on the [OCI Scope Table](https://www.opencontainers.org/about/oci-scope-table). A: Distribution, for example using HTTP as both Docker v2.2 and AppC do today, is currently out of scope on the [OCI Scope Table](https://www.opencontainers.org/about/oci-scope-table).
There has been [some discussion on the TOB mailing list](https://groups.google.com/a/opencontainers.org/d/msg/tob/A3JnmI-D-6Y/tLuptPDHAgAJ) to make distribution an optional layer, but this topic is a work in progress. There has been [some discussion on the TOB mailing list](https://groups.google.com/a/opencontainers.org/d/msg/tob/A3JnmI-D-6Y/tLuptPDHAgAJ) to make distribution an optional layer, but this topic is a work in progress.
**Q: Why a new project?**
A: The [first OCI spec](https://github.com/opencontainers/runtime-spec) centered around defining the run side of a container.
This is generally seen to be an orthogonal concern to the shipping container component.
As practical examples of this separation you see many organizations separating these concerns into different teams and organizations: the Docker Distribution project and the Docker containerd project; Amazon ECS and Amazon EC2 Container Registry, etc.
**Q: Why work on this?**
A: We are seeing many independent implementations of container image handling including build systems, registries, and image analysis tools.
As an organization we would like to encourage this growth and bring people together to ensure a technically correct and open specification continues to evolve reflecting the OCI values.
**Q: What happens to AppC or Docker Image Formats?** **Q: What happens to AppC or Docker Image Formats?**
A: Existing formats can continue to be a proving ground for technologies, as needed. A: Existing formats can continue to be a proving ground for technologies, as needed.
The OCI Image Format project strives to provide a dependable open specification that can be shared between different tools and be evolved for years or decades of compatibility; as the deb and rpm format have. The OCI Image Format project strives to provide a dependable open specification that can be shared between different tools and be evolved for years or decades of compatibility; as the deb and rpm format have.
Find more [FAQ on the OCI site](https://www.opencontainers.org/faq).
## Roadmap ## Roadmap
The [GitHub milestones](https://github.com/opencontainers/image-spec/milestones) lay out the path to the OCI v1.0.0 release in late 2016. The [GitHub milestones](https://github.com/opencontainers/image-spec/milestones) lay out the path to the OCI v1.0.0 release in late 2016.
@ -85,7 +76,7 @@ When in doubt, start on the [mailing-list](#mailing-list).
The contributors and maintainers of all OCI projects have a weekly meeting Wednesdays at 2:00 PM (USA Pacific). The contributors and maintainers of all OCI projects have a weekly meeting Wednesdays at 2:00 PM (USA Pacific).
Everyone is welcome to participate via [UberConference web][UberConference] or audio-only: +1-415-968-0849 (no PIN needed). Everyone is welcome to participate via [UberConference web][UberConference] or audio-only: +1-415-968-0849 (no PIN needed).
An initial agenda will be posted to the [mailing list](#mailing-list) earlier in the week, and everyone is welcome to propose additional topics or suggest other agenda alterations there. An initial agenda will be posted to the [mailing list](#mailing-list) earlier in the week, and everyone is welcome to propose additional topics or suggest other agenda alterations there.
Minutes are posted to the [mailing list](#mailing-list) and minutes from past calls are archived to the [wiki](https://github.com/opencontainers/runtime-spec/wiki) for those who are unable to join the call. Minutes are posted to the [mailing list](#mailing-list) and minutes from past calls are archived [here][minutes].
## Mailing List ## Mailing List
@ -173,3 +164,4 @@ Read more on [How to Write a Git Commit Message](http://chris.beams.io/posts/git
[UberConference]: https://www.uberconference.com/opencontainers [UberConference]: https://www.uberconference.com/opencontainers
[irc-logs]: http://ircbot.wl.linuxfoundation.org/eavesdrop/%23opencontainers/ [irc-logs]: http://ircbot.wl.linuxfoundation.org/eavesdrop/%23opencontainers/
[minutes]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/

View File

@ -14,7 +14,11 @@
package v1 package v1
import "time" import (
"time"
digest "github.com/opencontainers/go-digest"
)
// ImageConfig defines the execution parameters which should be used as a base when running a container using an image. // ImageConfig defines the execution parameters which should be used as a base when running a container using an image.
type ImageConfig struct { type ImageConfig struct {
@ -40,7 +44,10 @@ type ImageConfig struct {
WorkingDir string `json:"WorkingDir,omitempty"` WorkingDir string `json:"WorkingDir,omitempty"`
// Labels contains arbitrary metadata for the container. // Labels contains arbitrary metadata for the container.
Labels map[string]string `json:"labels,omitempty"` Labels map[string]string `json:"Labels,omitempty"`
// StopSignal contains the system call signal that will be sent to the container to exit.
StopSignal string `json:"StopSignal,omitempty"`
} }
// RootFS describes a layer content addresses // RootFS describes a layer content addresses
@ -49,13 +56,13 @@ type RootFS struct {
Type string `json:"type"` Type string `json:"type"`
// DiffIDs is an array of layer content hashes (DiffIDs), in order from bottom-most to top-most. // DiffIDs is an array of layer content hashes (DiffIDs), in order from bottom-most to top-most.
DiffIDs []string `json:"diff_ids"` DiffIDs []digest.Digest `json:"diff_ids"`
} }
// History describes the history of a layer. // History describes the history of a layer.
type History struct { type History struct {
// Created is the combined date and time at which the layer was created, formatted as defined by RFC 3339, section 5.6. // Created is the combined date and time at which the layer was created, formatted as defined by RFC 3339, section 5.6.
Created time.Time `json:"created,omitempty"` Created *time.Time `json:"created,omitempty"`
// CreatedBy is the command which created the layer. // CreatedBy is the command which created the layer.
CreatedBy string `json:"created_by,omitempty"` CreatedBy string `json:"created_by,omitempty"`
@ -74,7 +81,7 @@ type History struct {
// This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON. // This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON.
type Image struct { type Image struct {
// Created is the combined date and time at which the image was created, formatted as defined by RFC 3339, section 5.6. // Created is the combined date and time at which the image was created, formatted as defined by RFC 3339, section 5.6.
Created time.Time `json:"created,omitempty"` Created *time.Time `json:"created,omitempty"`
// Author defines the name and/or email address of the person or entity which created and is responsible for maintaining the image. // Author defines the name and/or email address of the person or entity which created and is responsible for maintaining the image.
Author string `json:"author,omitempty"` Author string `json:"author,omitempty"`

View File

@ -17,7 +17,8 @@ package v1
import digest "github.com/opencontainers/go-digest" import digest "github.com/opencontainers/go-digest"
// Descriptor describes the disposition of targeted content. // Descriptor describes the disposition of targeted content.
// This structure provides `application/vnd.oci.descriptor.v1+json` mediatype when marshalled to JSON // This structure provides `application/vnd.oci.descriptor.v1+json` mediatype
// when marshalled to JSON.
type Descriptor struct { type Descriptor struct {
// MediaType is the media type of the object this schema refers to. // MediaType is the media type of the object this schema refers to.
MediaType string `json:"mediaType,omitempty"` MediaType string `json:"mediaType,omitempty"`
@ -33,4 +34,31 @@ type Descriptor struct {
// Annotations contains arbitrary metadata relating to the targeted content. // Annotations contains arbitrary metadata relating to the targeted content.
Annotations map[string]string `json:"annotations,omitempty"` Annotations map[string]string `json:"annotations,omitempty"`
// Platform describes the platform which the image in the manifest runs on.
//
// This should only be used when referring to a manifest.
Platform *Platform `json:"platform,omitempty"`
}
// Platform describes the platform which the image in the manifest runs on.
type Platform struct {
// Architecture field specifies the CPU architecture, for example
// `amd64` or `ppc64`.
Architecture string `json:"architecture"`
// OS specifies the operating system, for example `linux` or `windows`.
OS string `json:"os"`
// OSVersion is an optional field specifying the operating system
// version, for example on Windows `10.0.14393.1066`.
OSVersion string `json:"os.version,omitempty"`
// OSFeatures is an optional field specifying an array of strings,
// each listing a required OS feature (for example on Windows `win32k`).
OSFeatures []string `json:"os.features,omitempty"`
// Variant is an optional field specifying a variant of the CPU, for
// example `v7` to specify ARMv7 when architecture is `arm`.
Variant string `json:"variant,omitempty"`
} }

View File

@ -1,63 +0,0 @@
// Copyright 2016 The Linux Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import "github.com/opencontainers/image-spec/specs-go"
// Platform describes the platform which the image in the manifest runs on.
type Platform struct {
// Architecture field specifies the CPU architecture, for example
// `amd64` or `ppc64`.
Architecture string `json:"architecture"`
// OS specifies the operating system, for example `linux` or `windows`.
OS string `json:"os"`
// OSVersion is an optional field specifying the operating system
// version, for example `10.0.10586`.
OSVersion string `json:"os.version,omitempty"`
// OSFeatures is an optional field specifying an array of strings,
// each listing a required OS feature (for example on Windows `win32k`).
OSFeatures []string `json:"os.features,omitempty"`
// Variant is an optional field specifying a variant of the CPU, for
// example `ppc64le` to specify a little-endian version of a PowerPC CPU.
Variant string `json:"variant,omitempty"`
// Features is an optional field specifying an array of strings, each
// listing a required CPU feature (for example `sse4` or `aes`).
Features []string `json:"features,omitempty"`
}
// ManifestDescriptor describes a platform specific manifest.
type ManifestDescriptor struct {
Descriptor
// Platform describes the platform which the image in the manifest runs on.
Platform Platform `json:"platform"`
}
// ImageIndex references manifests for various platforms.
// This structure provides `application/vnd.oci.image.index.v1+json` mediatype when marshalled to JSON.
type ImageIndex struct {
specs.Versioned
// Manifests references platform specific manifests.
Manifests []ManifestDescriptor `json:"manifests"`
// Annotations contains arbitrary metadata for the image index.
Annotations map[string]string `json:"annotations,omitempty"`
}

View File

@ -0,0 +1,29 @@
// Copyright 2016 The Linux Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import "github.com/opencontainers/image-spec/specs-go"
// Index references manifests for various platforms.
// This structure provides `application/vnd.oci.image.index.v1+json` mediatype when marshalled to JSON.
type Index struct {
specs.Versioned
// Manifests references platform specific manifests.
Manifests []Descriptor `json:"manifests"`
// Annotations contains arbitrary metadata for the image index.
Annotations map[string]string `json:"annotations,omitempty"`
}

View File

@ -27,6 +27,6 @@ type Manifest struct {
// Layers is an indexed list of layers referenced by the manifest. // Layers is an indexed list of layers referenced by the manifest.
Layers []Descriptor `json:"layers"` Layers []Descriptor `json:"layers"`
// Annotations contains arbitrary metadata for the manifest. // Annotations contains arbitrary metadata for the image manifest.
Annotations map[string]string `json:"annotations,omitempty"` Annotations map[string]string `json:"annotations,omitempty"`
} }

View File

@ -18,6 +18,9 @@ const (
// MediaTypeDescriptor specifies the media type for a content descriptor. // MediaTypeDescriptor specifies the media type for a content descriptor.
MediaTypeDescriptor = "application/vnd.oci.descriptor.v1+json" MediaTypeDescriptor = "application/vnd.oci.descriptor.v1+json"
// MediaTypeLayoutHeader specifies the media type for the oci-layout.
MediaTypeLayoutHeader = "application/vnd.oci.layout.header.v1+json"
// MediaTypeImageManifest specifies the media type for an image manifest. // MediaTypeImageManifest specifies the media type for an image manifest.
MediaTypeImageManifest = "application/vnd.oci.image.manifest.v1+json" MediaTypeImageManifest = "application/vnd.oci.image.manifest.v1+json"

View File

@ -25,7 +25,7 @@ const (
VersionPatch = 0 VersionPatch = 0
// VersionDev indicates development branch. Releases will be empty string. // VersionDev indicates development branch. Releases will be empty string.
VersionDev = "-rc5" VersionDev = "-rc6-dev"
) )
// Version is the specification version that the package types support. // Version is the specification version that the package types support.