fix(agent): stop excluding .devsy-internal from streamed workspace mount - #1109
Conversation
The Kubernetes dockerless fallback generates .devsy-internal build artifacts on the host before the workspace is streamed into the pod. StreamWorkspace and StreamMount both appended config.BuildArtifactExcludes() to their tar excludes, stripping .devsy-internal from that stream. With no bind mount for Kubernetes, this was the only transport into the pod, so prepareBuildDirectory could never find the build context and dockerless build failed before starting. The exclude was introduced in 8e32743 (#615) to fix build-artifact leakage into LocalDockerDelivery's docker-volume seeding (workspace_seed.go), which has its own independent tar/exclude logic and is unaffected by this change. Fixes #1108
✅ Deploy Preview for images-devsy-sh canceled.
|
✅ Deploy Preview for devsydev canceled.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughWorkspace and mount streaming now preserves Devsy internal Dockerless build artifacts. Unit tests inspect streamed TAR entries, and a Kubernetes end-to-end test verifies Dockerless setup and artifact cleanup. ChangesDockerless artifact streaming
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change restores required workspace build artifacts during streaming while preserving cleanup behavior, and no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
📋 Issue PlannerBuilt with CodeRabbit's Coding Plans for faster development and fewer bugs. View plan used: ✨ Finishing Touches✨ Simplify code
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 |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 8 |
| Duplication | 2 |
AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
|
Tick the box to add this pull request to the merge queue (same as
|
Problem
Kubernetes-provider
workspace upfor a Dockerfile-backed devcontainer fails before the Dockerless build starts:Root cause
The Kubernetes dockerless fallback (
dockerlessFallbackinpkg/devcontainer/build.go) generates.devsy-internal/Dockerfile-without-featureson the host, inside the Dockerfile build context, before the pod exists. Since Kubernetes has no bind mount, the primary workspace content (including the build context) is delivered into the pod exclusively via the tunnelStreamWorkspace/StreamMountRPCs (pkg/agent/tunnelserver/tunnelserver.go).Both of those RPCs appended
config.BuildArtifactExcludes()(.devsy-internal) to their tar excludes, so the generated build context never reached the pod. In-pod,prepareBuildDirectory(pkg/agent/dockerless.go) then can't find it at either the primary location or the/workspaces/.dockerlessfallback, producing the observedrename direrror.The exclude was introduced in
8e32743af(#615) to fix build-artifact leakage intoLocalDockerDelivery's docker-volume seeding (pkg/agent/delivery/workspace_seed.go), which has its own independent tar/exclude logic and is unaffected by this change — the tunnelserver changes in that commit were an unrelated, untested "also fix it here" that caused this regression.Fix
Remove
config.BuildArtifactExcludes()fromStreamWorkspaceandStreamMount. Cleanup of.devsy-internalis unaffected: it still happens host-side (cleanupBuildInformationinrun.go) and in-pod (cleanupBuildDirectoryindockerless.go) after the build.Testing
pkg/agent/tunnelserver/tunnelserver_test.go: addedTestStreamWorkspace_IncludesDevsyInternalBuildArtifactsandTestStreamMount_IncludesDevsyInternalBuildArtifacts, which seed a.devsy-internal/Dockerfile-without-featuresfile and assert it survives the tar stream. Verified both fail against the pre-fix exclude and pass with the fix.e2e/tests/build/build.go: added"kubernetes dockerless build cleans up .devsy-internal after streaming", exercising the exact repro (Dockerfile-backed devcontainer + Kubernetes provider +up), asserting the build actually ran with the transported Dockerfile and that.devsy-internaldoesn't linger in the pod workspace or on the host afterward. Requires a kind cluster; not run locally in this sandbox.Fixes #1108
Summary by CodeRabbit