Skip to content

fix(oci): upsert manifests and tags on push to handle re-pushes#53

Merged
The127 merged 2 commits intomasterfrom
fix/manifest-duplicate-push
Apr 17, 2026
Merged

fix(oci): upsert manifests and tags on push to handle re-pushes#53
The127 merged 2 commits intomasterfrom
fix/manifest-duplicate-push

Conversation

@The127
Copy link
Copy Markdown
Owner

@The127 The127 commented Apr 17, 2026

Summary

  • Pushing the same image or tag twice caused a 500 panic due to unique constraint violations on (repository_id, digest) for manifests and (repository_id, name) for tags
  • Manifest insert now uses ON CONFLICT (repository_id, digest) DO UPDATE SET updated_at = manifests.updated_at — a no-op update that returns the existing row's id so the tag FK stays valid (content-addressed: same digest = same content, nothing to change)
  • Tag insert now uses 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 behaviour
  • Adds BaseModel.SetId so the repository layer can reconcile the Go object id with the existing DB row id after a manifest conflict

Test plan

  • docker push the same image twice — second push should succeed without 500
  • docker push a new image to an existing tag — tag should resolve to the new manifest on pull

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.
@The127 The127 enabled auto-merge April 17, 2026 09:41
@The127 The127 merged commit 107da4c into master Apr 17, 2026
6 checks passed
@The127 The127 deleted the fix/manifest-duplicate-push branch April 17, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant