setup-dotnet icon indicating copy to clipboard operation
setup-dotnet copied to clipboard

Ability to select to install matching version already available on the current image

Open Piedone opened this issue 3 years ago • 9 comments

Description:

Currently, when you set e.g. dotnet-version: '6.0.x' then the action will install the latest 6.0.x version available online. If this is preinstalled on the current runner image, then no actual installation will happen, only a check; if there is a more recent version available for download from Microsoft (like 6.0.1 is preinstalled but 6.0.2 is released) then it'll download and install that version.

This is all good, but my request would be to add an option to always install the locally available version matching dotnet-version, and only fall back to a download if a local version can't be matched. E.g., if 6.0.1 is preinstalled on the runner image, then just use that for dotnet-version: '6.0.x', even if online a 6.0.2 version is also available.

Related: https://github.com/actions/setup-dotnet/issues/284

Justification:

For our builds, we want to keep up to date with the patch versions of .NET, the assumption being that those are safe to auto-update to and also useful because they continuously bring bug fixes. So, we want to tell the action "just install whatever's latest for 6.0.x". However, it's not critical that we're always using the latest version right at the moment it's released, we can wait until GHA images are updated in exchange for not paying the penalty of installation (30-120 seconds) in case the preinstalled version is not the most recent one.

Are you willing to submit a PR? I wouldn't venture into that for now.

Piedone avatar Dec 14 '22 12:12 Piedone

Hi, @Piedone 👋 Thanks for the feature request! The setup-dotnet@v3 got the ability to install locally available .NET versions, you can check it by yourself. If the version is not the latest available, for instance, 6.0.x, you should also use the global.json file, to select the required version manually.

I'm not sure that I fully answered your question, so if you have any additional questions feel free to ask me.

IvanZosimov avatar Dec 14 '22 15:12 IvanZosimov

Thank you, I'm aware of that and this is what I intended to explain at the start of the issue description too. I clarified the issue, but the point here is to add an option to always install the locally available version matching dotnet-version, and only fall back to a download if a local version can't be matched. E.g., if 6.0.1 is preinstalled on the runner image, then just use that for dotnet-version: '6.0.x', even if online a 6.0.2 version is also available.

Piedone avatar Dec 14 '22 16:12 Piedone

Thank you for the clarification ❤️, We will investigate the ability to add this feature and get back to you with updates!

IvanZosimov avatar Dec 14 '22 16:12 IvanZosimov

Thank you for your quick reply!

Piedone avatar Dec 14 '22 16:12 Piedone

I'd like this feature too!!

In 97% of my cases, the ability to tell the action to "use the latest preinstalled version that matches my version string, and if none then fall back to downloading the latest matching as per normal" is what I want to do.

Cheers

ericsampson avatar Mar 21 '23 05:03 ericsampson

@IvanZosimov this may be a dumb question, but what is the purpose of the version argument? As the documentation mentions, the latest preinstalled version will be used, unless the user creates a global.json file.

It just seems to me like the version argument is largely useless, and causes people confusion because it's not how users would rightfully expect things to work based on any of the other setup-XXX GitHub actions.

Cheers

ericsampson avatar Mar 21 '23 05:03 ericsampson

Hi, @ericsampson 👋 Sorry for the late response, I agree with you. We are working on eliminating these confusions.

IvanZosimov avatar Jul 03 '23 08:07 IvanZosimov

thank you @IvanZosimov , sorry for my late response! ;)

ericsampson avatar Aug 24 '23 19:08 ericsampson

However, even after I create the global.json file specifying that I want to use version 7.0, it still always installs the latest version(8.0), for me, before finally installing the version specified by the dotnet-version parameter(7.0) for me. This is unnecessary, it wastes a lot of my time, especially with a slow network, and it doesn't seem to cache the installer packages and the install directory for me.

VAllens avatar Jan 08 '24 07:01 VAllens