fix: core/integration test binary compiles on macOS#11818
Draft
shykes wants to merge 6 commits intodagger:mainfrom
Draft
fix: core/integration test binary compiles on macOS#11818shykes wants to merge 6 commits intodagger:mainfrom
shykes wants to merge 6 commits intodagger:mainfrom
Conversation
Move the runContainer method from executor_spec.go into executor_run.go (linux-only) and executor_run_unimplemented.go (darwin/windows stub), following the existing pattern used by linux_namespace.go / unimplemented_namespace.go. This removes Linux-only golang.org/x/sys/unix symbols from the unconditional build, fixing `go build ./engine/buildkit/` on macOS.
The Linux copy_linux.go exports CopyFileContent (uppercase) but the Darwin file only had copyFileContent (lowercase), causing compilation failures when other packages reference the exported symbol. Signed-off-by: Solomon Hykes <[email protected]>
The syscall.Mount/Unmount calls with MS_BIND and MNT_DETACH are Linux-only. Extract them into bindMountDir/unmountDir helpers in platform-specific files so changeset.go compiles on darwin. Signed-off-by: Solomon Hykes <[email protected]>
Move runWithStandardUmaskAndNetOverride, unshareAndRun, overrideNetworkConfig, and runProcessGroup into git_remote_linux.go. These use unix.Unshare, unix.Setns, moby/sys/mount, and unix.SysProcAttr which are unavailable on darwin. Signed-off-by: Solomon Hykes <[email protected]>
…S build mountIntoContainer uses unix.OpenTree, unix.MoveMount, and unix.MNT_DETACH which are Linux-only. Move it to service_linux.go with a stub on darwin/windows. Signed-off-by: Solomon Hykes <[email protected]>
…cOS build pathResolverForMount references overlay.GetOverlayLayers which is only available on Linux. Move the function to util_mount_linux.go (with overlay support) and util_mount_unimplemented.go (bind-only). Signed-off-by: Solomon Hykes <[email protected]>
9eff467 to
13afbc7
Compare
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.
cd core/integration && go test -cfails on macOS because several files incore/use Linux-only symbols (syscall.Mount,unix.Unshare,unix.OpenTree,overlay.GetOverlayLayers, etc.) without build tags. This PR extracts those symbols into platform-specific_linux.gofiles with darwin/windows stubs, completing the work started in #11817.Summary
CopyFileContenton darwin ininternal/fsutil/copyto match the linux APIsyscall.Mount/syscall.Unmountbind-mount calls fromcore/changeset.gointo platform-specific helperscore/git_remote.go(runWithStandardUmaskAndNetOverride,unshareAndRun,overrideNetworkConfig,runProcessGroup) intogit_remote_linux.gomountIntoContainerfromcore/service.gointoservice_linux.gopathResolverForMountfromcore/util.gointoutil_mount_linux.go(overlay case is Linux-only)Test plan
go build ./internal/fsutil/copy/succeeds on macOSgo build ./core/succeeds on macOSgo build ./engine/buildkit/succeeds on macOScd core/integration && go test -csucceeds on macOS