diff options
author | dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> | 2020-12-28 16:21:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-28 16:21:45 +0300 |
commit | 95b6f21d197ad095f97b5045407d6f878b223619 (patch) | |
tree | 0919e7decb1201ff6b34b5c36a71210d7769c8f8 /eng/common/tools.ps1 | |
parent | ad8c47d4df098867937cc98001c9f19bedd7d8e9 (diff) |
Update dependencies from https://github.com/dotnet/arcade build 20201221.12 (#1715)
[master] Update dependencies from dotnet/arcade
Diffstat (limited to 'eng/common/tools.ps1')
-rw-r--r-- | eng/common/tools.ps1 | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index bc8b66e29..ce280eb95 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -439,11 +439,26 @@ function LocateVisualStudio([object]$vsRequirements = $null){ if (!(Test-Path $vsWhereExe)) { Create-Directory $vsWhereDir Write-Host 'Downloading vswhere' - try { - Invoke-WebRequest "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/vswhere/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe - } - catch { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ + $maxRetries = 5 + $retries = 1 + + while($true) { + try { + Invoke-WebRequest "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/vswhere/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe + break + } + catch{ + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ + } + + if (++$retries -le $maxRetries) { + $delayInSeconds = [math]::Pow(2, $retries) - 1 # Exponential backoff + Write-Host "Retrying. Waiting for $delayInSeconds seconds before next attempt ($retries of $maxRetries)." + Start-Sleep -Seconds $delayInSeconds + } + else { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unable to download file in $maxRetries attempts." + } } } |