Description
Description:
By default, dotnet is downloaded and installed under /usr/share/dotnet
folder:
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 different DOTNET_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-context
Alternative solutions
There are two alternative solutions:
- Change permissions of
/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 actions - User can override
DOTNET_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 YAML
We definitely have workarounds but it would be great if action can handle this case without workarounds.