mirror of
https://github.com/actions/runner-images.git
synced 2026-01-08 11:30:49 +08:00
[Windows] Rename the Invoke-SBWithRetry function (#8880)
This commit is contained in:
committed by
GitHub
parent
d2cbbb901b
commit
c73276d3f6
@@ -73,7 +73,7 @@ Expand-7ZipArchive -Path $cmdlineToolsArchPath -DestinationPath "${SDKInstallRoo
|
||||
|
||||
# cmdline tools should be installed in ${SDKInstallRoot}\cmdline-tools\latest\bin, but archive contains ${SDKInstallRoot}\cmdline-tools\bin
|
||||
# we need to create the proper folder structure
|
||||
Invoke-SBWithRetry -Command {
|
||||
Invoke-ScriptBlockWithRetry -Command {
|
||||
Rename-Item "${SDKInstallRoot}\cmdline-tools\cmdline-tools" "latest" -ErrorAction Stop
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ function Install-JavaJDK {
|
||||
|
||||
# Complete the installation by extracting Java binaries to toolcache and creating the complete file
|
||||
Expand-7ZipArchive -Path $archivePath -DestinationPath $javaVersionPath
|
||||
Invoke-SBWithRetry -Command {
|
||||
Invoke-ScriptBlockWithRetry -Command {
|
||||
Get-ChildItem -Path $javaVersionPath | Rename-Item -NewName $javaArchPath -ErrorAction Stop
|
||||
}
|
||||
New-Item -ItemType File -Path $javaVersionPath -Name "$Architecture.complete" | Out-Null
|
||||
|
||||
@@ -41,7 +41,7 @@ function Install-PyPy
|
||||
New-Item -ItemType Directory -Path $pypyVersionPath -Force | Out-Null
|
||||
|
||||
Write-Host "Move PyPy '${pythonVersion}' files to '${pypyArchPath}'"
|
||||
Invoke-SBWithRetry -Command {
|
||||
Invoke-ScriptBlockWithRetry -Command {
|
||||
Move-Item -Path $tempFolder -Destination $pypyArchPath -ErrorAction Stop | Out-Null
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ function Install-Ruby {
|
||||
New-Item -ItemType Directory -Path $rubyVersionPath -Force | Out-Null
|
||||
|
||||
Write-Host "Moving Ruby '${rubyVersion}' files to '${rubyArchPath}'"
|
||||
Invoke-SBWithRetry -Command {
|
||||
Invoke-ScriptBlockWithRetry -Command {
|
||||
Move-Item -Path $tempFolder -Destination $rubyArchPath -ErrorAction Stop | Out-Null
|
||||
}
|
||||
|
||||
|
||||
@@ -38,14 +38,18 @@ $tools = Get-ToolsetContent | Select-Object -ExpandProperty toolcache | Where-Ob
|
||||
|
||||
foreach ($tool in $tools) {
|
||||
# Get versions manifest for current tool
|
||||
$assets = Invoke-SBWithRetry -Command { Invoke-RestMethod $tool.url }
|
||||
# Invoke-RestMethod doesn't support retry in PowerShell 5.1
|
||||
$assets = Invoke-ScriptBlockWithRetry -Command {
|
||||
Invoke-RestMethod $tool.url
|
||||
}
|
||||
|
||||
# Get github release asset for each version
|
||||
foreach ($toolVersion in $tool.versions) {
|
||||
$asset = $assets | Where-Object version -like $toolVersion `
|
||||
| Select-Object -ExpandProperty files `
|
||||
| Where-Object { ($_.platform -eq $tool.platform) -and ($_.arch -eq $tool.arch) -and ($_.toolset -eq $tool.toolset) } `
|
||||
| Select-Object -First 1
|
||||
$asset = $assets `
|
||||
| Where-Object version -like $toolVersion `
|
||||
| Select-Object -ExpandProperty files `
|
||||
| Where-Object { ($_.platform -eq $tool.platform) -and ($_.arch -eq $tool.arch) -and ($_.toolset -eq $tool.toolset) } `
|
||||
| Select-Object -First 1
|
||||
|
||||
Write-Host "Installing $($tool.name) $toolVersion $($tool.arch)..."
|
||||
if ($null -ne $asset) {
|
||||
|
||||
@@ -13,6 +13,7 @@ if (-not $vsixPackagesList) {
|
||||
$vsixPackagesList | ForEach-Object {
|
||||
# Retrieve cdn endpoint to avoid HTTP error 429 https://github.com/actions/runner-images/issues/3074
|
||||
$vsixPackage = Get-VsixExtenstionFromMarketplace -ExtensionMarketPlaceName $_
|
||||
Write-Host "Installing $vsixPackage"
|
||||
if ($vsixPackage.FileName.EndsWith(".vsix")) {
|
||||
Install-VSIXFromUrl $vsixPackage.DownloadUri
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## Desc: Waits for Windows Updates to finish installing after reboot
|
||||
################################################################################
|
||||
|
||||
Invoke-SBWithRetry -RetryCount 10 -RetryIntervalSeconds 120 -Command {
|
||||
Invoke-ScriptBlockWithRetry -RetryCount 10 -RetryIntervalSeconds 120 -Command {
|
||||
$inProgress = Get-WindowsUpdateStates | Where-Object State -eq "Running" | Where-Object Title -notmatch "Microsoft Defender Antivirus"
|
||||
if ( $inProgress ) {
|
||||
$title = $inProgress.Title -join "`n"
|
||||
|
||||
@@ -15,7 +15,7 @@ $filesInArchive = 7z l $zstdArchivePath | Out-String
|
||||
|
||||
if ($filesInArchive.Contains($zstdParentName)) {
|
||||
Expand-7ZipArchive -Path $zstdArchivePath -DestinationPath $toolPath
|
||||
Invoke-SBWithRetry -Command {
|
||||
Invoke-ScriptBlockWithRetry -Command {
|
||||
Move-Item -Path "${zstdPath}*" -Destination $zstdPath -ErrorAction Stop
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user