From e1b218a38a634e6d8d141791d6d5059a6b636652 Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Date: Wed, 20 Apr 2022 16:23:32 +0400 Subject: [PATCH] [Windows] Add retries to Get-VsixExtenstionFromMarketplace function (#5418) * Add retries to Get-VsixExtenstionFromMarketplace * Use Invoke-SBWithRetry function --- images/win/scripts/ImageHelpers/InstallHelpers.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 7c1f1ba8..6de28c6d 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -186,7 +186,7 @@ function Start-DownloadWithRetry $filePath = Join-Path -Path $DownloadPath -ChildPath $Name $downloadStartTime = Get-Date - + # Default retry logic for the package. while ($Retries -gt 0) { @@ -229,7 +229,7 @@ function Get-VsixExtenstionFromMarketplace { ) $extensionUri = $MarketplaceUri + $ExtensionMarketPlaceName - $request = Invoke-WebRequest -Uri $extensionUri -UseBasicParsing + $request = Invoke-SBWithRetry -Command { Invoke-WebRequest -Uri $extensionUri -UseBasicParsing } -RetryCount 20 -RetryIntervalSeconds 30 $request -match 'UniqueIdentifierValue":"(?[^"]*)' | Out-Null $extensionName = $Matches.extensionname $request -match 'VsixId":"(?[^"]*)' | Out-Null @@ -274,12 +274,12 @@ function Install-VsixExtension try { $installPath = ${env:ProgramFiles(x86)} - + if (Test-IsWin22) { $installPath = ${env:ProgramFiles} } - + #There are 2 types of packages at the moment - exe and vsix if ($Name -match "vsix") { @@ -581,8 +581,8 @@ function Get-GitHubPackageDownloadUrl { [int]$SearchInCount = 100 ) - if ($Version -eq "latest") { - $Version = "*" + if ($Version -eq "latest") { + $Version = "*" } $json = Invoke-RestMethod -Uri "https://api.github.com/repos/${RepoOwner}/${RepoName}/releases?per_page=${SearchInCount}" $versionToDownload = ($json.Where{ $_.prerelease -eq $IsPrerelease }.tag_name |