opencontainers / distribution-spec

OCI Distribution Specification
https://opencontainers.org
Apache License 2.0
780 stars 201 forks source link

Add `PUT` method support for `/referrers` endpoint #515

Open dmcgowan opened 4 months ago

dmcgowan commented 4 months ago

The fallback approach adds many advantages for clients and servers. Having a dedicated /referrers endpoint adds some advantages over the current fallback approach. We can define referrer specific headers, suggest specific validation, and avoid any extra requests from clients when getting referrers. Adding PUT would allow maintaining the advantages of fallback approach with the advantages of having referrers served from a single endpoint.

sajayantony commented 4 months ago

Do you have any thoughts about disabling dynamic referrer generation if the referrers have been put? Basically, the set is fixed and this also might mean that a client generated index would disable attaching more referrers to an image. Trying to see how this would compose with dynamic referrers.

dmcgowan commented 4 months ago

I should probably put up my draft soon to discuss more specifics. My thought is the registry could make that determination per repository and the client would know the correct behavior based on a header returned on PUT of the subject manifest. If the PUT /v2/<name>/referrers/<digest> is accepted, then GET /v2/<name>/referrers/<digest> should return the exact same content. However, a registry could still support dynamic results via GET /v2/<name>/referrers/<digest>?artifactType=<artifactType>.