Browse code

vendor: github.com/opencontainers/image-spec v1.1.0-rc3

full diff: https://github.com/opencontainers/image-spec/compare/3a7f492d3f1b...v1.1.0-rc3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2023/04/29 07:51:30
Showing 13 changed files
... ...
@@ -416,13 +416,15 @@ func (i *ImageService) CreateImage(ctx context.Context, config []byte, parent st
416 416
 
417 417
 	// make an ocispec.Image from the docker/image.Image
418 418
 	ociImgToCreate := ocispec.Image{
419
-		Created:      &imgToCreate.Created,
420
-		Author:       imgToCreate.Author,
421
-		Architecture: imgToCreate.Architecture,
422
-		Variant:      imgToCreate.Variant,
423
-		OS:           imgToCreate.OS,
424
-		OSVersion:    imgToCreate.OSVersion,
425
-		OSFeatures:   imgToCreate.OSFeatures,
419
+		Created: &imgToCreate.Created,
420
+		Author:  imgToCreate.Author,
421
+		Platform: ocispec.Platform{
422
+			Architecture: imgToCreate.Architecture,
423
+			Variant:      imgToCreate.Variant,
424
+			OS:           imgToCreate.OS,
425
+			OSVersion:    imgToCreate.OSVersion,
426
+			OSFeatures:   imgToCreate.OSFeatures,
427
+		},
426 428
 		Config: ocispec.ImageConfig{
427 429
 			User:         imgToCreate.Config.User,
428 430
 			ExposedPorts: exposedPorts,
... ...
@@ -131,11 +131,13 @@ func generateCommitImageConfig(baseConfig ocispec.Image, diffID digest.Digest, o
131 131
 	}
132 132
 	logrus.Debugf("generateCommitImageConfig(): arch=%q, os=%q", arch, os)
133 133
 	return ocispec.Image{
134
-		Architecture: arch,
135
-		OS:           os,
136
-		Created:      &createdTime,
137
-		Author:       opts.Author,
138
-		Config:       containerConfigToOciImageConfig(opts.Config),
134
+		Platform: ocispec.Platform{
135
+			Architecture: arch,
136
+			OS:           os,
137
+		},
138
+		Created: &createdTime,
139
+		Author:  opts.Author,
140
+		Config:  containerConfigToOciImageConfig(opts.Config),
139 141
 		RootFS: ocispec.RootFS{
140 142
 			Type:    "layers",
141 143
 			DiffIDs: append(baseConfig.RootFS.DiffIDs, diffID),
... ...
@@ -86,11 +86,10 @@ func (i *ImageService) ImportImage(ctx context.Context, ref reference.Named, pla
86 86
 	ociCfg := containerConfigToOciImageConfig(imageConfig)
87 87
 	createdAt := time.Now()
88 88
 	config := ocispec.Image{
89
-		Architecture: platform.Architecture,
90
-		OS:           platform.OS,
91
-		Created:      &createdAt,
92
-		Author:       "",
93
-		Config:       ociCfg,
89
+		Platform: *platform,
90
+		Created:  &createdAt,
91
+		Author:   "",
92
+		Config:   ociCfg,
94 93
 		RootFS: ocispec.RootFS{
95 94
 			Type:    "layers",
96 95
 			DiffIDs: []digest.Digest{uncompressedDigest},
... ...
@@ -53,13 +53,10 @@ func createTestImage(ctx context.Context, t testing.TB, store content.Store) oci
53 53
 	layerDigest := w.Digest()
54 54
 	w.Close()
55 55
 
56
-	platform := platforms.DefaultSpec()
57
-
58 56
 	img := ocispec.Image{
59
-		Architecture: platform.Architecture,
60
-		OS:           platform.OS,
61
-		RootFS:       ocispec.RootFS{Type: "layers", DiffIDs: []digest.Digest{layerDigest}},
62
-		Config:       ocispec.ImageConfig{WorkingDir: "/"},
57
+		Platform: platforms.DefaultSpec(),
58
+		RootFS:   ocispec.RootFS{Type: "layers", DiffIDs: []digest.Digest{layerDigest}},
59
+		Config:   ocispec.ImageConfig{WorkingDir: "/"},
63 60
 	}
64 61
 	imgJSON, err := json.Marshal(img)
65 62
 	assert.NilError(t, err)
... ...
@@ -71,7 +71,7 @@ require (
71 71
 	github.com/moby/term v0.5.0
72 72
 	github.com/morikuni/aec v1.0.0
73 73
 	github.com/opencontainers/go-digest v1.0.0
74
-	github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b
74
+	github.com/opencontainers/image-spec v1.1.0-rc3
75 75
 	github.com/opencontainers/runc v1.1.7
76 76
 	github.com/opencontainers/runtime-spec v1.1.0-rc.2
77 77
 	github.com/opencontainers/selinux v1.11.0
... ...
@@ -1144,8 +1144,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
1144 1144
 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
1145 1145
 github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
1146 1146
 github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
1147
-github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b h1:YWuSjZCQAPM8UUBLkYUk1e+rZcvWHJmFb6i6rM44Xs8=
1148
-github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ=
1147
+github.com/opencontainers/image-spec v1.1.0-rc3 h1:fzg1mXZFj8YdPeNkRXMg+zb88BFV0Ys52cJydRwBkb8=
1148
+github.com/opencontainers/image-spec v1.1.0-rc3/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8=
1149 1149
 github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
1150 1150
 github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
1151 1151
 github.com/opencontainers/runc v1.0.0-rc10/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
... ...
@@ -65,7 +65,4 @@ const (
65 65
 
66 66
 	// AnnotationArtifactDescription is the annotation key for the human readable description for the artifact.
67 67
 	AnnotationArtifactDescription = "org.opencontainers.artifact.description"
68
-
69
-	// AnnotationReferrersFiltersApplied is the annotation key for the comma separated list of filters applied by the registry in the referrers listing.
70
-	AnnotationReferrersFiltersApplied = "org.opencontainers.referrers.filtersApplied"
71 68
 )
72 69
deleted file mode 100644
... ...
@@ -1,34 +0,0 @@
1
-// Copyright 2022 The Linux Foundation
2
-//
3
-// Licensed under the Apache License, Version 2.0 (the "License");
4
-// you may not use this file except in compliance with the License.
5
-// You may obtain a copy of the License at
6
-//
7
-//     http://www.apache.org/licenses/LICENSE-2.0
8
-//
9
-// Unless required by applicable law or agreed to in writing, software
10
-// distributed under the License is distributed on an "AS IS" BASIS,
11
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
-// See the License for the specific language governing permissions and
13
-// limitations under the License.
14
-
15
-package v1
16
-
17
-// Artifact describes an artifact manifest.
18
-// This structure provides `application/vnd.oci.artifact.manifest.v1+json` mediatype when marshalled to JSON.
19
-type Artifact struct {
20
-	// MediaType is the media type of the object this schema refers to.
21
-	MediaType string `json:"mediaType"`
22
-
23
-	// ArtifactType is the IANA media type of the artifact this schema refers to.
24
-	ArtifactType string `json:"artifactType"`
25
-
26
-	// Blobs is a collection of blobs referenced by this manifest.
27
-	Blobs []Descriptor `json:"blobs,omitempty"`
28
-
29
-	// Subject (reference) is an optional link from the artifact to another manifest forming an association between the artifact and the other manifest.
30
-	Subject *Descriptor `json:"subject,omitempty"`
31
-
32
-	// Annotations contains arbitrary metadata for the artifact manifest.
33
-	Annotations map[string]string `json:"annotations,omitempty"`
34
-}
... ...
@@ -49,13 +49,15 @@ type ImageConfig struct {
49 49
 	// StopSignal contains the system call signal that will be sent to the container to exit.
50 50
 	StopSignal string `json:"StopSignal,omitempty"`
51 51
 
52
-	// ArgsEscaped `[Deprecated]` - This field is present only for legacy
53
-	// compatibility with Docker and should not be used by new image builders.
54
-	// It is used by Docker for Windows images to indicate that the `Entrypoint`
55
-	// or `Cmd` or both, contains only a single element array, that is a
56
-	// pre-escaped, and combined into a single string `CommandLine`. If `true`
57
-	// the value in `Entrypoint` or `Cmd` should be used as-is to avoid double
58
-	// escaping.
52
+	// ArgsEscaped
53
+	//
54
+	// Deprecated: This field is present only for legacy compatibility with
55
+	// Docker and should not be used by new image builders.  It is used by Docker
56
+	// for Windows images to indicate that the `Entrypoint` or `Cmd` or both,
57
+	// contains only a single element array, that is a pre-escaped, and combined
58
+	// into a single string `CommandLine`. If `true` the value in `Entrypoint` or
59
+	// `Cmd` should be used as-is to avoid double escaping.
60
+	// https://github.com/opencontainers/image-spec/pull/892
59 61
 	ArgsEscaped bool `json:"ArgsEscaped,omitempty"`
60 62
 }
61 63
 
... ...
@@ -95,22 +97,8 @@ type Image struct {
95 95
 	// Author defines the name and/or email address of the person or entity which created and is responsible for maintaining the image.
96 96
 	Author string `json:"author,omitempty"`
97 97
 
98
-	// Architecture is the CPU architecture which the binaries in this image are built to run on.
99
-	Architecture string `json:"architecture"`
100
-
101
-	// Variant is the variant of the specified CPU architecture which image binaries are intended to run on.
102
-	Variant string `json:"variant,omitempty"`
103
-
104
-	// OS is the name of the operating system which the image is built to run on.
105
-	OS string `json:"os"`
106
-
107
-	// OSVersion is an optional field specifying the operating system
108
-	// version, for example on Windows `10.0.14393.1066`.
109
-	OSVersion string `json:"os.version,omitempty"`
110
-
111
-	// OSFeatures is an optional field specifying an array of strings,
112
-	// each listing a required OS feature (for example on Windows `win32k`).
113
-	OSFeatures []string `json:"os.features,omitempty"`
98
+	// Platform describes the platform which the image in the manifest runs on.
99
+	Platform
114 100
 
115 101
 	// Config defines the execution parameters which should be used as a base when running a container using the image.
116 102
 	Config ImageConfig `json:"config,omitempty"`
... ...
@@ -23,6 +23,9 @@ type Manifest struct {
23 23
 	// MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.manifest.v1+json`
24 24
 	MediaType string `json:"mediaType,omitempty"`
25 25
 
26
+	// ArtifactType specifies the IANA media type of artifact when the manifest is used for an artifact.
27
+	ArtifactType string `json:"artifactType,omitempty"`
28
+
26 29
 	// Config references a configuration object for a container, by digest.
27 30
 	// The referenced configuration object is a JSON blob that the runtime uses to set up the container.
28 31
 	Config Descriptor `json:"config"`
... ...
@@ -36,3 +39,11 @@ type Manifest struct {
36 36
 	// Annotations contains arbitrary metadata for the image manifest.
37 37
 	Annotations map[string]string `json:"annotations,omitempty"`
38 38
 }
39
+
40
+// ScratchDescriptor is the descriptor of a blob with content of `{}`.
41
+var ScratchDescriptor = Descriptor{
42
+	MediaType: MediaTypeScratch,
43
+	Digest:    `sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a`,
44
+	Size:      2,
45
+	Data:      []byte(`{}`),
46
+}
... ...
@@ -40,21 +40,36 @@ const (
40 40
 
41 41
 	// MediaTypeImageLayerNonDistributable is the media type for layers referenced by
42 42
 	// the manifest but with distribution restrictions.
43
+	//
44
+	// Deprecated: Non-distributable layers are deprecated, and not recommended
45
+	// for future use. Implementations SHOULD NOT produce new non-distributable
46
+	// layers.
47
+	// https://github.com/opencontainers/image-spec/pull/965
43 48
 	MediaTypeImageLayerNonDistributable = "application/vnd.oci.image.layer.nondistributable.v1.tar"
44 49
 
45 50
 	// MediaTypeImageLayerNonDistributableGzip is the media type for
46 51
 	// gzipped layers referenced by the manifest but with distribution
47 52
 	// restrictions.
53
+	//
54
+	// Deprecated: Non-distributable layers are deprecated, and not recommended
55
+	// for future use. Implementations SHOULD NOT produce new non-distributable
56
+	// layers.
57
+	// https://github.com/opencontainers/image-spec/pull/965
48 58
 	MediaTypeImageLayerNonDistributableGzip = "application/vnd.oci.image.layer.nondistributable.v1.tar+gzip"
49 59
 
50 60
 	// MediaTypeImageLayerNonDistributableZstd is the media type for zstd
51 61
 	// compressed layers referenced by the manifest but with distribution
52 62
 	// restrictions.
63
+	//
64
+	// Deprecated: Non-distributable layers are deprecated, and not recommended
65
+	// for future use. Implementations SHOULD NOT produce new non-distributable
66
+	// layers.
67
+	// https://github.com/opencontainers/image-spec/pull/965
53 68
 	MediaTypeImageLayerNonDistributableZstd = "application/vnd.oci.image.layer.nondistributable.v1.tar+zstd"
54 69
 
55 70
 	// MediaTypeImageConfig specifies the media type for the image configuration.
56 71
 	MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json"
57 72
 
58
-	// MediaTypeArtifactManifest specifies the media type for a content descriptor.
59
-	MediaTypeArtifactManifest = "application/vnd.oci.artifact.manifest.v1+json"
73
+	// MediaTypeScratch specifies the media type for an unused blob containing the value `{}`
74
+	MediaTypeScratch = "application/vnd.oci.scratch.v1+json"
60 75
 )
... ...
@@ -25,7 +25,7 @@ const (
25 25
 	VersionPatch = 0
26 26
 
27 27
 	// VersionDev indicates development branch. Releases will be empty string.
28
-	VersionDev = "-dev"
28
+	VersionDev = "-rc.3"
29 29
 )
30 30
 
31 31
 // Version is the specification version that the package types support.
... ...
@@ -841,8 +841,8 @@ github.com/morikuni/aec
841 841
 ## explicit; go 1.13
842 842
 github.com/opencontainers/go-digest
843 843
 github.com/opencontainers/go-digest/digestset
844
-# github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b
845
-## explicit; go 1.17
844
+# github.com/opencontainers/image-spec v1.1.0-rc3
845
+## explicit; go 1.18
846 846
 github.com/opencontainers/image-spec/identity
847 847
 github.com/opencontainers/image-spec/specs-go
848 848
 github.com/opencontainers/image-spec/specs-go/v1