Repository navigation
Conversation
ba1f62d to
dd534be
Compare
| When `n` is zero, this endpoint MUST return an empty array. | ||
| When `n` is not specified, the registry MAY apply a default limit. | ||
|
|
||
| - **`before`** *string (RFC 3339 timestamp)*, OPTIONAL |
There was a problem hiding this comment.
is there a chance to have two results with the exact same time stamp..
There was a problem hiding this comment.
Perhaps a registry could consider every update of a tag as a delete followed by a create and so the timestamp would be the same.
There was a problem hiding this comment.
I would think the history can be more compact for repush case. Actually two created events are better repressing what acutally happened compared to created/deleted/created.
There was a problem hiding this comment.
Whether we could reasonably see two at the same timestamp probably depends on how granular timestamp is -- perhaps we should explicitly recommend (implementor's note?) that timestamps should have finer granularity than just seconds?
There was a problem hiding this comment.
If we can recommend finer granularity, we should also update all the examples we provide to use finer granularity (we've had issues in the past where implementors read the examples and not the prose).
Signed-off-by: Jeff Carter <[email protected]>
sudo-bmitch
left a comment
There was a problem hiding this comment.
Here's some early feedback. I still need to spend some time implementing this before considering approving, and we need a conformance test.
Signed-off-by: Jeff Carter <[email protected]>
|
|
||
| A successful request MUST return a `200 OK` response code. | ||
| If the repository does not exist, the registry MUST return a `404 Not Found` response code. | ||
| If the tag has no history or the registry does not implement this extension, the registry MUST return a `404 Not Found` response code. |
There was a problem hiding this comment.
Should this have a MUST/SHOULD respond with UNSUPPORTED in the error code for "registry does not implement this" case? Or perhaps some other recommended required error codes for the other 404 responses so that users of the API can know which it is. Or maybe the n=0 trick is the correct way to figure out if history is supported?
Related:
If the tag has no history [...] the registry MUST return a
404 Not Found
when
nis zero, this endpoint MUST return an empty array
These seem conflicting. Perhaps a clarification is needed?
There was a problem hiding this comment.
In other words, does n=0 override the "repository does not exist" 404 or just the "no history" 404 or "registry does not implement this extension" 404 and what about the pinned digest 404?
There was a problem hiding this comment.
Yes, those do some conflicting, good catch.
Currently most http routers on an unknown path would return 404 by default, hence the "return 404 if not supported". If we forced an UNSUPPORTED it'd require registries to explicitly update to say they aren't handling it, vs it being the default
There was a problem hiding this comment.
I think the appropriate thing to do is return an empty response with 200 OK if there is no history - this seems to make more sense?
There was a problem hiding this comment.
🤔 Could it have no history? What does that mean? Does that mean nothing was ever tagged as this? Or just that the registry hasn't yet recorded history? But if it has at least the current tagged image and they support the history endpoint, it must have a minimum history of one, right? So, 404 is correct, the tag does not exist as an image, or it would have history. Returning an empty list for every tag that doesn't exist seems odd.
Signed-off-by: Jeff Carter <[email protected]>
Signed-off-by: Jeff Carter <[email protected]>
Signed-off-by: Jeff Carter <[email protected]>
There was a problem hiding this comment.
Adding our own annotations to the descriptors has me concerned. E.g. what if someone wants to pull up annotations in their own tag history API and there's a collision, perhaps even a collision with an annotation we haven't specified yet but add in a future release.
I'm playing around with my own implementation and have the following struct for each tag history entry:
type LayoutHistory struct {
Time time.Time `json:"time"`
Deleted bool `json:"deleted,omitempty"`
Descriptor Descriptor `json:"descriptor"`
}The descriptor ends up nested one extra layer in the responses, but we can now add other fields. E.g. I was considering if registries could add an audit log to each entry, identifying who (or what) was responsible for each entry.
Edit: A few more thoughts looking over this:
- I'd want to use the Link header for pagination. It's cleaner from the client side to know when more results are available.
- With the Link header, that gives flexibility for the server to reject some values of
nfor being too small or large, imposing it's own limits. Or the server can not support pagination and always return the full history. - Do we have guidance for servers implementing garbage collection of history responses? If the server has a hard upper limit on the number of history entries per tag, that makes it easier to not paginate responses.
- When searching on a tag with a digest, I'd lean towards always returning a 200, and just having an empty list when no matches are found. Treat it like a filter on the history, where a tag could also have a particular digest assigned to it multiple times.
- Is pushing a new tag value treated as a simultaneous delete of the old value, or can that be implied?
|
On today's call we talked about a lot of good reasons why it makes sense for this to be shaped like an OCI index (like #579 + referrers), and on the problem of "what if a registry 'pulls up' annotations?" we discussed having said registry ignore any image annotations that start with |
Signed-off-by: Jeff Carter <[email protected]>
michaelb990
left a comment
There was a problem hiding this comment.
a couple comments, but this seems like a cool idea!
for registries implementing this for existing repos, is there a way we should communicate to clients when we started tracking history? it seems like there's a difference between "this is the full history for a given tag" and "this is the history since 2026-08-15 for a given tag".
| A successful request MUST return a `200 OK` response code. | ||
| If the registry does not implement this extension, the registry MUST return a `404 Not Found` response code. | ||
| The registry MUST NOT return a `404 Not Found` response code for any other condition. | ||
| If the repository does not exist or the tag has no history, the registry MUST return a `200 OK` response code with an empty manifest list. |
There was a problem hiding this comment.
If the repository does not exist or the tag has no history
the statement is a bit ambiguous, a tag must have a history, at least created if it ever exits. It's better to reword to something like if the repository or tag never exits
There was a problem hiding this comment.
It's definitely possible for a registry to not know when the tags it has were created, but that's a separate thing (it would still have a current value, just not a timestamp).
|
|
||
| The annotations MUST include both of the following: | ||
|
|
||
| - **`org.opencontainers.distribution.tag.timestamp`** *string* |
There was a problem hiding this comment.
timestamp is a universal concept, suggest remove tag from the annotation name
There was a problem hiding this comment.
Given that we're talking about the timestamp that the tag event itself happened, I think .tag. is appropriate here -- this isn't the image timestamp or the timestamp of when the image was first seen by the registry or anything, but specifically the timestamp of this specific tag entry.
|
|
||
| - **`org.opencontainers.distribution.tag.timestamp`** *string* | ||
|
|
||
| The RFC 3339 timestamp at which the tag history event occurred. Used as the sort key and as the cursor for time-based pagination. |
There was a problem hiding this comment.
As I noted above, it's 100% valid for a registry to not know this timestamp -- we should provide explicit guidance or relax MUST to SHOULD (maybe only allowing it to be missing if there's only a single entry?)
There was a problem hiding this comment.
If an entry doesn't include a timestamp, things get a bit ugly. I agree there is a world where a registry has stored the digests but not the timestamps, but it seems like a rare one?
Without timestamps, the ordering and paging is broken - we could only return a single list of whatever the registry was willing to return unless we defined a backup sorting (complication). If we have mixed entries (some with, some without timestamps) then the inclusion of a before/after param would immediately remove all the records without a timestamp.
I could see a solution where we acknowledge the record exists, but don't allow for listing. We could hide records without timestamps from the listing call, but if you pass a digest in to see if it was part of history, this call could still return true for entries without timestamps. This seems like gross behavior though, and it'd just be easier to just say registries should track these values going forward, and anything before is lost.
| When provided, only entries whose history entry timestamp is strictly less than (i.e. older than) `before` will be returned. | ||
| This is used for time-based pagination: pass the `org.opencontainers.distribution.tag.timestamp` value of the last entry returned in the previous response to retrieve the next page. | ||
|
|
||
| - **`since`** *string (RFC 3339 timestamp)*, OPTIONAL |
There was a problem hiding this comment.
One possible option (not saying it's a good one, to be clear) would be to relax some of this to ISO 8601 instead of RFC 3339 -- that's a little bit unprecedented in OCI (except in umoci), but that would allow formats like "YYYY-MM-DD" also (although that makes the exclusive nature of these filters even more apparent, so maybe I'm really just thinking out loud? it's certainly easier to use "by hand" than RFC 3339 is)
| Specifies the maximum number of results to return. | ||
| The registry MAY return fewer results than requested if fewer historical entries exist. | ||
| When `n` is zero, this endpoint MUST return an OCI Index with an empty manifest list and MUST NOT include a `Link` header, useful for determining whether the extension is supported (`200 OK`) or not (`404 Not Found`). | ||
| When `n` is not specified, the registry MAY apply a default limit. |
There was a problem hiding this comment.
Is this limit for a single page of results, or does it span multiple pages? E.g. if n=150, should the registry return two pages of results, one with 100 entries, and the next with 50? Or is this the client requested limit per page that the server could ignore?
There was a problem hiding this comment.
I think this limit is per page of results.
If there are 150 entries, and you pass n=150, but the server has an implementation limit of 100, I'd expect the first response to be an index with 100 entries and a Link header pointing to the next 50
Signed-off-by: Jeff Carter <[email protected]>
Updates distribution spec to include new endpoint for retrieving the history of a given tag. The response is a json list of descriptors,including the created timestamp and sorted in descending order (newest first).
The list can be paged.