dotnet / install-scripts

MIT License
133 stars 72 forks source link

Ability to use github releases tags #399

Open davhdavh opened 1 year ago

davhdavh commented 1 year ago

It is quite common to have a setup where one tracks releases in some ways.

E.g. here is example of using renovatebot to track github releases in a dockerfile:

# renovate: datasource=github-releases depName=dotnet/sdk
ENV DOTNET_VERSION=v7.0.401
# renovate: datasource=github-releases depName=dotnet/sdk
ENV DOTNET_PREVIEW_VERSION=v8.0.100-rc.1.23462.41

and one might think that it would be trivial to install based on these...

RUN Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'; `
    .\dotnet-install.ps1 -Version $env:DOTNET_VERSION; `
    .\dotnet-install.ps1 -Version $env:DOTNET_PREVIEW_VERSION; `
   Remove-Item ./dotnet-install.ps1;

but that does not work at all...

  1. Version number conflicts: Github-releases says latest release of 8.0 23455 is v8.0.100-rc.1.23455.21, but ./dotnet-install.sh --dry-run --quality preview --channel 8.0 currently returns a url to 8.0.100-rc.1.23455.8. .21 is not on dotnetcli.azureedge.net at all.

  2. Sync problem: Github-releases says latest release of 8.0 is v8.0.100-rc.1.23462.41, but ./dotnet-install.sh --dry-run --quality preview --channel 8.0 currently returns a url to 8.0.100-rc.1.23455.8. 23462 is not on dotnetcli.azureedge.net at all.

  3. Url mess: ./dotnet-install.sh --dry-run --quality ga --channel 7.0 will download https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.401/dotnet-sdk-7.0.401-linux-x64.tar.gz, but .\dotnet-install.ps1 -Version $env:DOTNET_VERSION will download https://dotnetcli.azureedge.net/dotnet/Sdk/v7.0.401/dotnet-sdk-v7.0.401-linux-x64.tar.gz, ie it didn't parse the version at all to give a valid download path

PS. github-releases api url: https://api.github.com/repos/dotnet/sdk/tags

davhdavh commented 1 year ago

Ok, a bit more digging and it turns out that the version tags is a mess in itself:

https://api.github.com/repos/dotnet/core/tags => "name": "v8.0.0-rc.1",
https://api.github.com/repos/dotnet/sdk/tags => "name": "v8.0.100-rc.1.23462.41",
https://api.github.com/repos/dotnet/aspnetcore/tags => "name": "v8.0.0-rc.1.23421.29",
https://api.github.com/repos/dotnet/installer/tags => "name": "v8.0.100-rc.1.23463.5",
https://api.github.com/repos/dotnet/runtime/tags => "name": "v8.0.0-rc.1.23419.4",
https://api.github.com/repos/dotnet/dotnet/tags => "name": "v8.0.100-preview.3.23178.7",
https://github.com/dotnet/dotnet/releases => v8.0.0-rc.1.23419.4
https://github.com/dotnet/core/blob/main/release-notes/8.0/preview/8.0.0-rc.1.md => .NET SDK 8.0.100-rc.1.23463.5
.\dotnet-install.ps1 -Quality preview -Channel 8.0 -DryRun => 8.0.100-rc.1.23455.8
YuliiaKovalova commented 1 year ago

Hi @davhdavh,

Thank you for reporting this issue, we are investigating it.

@baronfel, please join the discussion.