-
Notifications
You must be signed in to change notification settings - Fork 471
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
Fallback to different installation directory if /usr/share/dotnet
doesn't available due to permissions
#518
Comments
Hello @maxim-lobanov |
Seems to be a duplicate of #360. @HarithaVattikuti, if you could check the PR #498 that seems to fix those issues. Thank you in advance! |
@tremblaysimon I think #498 implements a bit different approach and I worry that it can't be accepted because it will be a breaking change. The current path priorities:
#498 changes path priorities to:
I could be wrong but It will be a breaking change for all hosted runners because all hosted runners will change default location from |
+1, this same issue occurs with windows self hosted runners as well. For example when trying to install 6.0.x using v4 a pair of access denied exceptions occur. Access to the path 'C:\Program Files\dotnet\host\fxr\8.0.4' is denied. |
The interesting case we have with this, is that on Ubuntu 24.04 it's all installed to |
Description:
By default, dotnet is downloaded and installed under
/usr/share/dotnet
folder:setup-dotnet/src/installer.ts
Line 220 in 5d1464d
Unfortunately, it is not great location because on some self-hosted runners and some Larger Runners (Linux Arm64 private beta), user doesn't have enough permissions to create / modify this folder.
In this case, action will fail with error:
Error: Failed to install dotnet, exit code: 1. mkdir: cannot create directory '/usr/share/dotnet': Permission denied
Proposed solution
I guess it is not possible to change default location
/usr/share/dotnet
to some new location because it will be a breaking change. So I am proposing adding a new fallback location in case if user doesn't have permissions for/usr/share/dotnet
. It won't be a breaking change because fallback will be used only in cases when the current version of action would fail.This action can check permissions of
/usr/share/dotnet
folder. If user doesn't have permissions to create / modify this folder, then the action should use differentDOTNET_INSTALL_DIR
directory instead of/usr/share/dotnet
.For example, it can use:
$HOME/.dotnet
-> this way location will be consistent with MacOS Runners + user always have permissions to $HOME<runner.temp>/.dotnet
-> https://docs.github.com/en/actions/learn-github-actions/contexts#runner-contextAlternative solutions
There are two alternative solutions:
/usr/share/dotnet
once on self-hosted agent -> Unfortunately, it won't fix Linux Arm64 Larger Runners. Also, it is not super convenient and involve manual actionsDOTNET_INSTALL_DIR
environment variable by themselves -> it is definitely possible option but it is not super convenient and user needs to do it for every workflow YAMLWe definitely have workarounds but it would be great if action can handle this case without workarounds.
The text was updated successfully, but these errors were encountered: