fix: set AGENT_TOOLSDIRECTORY for self-hosted mode to prevent permission errors on macOS#6052
Open
xingzihai wants to merge 2 commits intonektos:masterfrom
Open
fix: set AGENT_TOOLSDIRECTORY for self-hosted mode to prevent permission errors on macOS#6052xingzihai wants to merge 2 commits intonektos:masterfrom
xingzihai wants to merge 2 commits intonektos:masterfrom
Conversation
Issue nektos#5971: Matrix multi-runner inconsistency When using matrix strategy with multiple platforms (windows-latest, macos-latest, ubuntu-latest), results were inconsistent. Sometimes all 3 runners were reported as unsupported, even when ubuntu-latest was properly configured. Root cause: EvaluateYamlNode modifies the yaml.Node in-place via ret.Decode(node). Multiple matrix jobs running in parallel share the same Job object, so concurrent calls to runsOnPlatformNames() raced to modify job.RawRunsOn, causing inconsistent evaluation results. Solution: - Added EvaluateYamlNodeGetResult method to ExpressionEvaluator interface that returns the evaluated node without modifying the original - Modified runsOnPlatformNames to use the new method - Added helper functions extractRunsOnFromNode and nodeAsStringSlice to extract platform names from the returned evaluated node This fix ensures each matrix job evaluates its own runs-on expression without interfering with other parallel matrix jobs.
…ion errors on macOS When running in self-hosted mode on macOS, actions like setup-python may fail with 'mkdir: /Users/runner: Permission denied' because they check AGENT_TOOLSDIRECTORY first before using RUNNER_TOOL_CACHE. If AGENT_TOOLSDIRECTORY is set on the host system (e.g., from a previous GitHub Actions runner installation), the Python setup script would use that path instead of the act-defined RUNNER_TOOL_CACHE. This fix sets AGENT_TOOLSDIRECTORY explicitly in self-hosted mode to match RUNNER_TOOL_CACHE, ensuring that tool installation scripts use the correct local tool cache path. Fixes: nektos#5974
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.
Summary
Fixes permission errors when using self-hosted mode on macOS with actions that rely on
AGENT_TOOLSDIRECTORY(e.g.,actions/setup-python).Problem
When running
actin self-hosted mode on macOS:AGENT_TOOLSDIRECTORYset from a GitHub Actions runner installation (e.g.,/Users/runner/hostedtoolcache)os.Environ()setup-pythoncheck forAGENT_TOOLSDIRECTORYand use it if set/Users/runner/hostedtoolcache/Python, but:/Users/runnerdoesn't existRoot Cause
In
startHostEnvironment, theAGENT_TOOLSDIRECTORYfrom the host system's environment overrides theRUNNER_TOOL_CACHEvalue thatactsets.Solution
Explicitly set
AGENT_TOOLSDIRECTORYto matchRUNNER_TOOL_CACHEbefore theos.Environ()loop:This ensures:
AGENT_TOOLSDIRECTORYuses theact-defined pathAGENT_TOOLSDIRECTORYis ignoredChanges
pkg/runner/run_context.go(+4 lines)Fixes #5974