Skip to content

[release/9.0.1xx] Backport dotnet-install script from a941e34 - #9780

Merged
jonathanpeppers merged 1 commit into
release/9.0.1xxfrom
dev/peppers/backport-9761
Feb 12, 2025
Merged

[release/9.0.1xx] Backport dotnet-install script from a941e34#9780
jonathanpeppers merged 1 commit into
release/9.0.1xxfrom
dev/peppers/backport-9761

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Partial backport of #9761

Update build-tools/xaprepare to improve reliability when running Step_InstallDotNetPreview. Step_InstallDotNetPreview will cache e.g. dotnet-install.sh into $HOME/android-archives, but there was no logic to verify that it was still valid.

We've been seeing some recurring build failures in macOS > Build such as:

Downloading dotnet-install script...
Warning: Using cached installation script found in '/Users/builder/android-archives/dotnet-install.sh'
Discovering download URLs for dotnet SDK '10.0.100-preview.2.25102.3'...
Downloading dotnet archive...
dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz not found
Downloading dotnet archive...
dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-arm64.10.0.100-preview.2.25102.3.tar.gz not found
Downloading dotnet archive...
Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
Downloading dotnet archive...
Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
Error: Installation of dotnet SDK '10.0.100-preview.2.25102.3' failed.
Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
System.InvalidOperationException: Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
at Xamarin.Android.Prepare.Scenario.Run(Context context, Log log) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Scenario.cs:line 50
at Xamarin.Android.Prepare.Context.Execute() in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:line 488
at Xamarin.Android.Prepare.App.Run(String[] args) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:line 155

Indeed, dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz no longer exists on https://dotnetcli.azureedge.net.

The problem, though, is that .NET changed the CDN that is used in the past month, and that's not the correct URL. A newer dotnet-install.sh reports:

% bash "…/dotnet-install.sh" "--version" "10.0.100-preview.2.25102.3" "--install-dir" "/Volumes/Xamarin-Work/src/dotnet/android/bin/Release/dotnet" "--verbose" "--dry-run
…
dotnet-install: Link 0: primary, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
dotnet-install: Link 1: legacy, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz
dotnet-install: Link 2: primary, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
dotnet-install: Link 3: legacy, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz

Note the different domain, https://builds.dotnet.microsoft.com!

Update Step_InstallDotNetPreview to try to install .NET potentially twice: the first time using the cached dotnet-install.sh, and if that fails, it tries again after downloading a newdotnet-install.sh.

Hopefully this will fix the build failure on this machine!

Partial backport of #9761
Update `build-tools/xaprepare` to improve reliability when
running `Step_InstallDotNetPreview`. `Step_InstallDotNetPreview`
will cache e.g. `dotnet-install.sh` into `$HOME/android-archives`,
but there was no logic to verify that it was still *valid*.
We've been seeing some recurring build failures in **macOS > Build**
such as:
Downloading dotnet-install script...
Warning: Using cached installation script found in '/Users/builder/android-archives/dotnet-install.sh'
Discovering download URLs for dotnet SDK '10.0.100-preview.2.25102.3'...
Downloading dotnet archive...
dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz not found
Downloading dotnet archive...
dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-arm64.10.0.100-preview.2.25102.3.tar.gz not found
Downloading dotnet archive...
Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
Downloading dotnet archive...
Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
Error: Installation of dotnet SDK '10.0.100-preview.2.25102.3' failed.
Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
System.InvalidOperationException: Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
at Xamarin.Android.Prepare.Scenario.Run(Context context, Log log) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Scenario.cs:line 50
at Xamarin.Android.Prepare.Context.Execute() in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:line 488
at Xamarin.Android.Prepare.App.Run(String[] args) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:line 155
Indeed, [`dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz`][0]
no longer exists on <https://dotnetcli.azureedge.net>.
The problem, though, is that .NET changed the CDN that is used in the
past month, and that's not the correct URL. A newer `dotnet-install.sh`
reports:
% bash "…/dotnet-install.sh" "--version" "10.0.100-preview.2.25102.3" "--install-dir" "/Volumes/Xamarin-Work/src/dotnet/android/bin/Release/dotnet" "--verbose" "--dry-run
…
dotnet-install: Link 0: primary, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
dotnet-install: Link 1: legacy, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz
dotnet-install: Link 2: primary, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
dotnet-install: Link 3: legacy, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz
Note the different domain, <https://builds.dotnet.microsoft.com>!
Update `Step_InstallDotNetPreview` to try to install .NET potentially
*twice*: the first time using the cached `dotnet-install.sh`, and
*if that fails*, it tries again after downloading a *new*
`dotnet-install.sh`.
Hopefully this will fix the build failure on this machine!
[0]: https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz
@jonathanpeppers
jonathanpeppers merged commit 0725c61 into release/9.0.1xxFeb 12, 2025
@jonathanpeppers
jonathanpeppers deleted the dev/peppers/backport-9761 branch February 12, 2025 03:34
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Mar 14, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@jonathanpeppers@dellis1972@pjcollins@jonpryor