Skip to content

Commit 6952413

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

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

annotations.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ 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.
59+
- **org.opencontainers.image.referrer.convert** Defined and set to `true` when tooling has converted any referrers from the fallback tag to using the `org.opencontainers.image.referrer.subject` annotation.
60+
- This SHOULD only be considered valid when on the manifest of the `index.json` within [image layout](image-layout.md).
61+
- Tooling that reads an [image layout](image-layout.md) MAY skip the referrers conversion process when the annotation is detected.
5662
5763
## Back-compatibility with Label Schema
5864

image-layout.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ For example, an image may have a tag for different versions or builds of the sof
155155
In the wild you often see "tags" like "v1.0.0-vendor.0", "2.0.0-debug", etc.
156156
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.
157157
158+
**Referrers Support:**
159+
Referrers MAY be referenced using the fallback tag if the "org.opencontainers.image.referrer.convert" annotation is not set to "true".
160+
Before writing descriptors with the "org.opencontainers.image.referrer.subject" annotation, implementations MUST ensure the "org.opencontainers.image.referrer.convert" annotation is set to "true" and convert any existing content referenced with the fallback tag if the annotation was not set.
161+
If the "org.opencontainers.image.referrer.convert" annotation is set to "true", implementations MAY skip the conversion of referrers stored with the fallback tag and depend on the "org.opencontainers.image.referrer.subject" annotation to detect any referrers.
162+
158163
### Index Example
159164
160165
```json,title=Image%20Index&mediatype=application/vnd.oci.image.index.v1%2Bjson
@@ -190,9 +195,18 @@ Those tags will often be represented in an image-layout repository with matching
190195
"org.freedesktop.specifications.metainfo.version": "1.0",
191196
"org.freedesktop.specifications.metainfo.type": "AppStream"
192197
}
198+
},
199+
{
200+
"mediaType": "application/vnd.oci.image.index.v1+json",
201+
"size": 7143,
202+
"digest": "sha256:1efe7ab979c486a5af7a29d2c4603d84a3b934a7253d61b37e8573afecf47c03",
203+
"annotations": {
204+
"org.opencontainers.image.referrer.subject": "sha256:0228f90e926ba6b96e4f39cf294b2586d38fbb5a1e385c05cd1ee40ea54fe7fd"
205+
}
193206
}
194207
],
195208
"annotations": {
209+
"org.opencontainers.image.referrer.convert": "true",
196210
"com.example.index.revision": "r124356"
197211
}
198212
}
@@ -201,7 +215,8 @@ Those tags will often be represented in an image-layout repository with matching
201215
This illustrates an index that provides two named references and an auxiliary mediatype for this image layout.
202216
203217
The first named reference (`stable-release`) points to another index that might contain multiple references with distinct platforms and annotations.
204-
Note that the [`org.opencontainers.image.ref.name` annotation](annotations.md) SHOULD only be considered valid when on descriptors on `index.json`.
218+
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`.
219+
The [`org.opencontainers.image.referrer.convert` annotation](annotations.md) SHOULD only be considered valid when on manifest of the `index.json`.
205220
206221
The second named reference (`v1.0`) points to a manifest that is specific to the linux/ppc64le platform.
207222

specs-go/v1/annotations.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,14 @@ 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"
67+
68+
// AnnotationReferrerConvert is the annotation key that is set to "true" when tooling has converted any referrers from the fallback tag to using the `org.opencontainers.image.referrer.subject` annotation.
69+
// This SHOULD only be considered valid when on the manifest of the `index.json` within image layout.
70+
// Tooling that reads an image layout MAY skip the referrers conversion process when the annotation is detected.
71+
AnnotationReferrerConvert = "org.opencontainers.image.referrer.convert"
6272
)

0 commit comments

Comments
 (0)