Skip to content

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

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

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

jonathanpeppers
Copy link
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 new dotnet-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 force-pushed the dev/peppers/backport-9761 branch from fef8037 to 9ca1f82 Compare February 11, 2025 18:32
@jonathanpeppers jonathanpeppers merged commit 0725c61 into release/9.0.1xx Feb 12, 2025
57 checks passed
@jonathanpeppers jonathanpeppers deleted the dev/peppers/backport-9761 branch February 12, 2025 03:34
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2025
Sign up for free to 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