diff options
author | Joel Hendrix <jhendrix@microsoft.com> | 2016-05-26 10:01:38 -0700 |
---|---|---|
committer | Joel Hendrix <jhendrix@microsoft.com> | 2016-05-26 10:01:38 -0700 |
commit | 2fab93aebd5365ea3716a4a4d3b87d6047698e09 (patch) | |
tree | 85f3347204947ed41e9fd9efb1ff1865b1962a2c /init-tools.cmd | |
parent | 7823f314a3b846c9f04f63653d8f1a1cd5d0a269 (diff) | |
download | coreclr-2fab93aebd5365ea3716a4a4d3b87d6047698e09.tar.gz coreclr-2fab93aebd5365ea3716a4a4d3b87d6047698e09.tar.bz2 coreclr-2fab93aebd5365ea3716a4a4d3b87d6047698e09.zip |
Add retry logic when downloading the CLI from Azure blob storage.
Downloading from Azure can transiently fail for a number of reasons. Add
some retry logic when downloading to avoid transient failures. For *nix
variants add a retry value when using curl (wget retries by default).
Diffstat (limited to 'init-tools.cmd')
-rw-r--r-- | init-tools.cmd | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/init-tools.cmd b/init-tools.cmd index d15c641e5a..669e6a05a6 100644 --- a/init-tools.cmd +++ b/init-tools.cmd @@ -48,7 +48,7 @@ set DOTNET_ZIP_NAME=dotnet-dev-win-x64.%DOTNET_VERSION%.zip set DOTNET_REMOTE_PATH=https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/%DOTNET_VERSION%/%DOTNET_ZIP_NAME% set DOTNET_LOCAL_PATH=%DOTNET_PATH%%DOTNET_ZIP_NAME% echo Installing '%DOTNET_REMOTE_PATH%' to '%DOTNET_LOCAL_PATH%' >> "%INIT_TOOLS_LOG%" -powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadFile('%DOTNET_REMOTE_PATH%', '%DOTNET_LOCAL_PATH%'); Add-Type -Assembly 'System.IO.Compression.FileSystem' -ErrorVariable AddTypeErrors; if ($AddTypeErrors.Count -eq 0) { [System.IO.Compression.ZipFile]::ExtractToDirectory('%DOTNET_LOCAL_PATH%', '%DOTNET_PATH%') } else { (New-Object -com shell.application).namespace('%DOTNET_PATH%').CopyHere((new-object -com shell.application).namespace('%DOTNET_LOCAL_PATH%').Items(),16) }" >> "%INIT_TOOLS_LOG%" +powershell -NoProfile -ExecutionPolicy unrestricted -Command "$retryCount = 0; $success = $false; do { try { (New-Object Net.WebClient).DownloadFile('%DOTNET_REMOTE_PATH%', '%DOTNET_LOCAL_PATH%'); $success = $true; } catch { if ($retryCount -ge 6) { throw; } else { $retryCount++; Start-Sleep -Seconds (5 * $retryCount); } } } while ($success -eq $false); Add-Type -Assembly 'System.IO.Compression.FileSystem' -ErrorVariable AddTypeErrors; if ($AddTypeErrors.Count -eq 0) { [System.IO.Compression.ZipFile]::ExtractToDirectory('%DOTNET_LOCAL_PATH%', '%DOTNET_PATH%') } else { (New-Object -com shell.application).namespace('%DOTNET_PATH%').CopyHere((new-object -com shell.application).namespace('%DOTNET_LOCAL_PATH%').Items(),16) }" >> "%INIT_TOOLS_LOG%" if NOT exist "%DOTNET_LOCAL_PATH%" ( echo ERROR: Could not install dotnet cli correctly. See '%INIT_TOOLS_LOG%' for more details. set TOOLS_INIT_RETURN_CODE=1 |