-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Better retries #22898
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
Better retries #22898
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
5bede7b
Retries for dotnet-install dl
HaoK 0c44cb9
Use retry dotnet install dl
HaoK b98a6c4
Add tls fix
HaoK 4a4587e
Force no cdn for correct dl links?
HaoK 6a9b68e
Try old and new
HaoK d4f0e53
Add retries
HaoK ff539a1
Update runtests.cmd
HaoK 55c7279
Update GetDotNetInstall.ps1
HaoK 327644f
Update GetDotNetInstall.ps1
HaoK 6ede15e
Update GetDotNetInstall.ps1
HaoK c8bff3b
Update GetDotNetInstall.ps1
HaoK 634b90a
Create Download.ps1
HaoK 76d9188
Install chrome with retry dls
HaoK 47ef54a
Strength install jdk
HaoK c9270bb
Strengthen procdump
HaoK 294c0f0
Update InstallJdk.ps1
HaoK 2468d0c
Fix script root paths, use helper
HaoK 0c14c12
Update InstallDotNet.ps1
HaoK 0759d40
CR feedback
HaoK 4b079e8
Merge branch 'haok/retry' of https://github.com/dotnet/aspnetcore int…
HaoK 865255c
Update Download.ps1
HaoK 6df87ec
Update Download.ps1
HaoK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Downloads a given URI and saves it to outputFile | ||
| .DESCRIPTION | ||
| Downloads a given URI and saves it to outputFile | ||
| PARAMETER uri | ||
| The URI to fetch | ||
| .PARAMETER outputFile | ||
| The outputh file path to save the URI | ||
| #> | ||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| $uri, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| $outputFile | ||
| ) | ||
| [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | ||
| $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit | ||
|
|
||
| $maxRetries = 5 | ||
| $retries = 1 | ||
|
|
||
| while($true) { | ||
| try { | ||
| Write-Host "GET $uri" | ||
| Invoke-WebRequest $uri -OutFile $outputFile | ||
| break | ||
| } | ||
| catch { | ||
| Write-Host "Failed to download '$uri'" | ||
| $error = $_.Exception.Message | ||
| } | ||
|
|
||
| if (++$retries -le $maxRetries) { | ||
| Write-Warning $error -ErrorAction Continue | ||
| $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-Error $error -ErrorAction Continue | ||
| throw "Unable to download file in $maxRetries attempts." | ||
| } | ||
| } | ||
|
|
||
| Write-Host "Download of '$uri' complete, saved to $outputFile..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Installs dotnet sdk and runtime using https://dot.net/v1/dotnet-install.ps1 | ||
| .DESCRIPTION | ||
| Installs dotnet sdk and runtime using https://dot.net/v1/dotnet-install.ps1 | ||
| .PARAMETER arch | ||
| The architecture to install. | ||
| .PARAMETER sdkVersion | ||
| The sdk version to install | ||
| .PARAMETER runtimeVersion | ||
| The runtime version to install | ||
| .PARAMETER installDir | ||
| The directory to install to | ||
| #> | ||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| $arch, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| $sdkVersion, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| $runtimeVersion, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| $installDir | ||
| ) | ||
|
|
||
| & $PSScriptRoot\Download.ps1 "https://dot.net/v1/dotnet-install.ps1" $PSScriptRoot\dotnet-install.ps1 | ||
| Write-Host "Download of dotnet-install.ps1 complete..." | ||
| Write-Host "Installing SDK...& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Version $sdkVersion -InstallDir $installDir" | ||
| Invoke-Expression "& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Version $sdkVersion -InstallDir $installDir" | ||
| Write-Host "Installing Runtime...& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Runtime dotnet -Version $runtimeVersion -InstallDir $installDir" | ||
| Invoke-Expression "& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Runtime dotnet -Version $runtimeVersion -InstallDir $installDir" | ||
| Write-Host "InstallDotNet.ps1 complete..." | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <# | ||
HaoK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .SYNOPSIS | ||
| Downloads a given uri and saves it to outputFile | ||
| .DESCRIPTION | ||
| Downloads a given uri and saves it to outputFile | ||
| PARAMETER uri | ||
| The uri to fetch | ||
| .PARAMETER outputFile | ||
| The outputh file path to save the uri | ||
| #> | ||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| $uri, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| $outputFile | ||
| ) | ||
| [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | ||
| $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit | ||
|
|
||
| $maxRetries = 5 | ||
| $retries = 1 | ||
|
|
||
| while($true) { | ||
| try { | ||
| Write-Host "GET $uri" | ||
| Invoke-WebRequest $uri -OutFile $outputFile | ||
| break | ||
| } | ||
| catch { | ||
| Write-Host "Failed to download '$uri'" | ||
| $error = $_.Exception.Message | ||
| } | ||
|
|
||
| if (++$retries -le $maxRetries) { | ||
| Write-Warning $error -ErrorAction Continue | ||
| $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-Error $error -ErrorAction Continue | ||
| throw "Unable to download file in $maxRetries attempts." | ||
| } | ||
| } | ||
|
|
||
| Write-Host "Download of '$uri' complete, saved to $outputFile..." | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| $InstallerPath = "$env:Temp\chrome_installer.exe"; | ||
| Invoke-WebRequest "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" -OutFile $InstallerPath; | ||
| & $PSScriptRoot\Download.ps1 "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" $InstallerPath | ||
| Start-Process -FilePath $InstallerPath -Args "/silent /install" -Verb RunAs -Wait; | ||
| Remove-Item $InstallerPath |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.