fix(oci): upsert manifests and tags on push to handle re-pushes#53
Merged
fix(oci): upsert manifests and tags on push to handle re-pushes#53
Conversation
Pushing the same image or tag twice caused a 500 due to unique constraint violations on (repository_id, digest) for manifests and (repository_id, name) for tags. Manifests now do nothing on conflict (content-addressed, same digest means same content). Tags update their manifest reference so re-pushing a tag always points to the latest manifest. Also adds BaseModel.SetId so the repository layer can reconcile the Go object id with the existing DB row id after a manifest conflict.
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.
Summary
(repository_id, digest)for manifests and(repository_id, name)for tagsON CONFLICT (repository_id, digest) DO UPDATE SET updated_at = manifests.updated_at— a no-op update that returns the existing row'sidso the tag FK stays valid (content-addressed: same digest = same content, nothing to change)ON CONFLICT (repository_id, name) DO UPDATE SET manifest_id = EXCLUDED.manifest_id— updates the tag to point to the latest manifest, which is the correct registry behaviourBaseModel.SetIdso the repository layer can reconcile the Go object id with the existing DB row id after a manifest conflictTest plan
docker pushthe same image twice — second push should succeed without 500docker pusha new image to an existing tag — tag should resolve to the new manifest on pull