Skip to content

Backport Distribution Multipart Upload (Cloudflare R2) - #8

Open
constantins2001 wants to merge 3 commits into
goharbor:release/2.8from
constantins2001:release/2.8
Open

constantins2001 wants to merge 3 commits into
goharbor:release/2.8from
constantins2001:release/2.8

Conversation

@constantins2001

Copy link
Copy Markdown

This merge requests allows Distribution to upload to Cloudflare R2 (multipart).
Currently, this is broken as Cloudflare requires uniform sized chunks (except the last one). This wasn't given with the old code.

@constantins2001

Copy link
Copy Markdown
Author

Using this in prod since a few months. Would like to switch back to upstream images and not maintain our own CI for it.

constantins2001 and others added 2 commits March 24, 2026 17:26
Builds and pushes linux/amd64 image to ghcr.io on release branch
pushes and manual workflow_dispatch triggers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Resumed non-aligned uploads can still produce unequal non-final parts that Cloudflare R2 rejects.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates S3 multipart buffering for Cloudflare R2 compatibility and adds GHCR publishing automation.

Changes:

  • Uploads fixed-size multipart chunks while buffering the remainder.
  • Adds release-branch image publishing to GHCR.
File summaries
File Description
registry/storage/driver/s3-aws/s3.go Reworks multipart buffering and flushing.
.github/workflows/publish-ghcr.yml Adds an automated GHCR publishing workflow.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1238 to +1240
// Upload chunks of exactly ChunkSize bytes (R2 requirement: all parts except last must be same size)
chunkSize := int(w.driver.ChunkSize)
for len(w.buffer) >= chunkSize {
Comment on lines +3 to +7
on:
push:
branches:
- 'release/*'
workflow_dispatch:
Comment on lines +1234 to +1235
// Append incoming data to buffer
w.buffer = append(w.buffer, p...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants