Skip to content

Commit 2b6d978

Browse files
committed
Support referrers responses in the Image Layout
Signed-off-by: Brandon Mitchell <[email protected]>
1 parent 26647a4 commit 2b6d978

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

annotations.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ This specification defines the following annotation keys, intended for but not l
5353
- This SHOULD be the immediate image sharing zero-indexed layers with the image, such as from a Dockerfile `FROM` statement.
5454
- This SHOULD NOT reference any other images used to generate the contents of the image (e.g., multi-stage Dockerfile builds).
5555
- If the `image.base.name` annotation is specified, the `image.base.digest` annotation SHOULD be the digest of the manifest referenced by the `image.ref.name` annotation.
56+
- **org.opencontainers.image.referrer.subject** Digest of the subject referenced by the referrers response (string)
57+
- This SHOULD only be considered valid when on descriptors on `index.json` within [image layout](image-layout.md).
58+
- The descriptor SHOULD be the referrers response for the subject digest.
5659
5760
## Back-compatibility with Label Schema
5861

image-layout.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ For example, an image may have a tag for different versions or builds of the sof
160160
In the wild you often see "tags" like "v1.0.0-vendor.0", "2.0.0-debug", etc.
161161
Those tags will often be represented in an image-layout repository with matching "org.opencontainers.image.ref.name" annotations like "v1.0.0-vendor.0", "2.0.0-debug", etc.
162162
163+
**Referrers Support:**
164+
Manifests included in an OCI Layout that contain a `subject` field SHOULD be listed in a [referrers response][referrers-response].
165+
The referrers response is then saved as a blob and listed in the `index.json` with the media type set to `application/vnd.oci.image.index.v1+json` and the annotation `org.opencontainers.image.referrer.subject` set to the `subject` digest value.
166+
163167
### Index Example
164168
165169
```json,title=Image%20Index&mediatype=application/vnd.oci.image.index.v1%2Bjson
@@ -195,6 +199,14 @@ Those tags will often be represented in an image-layout repository with matching
195199
"org.freedesktop.specifications.metainfo.version": "1.0",
196200
"org.freedesktop.specifications.metainfo.type": "AppStream"
197201
}
202+
},
203+
{
204+
"mediaType": "application/vnd.oci.image.index.v1+json",
205+
"size": 7143,
206+
"digest": "sha256:1efe7ab979c486a5af7a29d2c4603d84a3b934a7253d61b37e8573afecf47c03",
207+
"annotations": {
208+
"org.opencontainers.image.referrer.subject": "sha256:0228f90e926ba6b96e4f39cf294b2586d38fbb5a1e385c05cd1ee40ea54fe7fd"
209+
}
198210
}
199211
],
200212
"annotations": {
@@ -206,8 +218,9 @@ Those tags will often be represented in an image-layout repository with matching
206218
This illustrates an index that provides two named references and an auxiliary mediatype for this image layout.
207219
208220
The first named reference (`stable-release`) points to another index that might contain multiple references with distinct platforms and annotations.
209-
Note that the [`org.opencontainers.image.ref.name` annotation](annotations.md) SHOULD only be considered valid when on descriptors on `index.json`.
221+
Note that the [`org.opencontainers.image.ref.name` and `org.opencontainers.image.referrer.subject` annotations](annotations.md) SHOULD only be considered valid when on descriptors on `index.json`.
210222
211223
The second named reference (`v1.0`) points to a manifest that is specific to the linux/ppc64le platform.
212224
213225
[descriptors]: ./descriptor.md
226+
[referrers-response]: https://github.com/opencontainers/distribution-spec/blob/v1.1.1/spec.md#listing-referrers

specs-go/v1/annotations.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,9 @@ const (
5959

6060
// AnnotationBaseImageName is the annotation key for the image reference of the image's base image.
6161
AnnotationBaseImageName = "org.opencontainers.image.base.name"
62+
63+
// AnnotationReferrerSubject is the annotation key for the digest of the subject referenced by the referrers response.
64+
// This SHOULD only be considered valid when on descriptors on `index.json` within image layout.
65+
// The descriptor SHOULD be the referrers response for the subject digest.
66+
AnnotationReferrerSubject = "org.opencontainers.image.referrer.subject"
6267
)

0 commit comments

Comments
 (0)