ci: use native temp dir to fix macOS TempDir flake#329
Merged
Conversation
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.
Problem
The
Go (macos-latest)job's "Test (pkg + cmd + internal, -short)" step fails on many PRs (#302, #321, #325, and now ubuntu too) with:Root cause
t.TempDir()creates a per-test parent dir then a numbered sub-dir (001) for each parallel sub-test. When$TMPDIRpoints into/tmp(and/private/tmpon macOS), which is world-writable with the sticky bit (mode1777), the hosted runner's extra sandbox layer (sandbox-execon macOS, AppArmor on ubuntu) intermittently denies that nestedmkdir. This is why #316'smktemp -d /tmp/...+chmod 777did not help — the sticky/tmptree itself is the problem, not the parent dir's mode. The failure is flaky (same SHA passes and fails across reruns) and recently spread to the ubuntu job once it was also redirected into/tmp.Fix
Keep temp out of the sticky
/tmptree and use a plain, per-user, runner-owned directory:TMPDIR=$(getconf DARWIN_USER_TEMP_DIR)— the OS-native/var/folders/.../Tper-user temp, no sticky bit, no sandbox quirk.mktemp -dunder the runner-owned$RUNNER_TEMP.actionlintclean;GOWORK=off go build ./cmd/daemon ./cmd/pilotctlpasses; snapshot TempDir tests pass locally under the native macOS temp dir.Once this is green, macOS can be re-added to web4 required checks.