Skip to content

Commit e0e2768

Browse files
authored
Vendored image-spec should be private (#429)
Signed-off-by: Brandon Mitchell <git@bmitch.net>
1 parent 215045b commit e0e2768

3 files changed

Lines changed: 44 additions & 44 deletions

File tree

conformance/05_referrers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ var test05Referrers = func() {
192192
Expect(err).To(BeNil())
193193
Expect(resp.StatusCode()).To(Equal(http.StatusOK))
194194

195-
var index Index
195+
var index index
196196
err = json.Unmarshal(resp.Body(), &index)
197197
Expect(err).To(BeNil())
198198
Expect(len(index.Manifests)).To(BeZero())
@@ -209,7 +209,7 @@ var test05Referrers = func() {
209209
Expect(h).To(Equal(configs[4].Digest))
210210
}
211211

212-
var index Index
212+
var index index
213213
err = json.Unmarshal(resp.Body(), &index)
214214
Expect(err).To(BeNil())
215215
Expect(len(index.Manifests)).To(Equal(4))
@@ -228,7 +228,7 @@ var test05Referrers = func() {
228228
Expect(h).To(Equal(configs[4].Digest))
229229
}
230230

231-
var index Index
231+
var index index
232232
err = json.Unmarshal(resp.Body(), &index)
233233
Expect(err).To(BeNil())
234234

conformance/image.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
// conformance tests, and to add new unspecified fields, to test registry
1010
// conformance in handling unknown fields.
1111

12-
// Manifest provides `application/vnd.oci.image.manifest.v1+json` mediatype structure when marshalled to JSON.
13-
type Manifest struct {
12+
// manifest provides `application/vnd.oci.image.manifest.v1+json` mediatype structure when marshalled to JSON.
13+
type manifest struct {
1414
// SchemaVersion is the image manifest schema that this image follows
1515
SchemaVersion int `json:"schemaVersion"`
1616

@@ -19,19 +19,19 @@ type Manifest struct {
1919

2020
// Config references a configuration object for a container, by digest.
2121
// The referenced configuration object is a JSON blob that the runtime uses to set up the container.
22-
Config Descriptor `json:"config"`
22+
Config descriptor `json:"config"`
2323

2424
// Layers is an indexed list of layers referenced by the manifest.
25-
Layers []Descriptor `json:"layers"`
25+
Layers []descriptor `json:"layers"`
2626

2727
// Subject is an optional link from the image manifest to another manifest forming an association between the image manifest and the other manifest.
28-
Subject *Descriptor `json:"subject,omitempty"`
28+
Subject *descriptor `json:"subject,omitempty"`
2929
}
3030

31-
// Descriptor describes the disposition of targeted content.
31+
// descriptor describes the disposition of targeted content.
3232
// This structure provides `application/vnd.oci.descriptor.v1+json` mediatype
3333
// when marshalled to JSON.
34-
type Descriptor struct {
34+
type descriptor struct {
3535
// MediaType is the media type of the object this schema refers to.
3636
MediaType string `json:"mediaType,omitempty"`
3737

@@ -50,18 +50,18 @@ type Descriptor struct {
5050
NewUnspecifiedField []byte `json:"newUnspecifiedField"`
5151
}
5252

53-
// RootFS describes a layer content addresses
54-
type RootFS struct {
53+
// rootFS describes a layer content addresses
54+
type rootFS struct {
5555
// Type is the type of the rootfs.
5656
Type string `json:"type"`
5757

5858
// DiffIDs is an array of layer content hashes (DiffIDs), in order from bottom-most to top-most.
5959
DiffIDs []digest.Digest `json:"diff_ids"`
6060
}
6161

62-
// Image is the JSON structure which describes some basic information about the image.
62+
// image is the JSON structure which describes some basic information about the image.
6363
// This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON.
64-
type Image struct {
64+
type image struct {
6565
// Author defines the name and/or email address of the person or entity which created and is responsible for maintaining the image.
6666
Author string `json:"author,omitempty"`
6767

@@ -75,20 +75,20 @@ type Image struct {
7575
OS string `json:"os"`
7676

7777
// RootFS references the layer content addresses used by the image.
78-
RootFS RootFS `json:"rootfs"`
78+
RootFS rootFS `json:"rootfs"`
7979
}
8080

81-
// Index references manifests for various platforms.
81+
// index references manifests for various platforms.
8282
// This structure provides `application/vnd.oci.image.index.v1+json` mediatype when marshalled to JSON.
83-
type Index struct {
83+
type index struct {
8484
// SchemaVersion is the image manifest schema that this image follows
8585
SchemaVersion int `json:"schemaVersion"`
8686

8787
// MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.index.v1+json`
8888
MediaType string `json:"mediaType,omitempty"`
8989

9090
// Manifests references platform specific manifests.
91-
Manifests []Descriptor `json:"manifests"`
91+
Manifests []descriptor `json:"manifests"`
9292

9393
// Annotations contains arbitrary metadata for the image index.
9494
Annotations map[string]string `json:"annotations,omitempty"`

conformance/setup.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ var (
136136
emptyLayerManifestDigest string
137137
nonexistentManifest string
138138
emptyJSONBlob []byte
139-
emptyJSONDescriptor Descriptor
139+
emptyJSONDescriptor descriptor
140140
refsManifestAConfigArtifactContent []byte
141141
refsManifestAConfigArtifactDigest string
142142
refsManifestALayerArtifactContent []byte
@@ -208,10 +208,10 @@ func init() {
208208
// in order to get a unique blob digest, we create a new author
209209
// field for the config on each run.
210210
randomAuthor := randomString(16)
211-
config := Image{
211+
config := image{
212212
Architecture: "amd64",
213213
OS: "linux",
214-
RootFS: RootFS{
214+
RootFS: rootFS{
215215
Type: "layers",
216216
DiffIDs: []godigest.Digest{},
217217
},
@@ -245,16 +245,16 @@ func init() {
245245
layerBlobDigest = layerBlobDigestRaw.String()
246246
layerBlobContentLength = fmt.Sprintf("%d", len(layerBlobData))
247247

248-
layers := []Descriptor{{
248+
layers := []descriptor{{
249249
MediaType: "application/vnd.oci.image.layer.v1.tar+gzip",
250250
Size: int64(len(layerBlobData)),
251251
Digest: layerBlobDigestRaw,
252252
}}
253253

254254
// create a unique manifest for each workflow category
255255
for i := 0; i < numWorkflows; i++ {
256-
manifest := Manifest{
257-
Config: Descriptor{
256+
manifest := manifest{
257+
Config: descriptor{
258258
MediaType: "application/vnd.oci.image.config.v1+json",
259259
Digest: godigest.Digest(configs[i].Digest),
260260
Size: int64(len(configs[i].Content)),
@@ -284,15 +284,15 @@ func init() {
284284
}
285285

286286
// used in push test
287-
emptyLayerManifest := Manifest{
288-
Config: Descriptor{
287+
emptyLayerManifest := manifest{
288+
Config: descriptor{
289289
MediaType: "application/vnd.oci.image.config.v1+json",
290290
Digest: godigest.Digest(configs[1].Digest),
291291
Size: int64(len(configs[1].Content)),
292292
Data: configs[1].Content, // must be the config content.
293293
NewUnspecifiedField: []byte("hello world"), // content doesn't matter.
294294
},
295-
Layers: []Descriptor{},
295+
Layers: []descriptor{},
296296
}
297297
emptyLayerManifest.SchemaVersion = 2
298298

@@ -314,7 +314,7 @@ func init() {
314314

315315
// used in referrers test (artifacts with Subject field set)
316316
emptyJSONBlob = []byte("{}")
317-
emptyJSONDescriptor = Descriptor{
317+
emptyJSONDescriptor = descriptor{
318318
MediaType: "application/vnd.oci.empty.v1+json",
319319
Size: int64(len(emptyJSONBlob)),
320320
Digest: godigest.FromBytes(emptyJSONBlob),
@@ -333,17 +333,17 @@ func init() {
333333
testRefArtifactTypeB = "application/vnd.nba.strawberry.jam.croissant"
334334

335335
// artifact with Subject ref using config.MediaType = artifactType
336-
refsManifestAConfigArtifact := Manifest{
337-
Config: Descriptor{
336+
refsManifestAConfigArtifact := manifest{
337+
Config: descriptor{
338338
MediaType: testRefArtifactTypeA,
339339
Size: int64(len(testRefBlobA)),
340340
Digest: godigest.FromBytes(testRefBlobA),
341341
},
342-
Subject: &Descriptor{
342+
Subject: &descriptor{
343343
Size: int64(len(manifests[4].Content)),
344344
Digest: godigest.FromBytes(manifests[4].Content),
345345
},
346-
Layers: []Descriptor{
346+
Layers: []descriptor{
347347
emptyJSONDescriptor,
348348
},
349349
}
@@ -355,17 +355,17 @@ func init() {
355355

356356
refsManifestAConfigArtifactDigest = godigest.FromBytes(refsManifestAConfigArtifactContent).String()
357357

358-
refsManifestBConfigArtifact := Manifest{
359-
Config: Descriptor{
358+
refsManifestBConfigArtifact := manifest{
359+
Config: descriptor{
360360
MediaType: testRefArtifactTypeB,
361361
Size: int64(len(testRefBlobB)),
362362
Digest: godigest.FromBytes(testRefBlobB),
363363
},
364-
Subject: &Descriptor{
364+
Subject: &descriptor{
365365
Size: int64(len(manifests[4].Content)),
366366
Digest: godigest.FromBytes(manifests[4].Content),
367367
},
368-
Layers: []Descriptor{
368+
Layers: []descriptor{
369369
emptyJSONDescriptor,
370370
},
371371
}
@@ -378,15 +378,15 @@ func init() {
378378
refsManifestBConfigArtifactDigest = godigest.FromBytes(refsManifestBConfigArtifactContent).String()
379379

380380
// artifact with Subject ref using ArtifactType, config.MediaType = emptyJSON
381-
refsManifestALayerArtifact := Manifest{
381+
refsManifestALayerArtifact := manifest{
382382
ArtifactType: testRefArtifactTypeA,
383383
Config: emptyJSONDescriptor,
384-
Subject: &Descriptor{
384+
Subject: &descriptor{
385385
Size: int64(len(manifests[4].Content)),
386386
Digest: godigest.FromBytes(manifests[4].Content),
387387
},
388-
Layers: []Descriptor{
389-
Descriptor{
388+
Layers: []descriptor{
389+
descriptor{
390390
MediaType: testRefArtifactTypeA,
391391
Size: int64(len(testRefBlobB)),
392392
Digest: godigest.FromBytes(testRefBlobB),
@@ -401,15 +401,15 @@ func init() {
401401

402402
refsManifestALayerArtifactDigest = godigest.FromBytes(refsManifestALayerArtifactContent).String()
403403

404-
refsManifestBLayerArtifact := Manifest{
404+
refsManifestBLayerArtifact := manifest{
405405
ArtifactType: testRefArtifactTypeB,
406406
Config: emptyJSONDescriptor,
407-
Subject: &Descriptor{
407+
Subject: &descriptor{
408408
Size: int64(len(manifests[4].Content)),
409409
Digest: godigest.FromBytes(manifests[4].Content),
410410
},
411-
Layers: []Descriptor{
412-
Descriptor{
411+
Layers: []descriptor{
412+
descriptor{
413413
MediaType: testRefArtifactTypeB,
414414
Size: int64(len(testRefBlobB)),
415415
Digest: godigest.FromBytes(testRefBlobB),

0 commit comments

Comments
 (0)