Uh oh!
There was an error while loading. Please reload this page.
fix(delivery): clean up agent delivery volumes on workspace deletion - #266
Conversation
✅ Deploy Preview for devsydev canceled.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThis PR adds configurable helper image support to the Docker-based agent delivery system. A new ChangesHelper Image Configuration and Delivery
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
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 |
…elivery Introduces a pluggable delivery strategy that replaces the monolithic inject.sh handshake with phase-aware delivery methods, eliminating race conditions identified in DEVSY-082. Three implementations: - LocalDockerDelivery: named volume pre-placement before container start - RemoteDockerDelivery: docker cp post-start for remote daemons - LegacyShellDelivery: wraps existing inject.sh path for custom drivers Includes factory, integration into setup.go/single.go, and E2E tests.
The existing up-* tests already exercise the delivery path through setupContainer → injectAgentIntoContainer. No need for separate tests.
Delete() now calls cleanupDeliveryVolume() after container removal,
which invokes the delivery strategy's Cleanup() method to remove
orphaned devsy-agent-{workspaceID} volumes. Cleanup is best-effort:
errors are logged but never fail the delete operation.
deleteForRecreate() inherits this fix via its existing call to Delete().When a container is already absent (externally deleted or crashed), Delete() returned early before reaching the cleanup call. Using defer ensures cleanupDeliveryVolume() runs regardless of whether the container exists, preventing orphaned volumes in that scenario.
…oconst lint Resolves golangci-lint goconst violations in delete_test.go.
HelperImage field in ProviderDockerDriverConfig is threaded through FactoryOptions to LocalDockerDelivery. populateVolume() tries the configured helper container first (defaulting to busybox:latest), then falls back to writing the binary directly to the Docker volume mountpoint on the local filesystem. The direct-copy fallback is safe because LocalDockerDelivery is only used when Docker is local.
Fixes consumed io.Reader bug: binary data is now read once into a byte slice, then a fresh bytes.NewReader is passed to the helper container attempt. populateVolumeDirectCopy accepts []byte directly. Adds behavioral test for the fallback path using a fake docker script that fails on 'run' but returns a temp dir on 'volume inspect', verifying the binary lands with correct content and 0755 permissions.
c17c38b to
9133d8dCompareUh oh!
There was an error while loading. Please reload this page.
Summary
cleanupDeliveryVolume()deferto ensure cleanup runs even when the container is already absentdeleteForRecreate()inherits cleanup through its existingDelete()callSummary by CodeRabbit
Release Notes