-
Notifications
You must be signed in to change notification settings - Fork 617
Self-hosted runners cache/reuse OS-incompatible python installations #1087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello @OscarVanL, Thank you for creating this issue and we will look into it :) |
@chiranjib-swain I see you've written some test cases that look to try to reproduce the issue I described (here and here). Were you able to successfully reproduce this bug? Is there any extra information you would like from my side? Thanks! |
Hi @OscarVanL , Thanks for reaching out!
Yes, I have already reproduced it and am sharing the screenshots below. I've tested the workflow setup using the The Key Points for Setup 1. Dynamic Define a unique tool cache path for each OS early in your workflow to prevent conflicts:
Make sure this step is run before the 2. Permission Setup Your runner must have write access to the directory specified by 3. Workflow Compatibility I've tested this configuration with Let me know if you have any other issues or need more help! |
Hi @chiranjib-swain, Thanks for the reply and the workaround, this should help me get unblocked for now. Long term, perhaps it is worth making some changes to the directory that actions/setup-python uses to cache the toolchain. For example, instead of storing in This would be a long term fix that would avoid the need to assign the AGENT_TOOLSDIRECTORY on every job. Thanks again! |
Hi @OscarVanL , Implementing OS-specific identifiers in the toolchain cache subdirectory structure (e.g., changing Thank You! |
Uh oh!
There was an error while loading. Please reload this page.
Description:
Our GitHub Actions runners are self-hosted.
Some of our CI jobs run in different operating systems using the Run jobs in a container functionality, for example if they need a specific OS, or are testing on different operating systems in a test matrix.
When running the
actions/setup-python
action, it will either download Python and cache it, or use the existing cached python installation.The problem is, while the download URL is an OS-specific download, the cache directory is not OS-specific. For example, these python downloads are different, but both get cached in
/opt/actions-runner/_work/_tool/Python/3.8.18/x64
.https://github.com/actions/python-versions/releases/download/3.8.18-12303122501/python-3.8.18-linux-24.04-x64.tar.gz
https://github.com/actions/python-versions/releases/download/3.8.18-12303122501/python-3.8.18-linux-20.04-x64.tar.gz
The cache destination gets reused across jobs irrespective of what operating system the job is running on, which leads to the python installation breaking.
Example
Cache miss, python gets downloaded and cached...
Cache hit (of the incorrect OS's python!):
The above error is likely due Ubuntu 20 and Ubuntu 24 using incompatible/different OpenSSL versions (1 vs 3).
The same can happen in the other direction too, if the Ubuntu 24.04 job runs before the Ubuntu 20.04 job, then I encountered this issue:
In this case, because the python release for Ubuntu 24.04 is dynamically linked against a glibc version that isn't installed on Ubuntu 20.04.
Action version:
actions/setup-python@v5
Platform:
Runner type:
Tools version:
I expect all python versions may be affected
Repro steps:
i. Run
actions/setup-python@v5
targeting python 3.8i. Run
actions/setup-python@v5
targeting python 3.8ii. Run
python -m pip install --upgrade pip
The above should fail. The python installation is broken as it is incompatible with that Ubuntu version.
The problem can be reproduced if you swap the operating systems around too (Ubuntu 20 first, then Ubuntu 24), but a different python error will happen.
Expected behavior:
If an OS-specific python release is utilised in the download, then this should be cached into an OS-specific location on the CI runner to ensure an equivalent cached python release is utilised.
Actual behavior:
In a multi-OS environment using
actions/setup-python
it is likely GitHub Actions will cache an incompatible python installation.The text was updated successfully, but these errors were encountered: