diff --git a/blobs.go b/blobs.go index d07299343..b7583cc7b 100644 --- a/blobs.go +++ b/blobs.go @@ -63,13 +63,13 @@ type Descriptor struct { // encoded as utf-8. MediaType string `json:"mediaType,omitempty"` - // Size in bytes of content. - Size int64 `json:"size,omitempty"` - // Digest uniquely identifies the content. A byte stream can be verified // against this digest. Digest digest.Digest `json:"digest,omitempty"` + // Size in bytes of content. + Size int64 `json:"size,omitempty"` + // URLs contains the source URLs of this content. URLs []string `json:"urls,omitempty"` diff --git a/docs/notifications.md b/docs/notifications.md index 443605054..69ac90d0e 100644 --- a/docs/notifications.md +++ b/docs/notifications.md @@ -93,8 +93,8 @@ manifest: "action": "pull", "target": { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "size": 708, "digest": "sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf", + "size": 708, "length": 708, "repository": "hello-world", "url": "http://192.168.100.227:5000/v2/hello-world/manifests/sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf", @@ -171,8 +171,8 @@ Content-Type: application/vnd.docker.distribution.events.v1+json "action": "push", "target": { "mediaType": "application/vnd.docker.distribution.manifest.v1+json", - "length": 1, "digest": "sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf", + "length": 1, "repository": "library/test", "url": "https://example.com/v2/library/test/manifests/sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5" }, @@ -196,8 +196,8 @@ Content-Type: application/vnd.docker.distribution.events.v1+json "action": "push", "target": { "mediaType": "application/vnd.docker.container.image.rootfs.diff+x-gtar", - "length": 2, "digest": "sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5", + "length": 2, "repository": "library/test", "url": "https://example.com/v2/library/test/blobs/sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5" }, @@ -221,8 +221,8 @@ Content-Type: application/vnd.docker.distribution.events.v1+json "action": "push", "target": { "mediaType": "application/vnd.docker.container.image.rootfs.diff+x-gtar", - "length": 3, "digest": "sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5", + "length": 3, "repository": "library/test", "url": "https://example.com/v2/library/test/blobs/sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5" }, diff --git a/docs/spec/manifest-v2-2.md b/docs/spec/manifest-v2-2.md index f8a4671ed..81f40a396 100644 --- a/docs/spec/manifest-v2-2.md +++ b/docs/spec/manifest-v2-2.md @@ -124,8 +124,8 @@ image manifest based on the Content-Type returned in the HTTP response. "manifests": [ { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "size": 7143, "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", + "size": 7143, "platform": { "architecture": "ppc64le", "os": "linux" @@ -133,8 +133,8 @@ image manifest based on the Content-Type returned in the HTTP response. }, { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", + "size": 7682, "platform": { "architecture": "amd64", "os": "linux", @@ -232,24 +232,24 @@ image. It's the direct replacement for the schema-1 manifest. "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "config": { "mediaType": "application/vnd.docker.container.image.v1+json", - "size": 7023, - "digest": "sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7" + "digest": "sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7", + "size": 7023 }, "layers": [ { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "size": 32654, - "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f" + "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", + "size": 32654 }, { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "size": 16724, - "digest": "sha256:3c3a4604a545cdc127456d94e421cd355bca5b528f4a9c1905b15da2eb4a4c6b" + "digest": "sha256:3c3a4604a545cdc127456d94e421cd355bca5b528f4a9c1905b15da2eb4a4c6b", + "size": 16724 }, { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "size": 73109, - "digest": "sha256:ec4b8955958665577945c89419d1af06b5f7636b4ac3da7f12184802ad867736" + "digest": "sha256:ec4b8955958665577945c89419d1af06b5f7636b4ac3da7f12184802ad867736", + "size": 73109 } ] } diff --git a/manifest/manifestlist/manifestlist_test.go b/manifest/manifestlist/manifestlist_test.go index 9aacd54a7..a7b90c07b 100644 --- a/manifest/manifestlist/manifestlist_test.go +++ b/manifest/manifestlist/manifestlist_test.go @@ -18,8 +18,8 @@ const expectedManifestListSerialization = `{ "manifests": [ { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "size": 985, "digest": "sha256:1a9ec845ee94c202b2d5da74a24f0ed2058318bfa9879fa541efaecba272e86b", + "size": 985, "platform": { "architecture": "amd64", "os": "linux", @@ -30,8 +30,8 @@ const expectedManifestListSerialization = `{ }, { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "size": 2392, "digest": "sha256:6346340964309634683409684360934680934608934608934608934068934608", + "size": 2392, "platform": { "architecture": "sun4m", "os": "sunos" @@ -142,8 +142,8 @@ const expectedOCIImageIndexSerialization = `{ "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", - "size": 985, "digest": "sha256:1a9ec845ee94c202b2d5da74a24f0ed2058318bfa9879fa541efaecba272e86b", + "size": 985, "platform": { "architecture": "amd64", "os": "linux", @@ -154,8 +154,8 @@ const expectedOCIImageIndexSerialization = `{ }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", - "size": 985, "digest": "sha256:1a9ec845ee94c202b2d5da74a24f0ed2058318bfa9879fa541efaecba272e86b", + "size": 985, "annotations": { "platform": "none" }, @@ -166,8 +166,8 @@ const expectedOCIImageIndexSerialization = `{ }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", - "size": 2392, "digest": "sha256:6346340964309634683409684360934680934608934608934608934068934608", + "size": 2392, "annotations": { "what": "for" }, diff --git a/manifest/ocischema/manifest_test.go b/manifest/ocischema/manifest_test.go index 528e303cc..6b7a7028a 100644 --- a/manifest/ocischema/manifest_test.go +++ b/manifest/ocischema/manifest_test.go @@ -18,8 +18,8 @@ const expectedManifestSerialization = `{ "mediaType": "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/vnd.oci.image.config.v1+json", - "size": 985, "digest": "sha256:1a9ec845ee94c202b2d5da74a24f0ed2058318bfa9879fa541efaecba272e86b", + "size": 985, "annotations": { "apple": "orange" } @@ -27,8 +27,8 @@ const expectedManifestSerialization = `{ "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", - "size": 153263, "digest": "sha256:62d8908bee94c202b2d35224a221aaa2058318bfa9879fa541efaecba272331b", + "size": 153263, "annotations": { "lettuce": "wrap" } diff --git a/manifest/schema2/manifest_test.go b/manifest/schema2/manifest_test.go index da7f43fd8..463137448 100644 --- a/manifest/schema2/manifest_test.go +++ b/manifest/schema2/manifest_test.go @@ -15,14 +15,14 @@ const expectedManifestSerialization = `{ "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "config": { "mediaType": "application/vnd.docker.container.image.v1+json", - "size": 985, - "digest": "sha256:1a9ec845ee94c202b2d5da74a24f0ed2058318bfa9879fa541efaecba272e86b" + "digest": "sha256:1a9ec845ee94c202b2d5da74a24f0ed2058318bfa9879fa541efaecba272e86b", + "size": 985 }, "layers": [ { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "size": 153263, - "digest": "sha256:62d8908bee94c202b2d35224a221aaa2058318bfa9879fa541efaecba272331b" + "digest": "sha256:62d8908bee94c202b2d35224a221aaa2058318bfa9879fa541efaecba272331b", + "size": 153263 } ] }` diff --git a/notifications/event_test.go b/notifications/event_test.go index 44f64c6e7..7eea08f7a 100644 --- a/notifications/event_test.go +++ b/notifications/event_test.go @@ -22,8 +22,8 @@ func TestEventEnvelopeJSONFormat(t *testing.T) { "action": "push", "target": { "mediaType": "application/vnd.docker.distribution.manifest.v1+prettyjws", - "size": 1, "digest": "sha256:0123456789abcdef0", + "size": 1, "length": 1, "repository": "library/test", "url": "http://example.com/v2/library/test/manifests/latest" @@ -48,8 +48,8 @@ func TestEventEnvelopeJSONFormat(t *testing.T) { "action": "push", "target": { "mediaType": "application/vnd.docker.container.image.rootfs.diff+x-gtar", - "size": 2, "digest": "sha256:3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5", + "size": 2, "length": 2, "repository": "library/test", "url": "http://example.com/v2/library/test/manifests/latest" @@ -74,8 +74,8 @@ func TestEventEnvelopeJSONFormat(t *testing.T) { "action": "push", "target": { "mediaType": "application/vnd.docker.container.image.rootfs.diff+x-gtar", - "size": 3, "digest": "sha256:3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d6", + "size": 3, "length": 3, "repository": "library/test", "url": "http://example.com/v2/library/test/manifests/latest"