remove tar based upload in favor of cat based#189
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 50 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR refactors the file-copy-to-pod mechanism from tar-based streaming to raw-byte streaming via shell commands, adds comprehensive unit tests for the updated logic, refines memory-backed volume configuration for scratch volumes, and improves PVC reuse and storage class resolution in the image build controller. Changes
Sequence DiagramsequenceDiagram
actor Caller
participant copyFileToPod
participant newPodExecExecutorFn
participant Pod
participant Shell
Caller->>copyFileToPod: copyFileToPod(fileContent)
copyFileToPod->>newPodExecExecutorFn: Create executor
newPodExecExecutorFn->>Pod: Initialize SPDY executor
newPodExecExecutorFn-->>copyFileToPod: Return executor
copyFileToPod->>Pod: StreamWithContext(cmd, stdin, stdout, stderr)
Pod->>Shell: Execute: /bin/sh -c "mkdir -p ... && cat > file && chmod 0600"
Shell->>Shell: Create directory
Shell->>Shell: Write raw bytes from stdin to file
Shell->>Shell: Apply chmod 0600
Shell-->>Pod: Return exit code
Pod-->>copyFileToPod: Return result
alt Success
copyFileToPod-->>Caller: Return nil
else Failure
copyFileToPod-->>Caller: Return error with stderr context
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/buildapi/server.go`:
- Around line 2598-2608: Add a request-scoped context to the upload flow and use
it for streaming to the pod: add a ctx context.Context field to the
uploadContext struct, set uploadCtx.ctx = c.Request.Context() in uploadFiles,
propagate that ctx parameter through processFilePart and into copyFileToPod
signatures/calls, and replace the hardcoded context.Background() passed to
executor.StreamWithContext(...) with the passed uploadContext.ctx so client
disconnects and server shutdown cancel the pod copy.
In `@internal/controller/imagebuild/controller.go`:
- Around line 1739-1748: The code reuses imageBuild.Spec.BuildCachePVC without
validating it; change the branch that sets workspacePVCName =
imageBuild.Spec.BuildCachePVC to perform a direct GET of that PVC (using the
controller's Kubernetes client) to ensure it exists and is accessible, and if
the GET returns not-found or an error, return that error so reconciliation fails
fast with a clear status; keep the existing fallback behavior that calls
r.getOrCreateWorkspacePVC when BuildCachePVC is empty, but replace the simple
assignment with a validation step that sets workspacePVCName only after
successful GET.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: aee99626-d090-4f96-b5c0-d7a454654e75
📒 Files selected for processing (4)
internal/buildapi/server.gointernal/buildapi/server_upload_test.gointernal/common/tasks/tasks.gointernal/controller/imagebuild/controller.go
This allows using ubi-minimal instead of nginx-unprivileged for the upload server. Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com> Assisted-by: claude-sonnet-4.6
This allows using ubi-minimal instead of nginx-unprivileged for the upload server.
Also:
Summary by CodeRabbit
Bug Fixes
New Features
Tests