mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-18 15:56:47 +00:00
[Windows] Add retries to Get-VsixExtenstionFromMarketplace function (#5418)
* Add retries to Get-VsixExtenstionFromMarketplace * Use Invoke-SBWithRetry function
This commit is contained in:
@@ -186,7 +186,7 @@ function Start-DownloadWithRetry
|
|||||||
|
|
||||||
$filePath = Join-Path -Path $DownloadPath -ChildPath $Name
|
$filePath = Join-Path -Path $DownloadPath -ChildPath $Name
|
||||||
$downloadStartTime = Get-Date
|
$downloadStartTime = Get-Date
|
||||||
|
|
||||||
# Default retry logic for the package.
|
# Default retry logic for the package.
|
||||||
while ($Retries -gt 0)
|
while ($Retries -gt 0)
|
||||||
{
|
{
|
||||||
@@ -229,7 +229,7 @@ function Get-VsixExtenstionFromMarketplace {
|
|||||||
)
|
)
|
||||||
|
|
||||||
$extensionUri = $MarketplaceUri + $ExtensionMarketPlaceName
|
$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":"(?<extensionname>[^"]*)' | Out-Null
|
$request -match 'UniqueIdentifierValue":"(?<extensionname>[^"]*)' | Out-Null
|
||||||
$extensionName = $Matches.extensionname
|
$extensionName = $Matches.extensionname
|
||||||
$request -match 'VsixId":"(?<vsixid>[^"]*)' | Out-Null
|
$request -match 'VsixId":"(?<vsixid>[^"]*)' | Out-Null
|
||||||
@@ -274,12 +274,12 @@ function Install-VsixExtension
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$installPath = ${env:ProgramFiles(x86)}
|
$installPath = ${env:ProgramFiles(x86)}
|
||||||
|
|
||||||
if (Test-IsWin22)
|
if (Test-IsWin22)
|
||||||
{
|
{
|
||||||
$installPath = ${env:ProgramFiles}
|
$installPath = ${env:ProgramFiles}
|
||||||
}
|
}
|
||||||
|
|
||||||
#There are 2 types of packages at the moment - exe and vsix
|
#There are 2 types of packages at the moment - exe and vsix
|
||||||
if ($Name -match "vsix")
|
if ($Name -match "vsix")
|
||||||
{
|
{
|
||||||
@@ -581,8 +581,8 @@ function Get-GitHubPackageDownloadUrl {
|
|||||||
[int]$SearchInCount = 100
|
[int]$SearchInCount = 100
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($Version -eq "latest") {
|
if ($Version -eq "latest") {
|
||||||
$Version = "*"
|
$Version = "*"
|
||||||
}
|
}
|
||||||
$json = Invoke-RestMethod -Uri "https://api.github.com/repos/${RepoOwner}/${RepoName}/releases?per_page=${SearchInCount}"
|
$json = Invoke-RestMethod -Uri "https://api.github.com/repos/${RepoOwner}/${RepoName}/releases?per_page=${SearchInCount}"
|
||||||
$versionToDownload = ($json.Where{ $_.prerelease -eq $IsPrerelease }.tag_name |
|
$versionToDownload = ($json.Where{ $_.prerelease -eq $IsPrerelease }.tag_name |
|
||||||
|
|||||||
Reference in New Issue
Block a user