Repository navigation
Replay OCI blob bodies on upload retry - #34
Merged
Merged
Conversation
zili-simular
marked this pull request as ready for review
September 24, 2026 10:37
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.
Why the change
A transient registry upload failure can leave a streamed blob body at EOF, causing go-containerregistry's retry to send zero bytes instead of the declared content length, so this change preserves seekability through the upload contract and rewinds the body before every retry attempt.
Special things to note
snapshot.Uploaderinterface now requiresio.ReadSeekerfor blob uploads; existing production callers already provide either*os.Fileor*bytes.Reader.v1.Layercontract directly by fully consumingCompressed()twice and requiring the complete blob both times.Change outline
Preserve replayability instead of erasing it at the uploader and registry boundaries.
Rewind the same spooled file before each stream requested by go-containerregistry.
snapshot.uploadSpooled write and hash blob into temporary file putBlobIfMissing seek temporary file to byte 0 OCIRegistry.PutBlob remote.WriteLayer(streamLayer) streamLayer.Compressed - return body at its current offset + seek body to byte 0 + return the complete body transient registry failure go-containerregistry retries streamLayer.Compressed + seek body to byte 0 + return the complete body again