Skip to content

Commit 666cf50

Browse files
[xaprepare] skip download progress for dotnet-install script (#9053)
We are getting the error pretty early on during the build: Downloading dotnet-install script... Warning: Failed to obtain dotnet-install script size from URL 'https://dot.net/v1/dotnet-install.sh'. HTTP status code: InternalServerError (500)a -> https://dot.net/v1/dotnet-install.sh downloading dotnet-install.sh It seems the code is timing out on the call: await httpClient.GetAsync (url, HttpCompletionOption.ResponseHeadersRead); And then the code has some retry logic that eventually returns: return (false, 0, HttpStatusCode.InternalServerError); I am unable to reproduce this locally on either Mac or Windows. Reworking this code to just download the file with no progress appears to solve the problem on Azure DevOps build agents.
1 parent ddb215b commit 666cf50

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

build-tools/xaprepare/xaprepare/Application/DownloadStatus.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class DownloadStatus
1010
const uint DefaultUpdateInterval = 1000;
1111
readonly object updateLock = new object ();
1212

13+
public static readonly DownloadStatus Empty = new DownloadStatus (0, _ => { });
14+
1315
ConcurrentQueue<ulong> byteSnapshots;
1416
Stopwatch watch;
1517
Action<DownloadStatus> updater;

build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,13 @@ async Task<bool> DownloadDotNetInstallScript (Context context, string dotnetScri
7878

7979
Log.StatusLine ("Downloading dotnet-install script...");
8080

81-
(bool success, ulong size, HttpStatusCode status) = await Utilities.GetDownloadSizeWithStatus (dotnetScriptUrl);
82-
if (!success) {
83-
if (status == HttpStatusCode.NotFound) {
84-
Log.WarningLine ($"dotnet-install URL '{dotnetScriptUrl}' not found.");
85-
} else {
86-
Log.WarningLine ($"Failed to obtain dotnet-install script size from URL '{dotnetScriptUrl}'. HTTP status code: {status} ({(int) status})");
87-
}
88-
89-
if (File.Exists (dotnetScriptPath)) {
90-
Log.WarningLine ($"Using cached installation script found in '{dotnetScriptPath}'");
91-
return true;
92-
}
81+
if (File.Exists (dotnetScriptPath)) {
82+
Log.WarningLine ($"Using cached installation script found in '{dotnetScriptPath}'");
83+
return true;
9384
}
9485

95-
DownloadStatus downloadStatus = Utilities.SetupDownloadStatus (context, size, context.InteractiveSession);
9686
Log.StatusLine ($" {context.Characters.Link} {dotnetScriptUrl}", ConsoleColor.White);
97-
await Download (context, dotnetScriptUrl, tempDotnetScriptPath, "dotnet-install", Path.GetFileName (dotnetScriptUrl.LocalPath), downloadStatus);
87+
await Utilities.Download (dotnetScriptUrl, tempDotnetScriptPath, DownloadStatus.Empty);
9888

9989
if (File.Exists (tempDotnetScriptPath)) {
10090
Utilities.CopyFile (tempDotnetScriptPath, dotnetScriptPath);

0 commit comments

Comments
 (0)