setup-python: Cannot create directory ‘/opt/hostedtoolcache’ after recent release
Description:
The following error start happening after the recent action release:
2022-07-12T14:12:47.7158848Z ##[group]Run actions/setup-python@v4
2022-07-12T14:12:47.7159230Z with:
2022-07-12T14:12:47.7159527Z python-version: 3.x
2022-07-12T14:12:47.7160059Z token: ***
2022-07-12T14:12:47.7160394Z update-environment: true
2022-07-12T14:12:47.7162682Z ##[endgroup]
2022-07-12T14:12:48.0166854Z Version 3.x was not found in the local cache
2022-07-12T14:12:48.3072207Z Version 3.x is available for downloading
2022-07-12T14:12:48.3074130Z Download from "https://github.com/actions/python-versions/releases/download/3.10.5-2452607758/python-3.10.5-linux-20.04-x64.tar.gz"
2022-07-12T14:12:49.1279090Z Extract downloaded archive
2022-07-12T14:12:49.1380950Z [command]/usr/bin/tar xz --warning=no-unknown-keyword -C /actions-runner/_work/_temp/2d83bfeb-a252-4083-95bf-6f30cffc5507 -f /actions-runner/_work/_temp/c2619dbf-23ad-46f0-9b07-baf06258c9c8
2022-07-12T14:12:52.2679935Z Execute installation script
2022-07-12T14:12:52.2887302Z Check if Python hostedtoolcache folder exist...
2022-07-12T14:12:52.2888180Z Creating Python hostedtoolcache folder...
2022-07-12T14:12:52.2921018Z ##[error]mkdir:
2022-07-12T14:12:52.2937518Z ##[error]cannot create directory ‘/opt/hostedtoolcache’
2022-07-12T14:12:52.2939104Z ##[error]: Permission denied
2022-07-12T14:12:52.2941609Z ##[error]The process '/usr/bin/bash' failed with exit code 1
2022-07-12T14:12:52.3294942Z Post job cleanup.
Action version:
v4
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version:
- 3.10.5
Repro steps:
setup-python:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
Expected behavior:
Won’t error.
Actual behavior:
It errors.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 8
- Comments: 24 (20 by maintainers)
Commits related to this issue
- fix: Self-Hosted Runner Tool Cache This aligns the tool cache path logic with the process used by actions/python-versions, maintaining the ability to locate the version binaries, and fixing self-host... — committed to techman83/setup-python by techman83 2 years ago
- docs: Agent Tool Cache This updates and simplies the tool cache documentation to match the implementation in both and Relates #459 — committed to techman83/setup-python by techman83 2 years ago
- fix: Avoid clobbering RUNNER_TOOL_PATH A change was made to fix a long standing set of issues, relating to the tool path that actions/python-versions historically used. However this was fixed in acti... — committed to techman83/setup-python by techman83 2 years ago
- docs: Agent Tool Cache This updates and simplies the tool cache documentation to match the implementation in both and Relates #459 — committed to techman83/setup-python by techman83 2 years ago
- fix: Self-Hosted Runner Tool Cache This aligns the tool cache path logic with the process used by actions/python-versions, maintaining the ability to locate the version binaries, and fixing self-host... — committed to techman83/setup-python by techman83 2 years ago
- docs: Agent Tool Cache This updates and simplies the tool cache documentation to match the implementation in both and Relates #459 — committed to techman83/setup-python by techman83 2 years ago
- This fixes the tool cache path for self-hosted runners, along with handling AGENT_TOOLSDIRECTORY for both hosted + self-hosted. Fixes actions#459 — committed to techman83/setup-python by techman83 2 years ago
- docs: Agent Tool Cache This updates and simplies the tool cache documentation to match the implementation in both and Relates #459 — committed to techman83/setup-python by techman83 2 years ago
- This fixes the tool cache path for self-hosted runners, along with handling AGENT_TOOLSDIRECTORY for both hosted + self-hosted. Fixes actions#459 — committed to techman83/setup-python by techman83 2 years ago
- docs: Agent Tool Cache This updates and simplies the tool cache documentation to match the implementation in both and Relates #459 — committed to techman83/setup-python by techman83 2 years ago
- fix: Self-Hosted Tool Cache This fixes the tool cache path for self-hosted runners, along with handling AGENT_TOOLSDIRECTORY for both hosted + self-hosted. Fixes actions#459 — committed to techman83/setup-python by techman83 2 years ago
- docs: Agent Tool Cache This updates and simplies the tool cache documentation to match the implementation in both and Relates #459 — committed to techman83/setup-python by techman83 2 years ago
- fix: Self-Hosted Tool Cache This fixes the tool cache path for self-hosted runners, along with handling AGENT_TOOLSDIRECTORY for both hosted + self-hosted. Fixes actions#459 — committed to techman83/setup-python by techman83 2 years ago
- fix: Mac Toolpath Shared libraries for the Mac python builds are not configured with the relocatable flag, thus must always be configured with the hosted path. Relates #459 — committed to techman83/setup-python by techman83 2 years ago
- fix: Mac Toolpath Shared libraries for the Mac python builds are not configured with the relocatable flag, thus must always be configured with the hosted path. Relates #459 — committed to techman83/setup-python by techman83 2 years ago
- docs: Agent Tool Cache This updates and simplies the tool cache documentation to match the implementation in both and Relates #459 — committed to techman83/setup-python by techman83 2 years ago
- fix: Self-Hosted Tool Cache This fixes the tool cache path for self-hosted runners, along with handling AGENT_TOOLSDIRECTORY for both hosted + self-hosted. Fixes actions#459 — committed to techman83/setup-python by techman83 2 years ago
- fix: Mac Toolpath Shared libraries for the Mac python builds are not configured with the relocatable flag, thus must always be configured with the hosted path. Relates #459 — committed to techman83/setup-python by techman83 2 years ago
@k24dizzle - Alternatively, you can use the context variable.
We where having this issue while setting up our own runners with the ubuntu example in: https://github.com/philips-labs/terraform-aws-github-runner. We could fix it by making these changes to the ubuntu example: https://github.com/philips-labs/terraform-aws-github-runner/pull/2302/files
Fair enough, I guess I am probably looking at this trough the
this would be better for my use case
lens without seeing the bigger picture.Hi, I am working on the same repo as @kenorb where we are using the setup-python GH action.
I ended up following the suggestion from @techman83:
This really makes me wonder why
AGENT_TOOLSDIRECTORY
doesn’t default to the value ofRUNNER_TOOL_CACHE
if not set/defined instead of defaulting to/opt/hostedtoolcache
.Cf this comment from @techman83 :
That would make a lot more sense to me and by doing so we wouldn’t have to tinker with
AGENT_TOOLSDIRECTORY
when calling the action.@dsame I don’t, I hope I have articulated clearly enough to show that this is a regression for self hosted users. Even though that regression technically aligns the behaviour of
actions/setup-python
with the documentation, I don’t think that is the best technical outcome here.@k24dizzle just set AGENT_TOOLSDIRECTORY to any location the runner user has write permission to.
Namely for Pytjon-3.11.0-betat.4 as in the log above: