diff --git a/cmd/ctr/checkpoint.go b/cmd/ctr/checkpoint.go index 2cee5b0dc..fc35cb335 100644 --- a/cmd/ctr/checkpoint.go +++ b/cmd/ctr/checkpoint.go @@ -104,24 +104,20 @@ var checkpointCommand = cli.Command{ return err } } - var index ocispec.ImageIndex + var index ocispec.Index for _, d := range append(checkpoint.Descriptors, additionalDescriptors...) { - index.Manifests = append(index.Manifests, ocispec.ManifestDescriptor{ - Descriptor: ocispec.Descriptor{ - MediaType: d.MediaType, - Size: d.Size_, - Digest: d.Digest, - }, - Platform: ocispec.Platform{ + index.Manifests = append(index.Manifests, ocispec.Descriptor{ + MediaType: d.MediaType, + Size: d.Size_, + Digest: d.Digest, + Platform: &ocispec.Platform{ OS: runtime.GOOS, Architecture: runtime.GOARCH, }, }) } // add image to the index - index.Manifests = append(index.Manifests, ocispec.ManifestDescriptor{ - Descriptor: image.Target, - }) + index.Manifests = append(index.Manifests, image.Target) // checkpoint rw layer snapshotter, err := getSnapshotter(context) if err != nil { @@ -135,13 +131,11 @@ var checkpointCommand = cli.Command{ if err != nil { return err } - index.Manifests = append(index.Manifests, ocispec.ManifestDescriptor{ - Descriptor: rw, - Platform: ocispec.Platform{ - OS: runtime.GOOS, - Architecture: runtime.GOARCH, - }, - }) + rw.Platform = &ocispec.Platform{ + OS: runtime.GOOS, + Architecture: runtime.GOARCH, + } + index.Manifests = append(index.Manifests, rw) data, err := json.Marshal(index) if err != nil { return err diff --git a/cmd/ctr/run.go b/cmd/ctr/run.go index c782c8864..eae380606 100644 --- a/cmd/ctr/run.go +++ b/cmd/ctr/run.go @@ -132,7 +132,7 @@ var runCommand = cli.Command{ } var spec []byte if checkpointIndex != "" { - var index ocispec.ImageIndex + var index ocispec.Index r, err := content.Reader(ctx, checkpointIndex) if err != nil { return err @@ -146,7 +146,7 @@ var runCommand = cli.Command{ for _, m := range index.Manifests { switch m.MediaType { case images.MediaTypeContainerd1Checkpoint: - fkingo := m.Descriptor + fkingo := m checkpoint = &fkingo case images.MediaTypeContainerd1CheckpointConfig: if r, err = content.Reader(ctx, m.Digest); err != nil { @@ -159,7 +159,7 @@ var runCommand = cli.Command{ } case images.MediaTypeDockerSchema2Manifest: // 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 { return err } @@ -169,7 +169,7 @@ var runCommand = cli.Command{ } } case ocispec.MediaTypeImageLayer: - rw = m.Descriptor + rw = m } } if mounts, err = snapshotter.Mounts(ctx, id); err != nil { diff --git a/vendor.conf b/vendor.conf index 0d06aff28..2e8d348ca 100644 --- a/vendor.conf +++ b/vendor.conf @@ -28,7 +28,7 @@ github.com/pkg/errors v0.8.0 github.com/nightlyone/lockfile 1d49c987357a327b5b03aa84cbddd582c328615d github.com/opencontainers/go-digest 21dfd564fd89c944783d00d069f33e3e7123c448 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 golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c github.com/BurntSushi/toml v0.2.0-21-g9906417 diff --git a/vendor/github.com/opencontainers/image-spec/README.md b/vendor/github.com/opencontainers/image-spec/README.md index c63d8b720..5ab5554e4 100644 --- a/vendor/github.com/opencontainers/image-spec/README.md +++ b/vendor/github.com/opencontainers/image-spec/README.md @@ -7,7 +7,7 @@ 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). 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). 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?** 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. +Find more [FAQ on the OCI site](https://www.opencontainers.org/faq). + ## 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. @@ -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). 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. -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 @@ -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 [irc-logs]: http://ircbot.wl.linuxfoundation.org/eavesdrop/%23opencontainers/ +[minutes]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/ diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/config.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/config.go index ddbc58622..8475ff741 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/config.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/config.go @@ -14,7 +14,11 @@ 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. type ImageConfig struct { @@ -40,7 +44,10 @@ type ImageConfig struct { WorkingDir string `json:"WorkingDir,omitempty"` // 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 @@ -49,13 +56,13 @@ type RootFS struct { Type string `json:"type"` // 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. 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 time.Time `json:"created,omitempty"` + Created *time.Time `json:"created,omitempty"` // CreatedBy is the command which created the layer. 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. 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 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 string `json:"author,omitempty"` diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go index fdf50c744..6e442a085 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go @@ -17,7 +17,8 @@ package v1 import digest "github.com/opencontainers/go-digest" // 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 { // MediaType is the media type of the object this schema refers to. MediaType string `json:"mediaType,omitempty"` @@ -33,4 +34,31 @@ type Descriptor struct { // Annotations contains arbitrary metadata relating to the targeted content. 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"` } diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/image_index.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/image_index.go deleted file mode 100644 index 3c1b6b17e..000000000 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/image_index.go +++ /dev/null @@ -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"` -} diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go new file mode 100644 index 000000000..4e6c4b236 --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go @@ -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"` +} diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go index 42d8c6a2f..7ff32c40b 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go @@ -27,6 +27,6 @@ type Manifest struct { // Layers is an indexed list of layers referenced by the manifest. 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"` } diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go index c3f2e8ab4..bad7bb97f 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go @@ -18,6 +18,9 @@ const ( // MediaTypeDescriptor specifies the media type for a content descriptor. 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 = "application/vnd.oci.image.manifest.v1+json" diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/version.go b/vendor/github.com/opencontainers/image-spec/specs-go/version.go index 44babdfe7..f4cda6ed8 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/version.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/version.go @@ -25,7 +25,7 @@ const ( VersionPatch = 0 // VersionDev indicates development branch. Releases will be empty string. - VersionDev = "-rc5" + VersionDev = "-rc6-dev" ) // Version is the specification version that the package types support.