fix(publish): write OCI created into image config so registries order tags#125
Open
mduthey wants to merge 1 commit into
Open
fix(publish): write OCI created into image config so registries order tags#125mduthey wants to merge 1 commit into
created into image config so registries order tags#125mduthey wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(publish): write OCI
createdinto the image config so registries order tagsProblem
When publishing two versions of the same protocol (
0.1.0, then0.2.0) to zot, GraphQL search queries always returned the first version published as the newest. For example, thisquery returned
NewestImage.Tag = "0.1.0"even though0.2.0was pushed afterwards:The telling detail: in the same response, Repos.LastUpdated correctly reflected the most recent push, but NewestImage pointed at the old tag.
Root cause
zot selects a repo's "newest" image from the OCI created field of the config blob (GetImageLastUpdated): it reads created first, falls back to history, and otherwise returns zero time
(Jan 1, year 1). The repo's LastUpdatedImage pointer is only replaced when new.After(current).
trix publish declared the config with the standard OCI media type (application/vnd.oci.image.config.v1+json) but wrote a custom JSON with no created (only published_date, a field name zot
doesn't understand). As a result, every version resolved to zero time → zero.After(zero) == false → the second push never replaced the first, and the first-pushed tag stayed "newest"
forever.
Fields derived from the org.opencontainers.image.created annotation (which trix does set correctly) remained accurate — which is why ImageList and Repos.LastUpdated showed the right
order, producing the contradiction.
Fix
Derive an OCI-standard RFC3339 created from published_date and serialize it into the image config:
The field uses #[serde(default, skip_serializing_if = "Option::is_none")], so artifacts published before this fix still pull without changes.
Testing / verification
version.