mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
[macOS] Add retry for toolcache assets (#1798)
* Add retry for toolset manifest downloading * Add common helper * Minor fix * Fix helper module path * Fix helper module path
This commit is contained in:
committed by
GitHub
parent
eb478e9f2b
commit
c5e468893d
@@ -74,3 +74,12 @@ function Get-ToolcachePackages {
|
|||||||
$toolcachePath = Join-Path $env:HOME "image-generation" "toolcache.json"
|
$toolcachePath = Join-Path $env:HOME "image-generation" "toolcache.json"
|
||||||
return Get-Content -Raw $toolcachePath | ConvertFrom-Json
|
return Get-Content -Raw $toolcachePath | ConvertFrom-Json
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Invoke-RestMethodWithRetry {
|
||||||
|
param (
|
||||||
|
[Parameter()]
|
||||||
|
[string]
|
||||||
|
$Url
|
||||||
|
)
|
||||||
|
Invoke-RestMethod $Url -MaximumRetryCount 10 -RetryIntervalSec 30
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
## Desc: Install toolset
|
## Desc: Install toolset
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
Import-Module "~/image-generation/helpers/Common.Helpers.psm1"
|
||||||
|
|
||||||
Function Get-ToolcacheFromToolset {
|
Function Get-ToolcacheFromToolset {
|
||||||
$toolsetPath = Join-Path $env:HOME "image-generation" "toolset.json"
|
$toolsetPath = Join-Path $env:HOME "image-generation" "toolset.json"
|
||||||
$toolsetJson = Get-Content -Raw $toolsetPath | ConvertFrom-Json
|
$toolsetJson = Get-Content -Raw $toolsetPath | ConvertFrom-Json
|
||||||
@@ -38,7 +40,7 @@ $tools = Get-ToolcacheFromToolset | Where-Object {$ToolsToInstall -contains $_.
|
|||||||
|
|
||||||
foreach ($tool in $tools) {
|
foreach ($tool in $tools) {
|
||||||
# Get versions manifest for current tool
|
# Get versions manifest for current tool
|
||||||
$assets = Invoke-RestMethod $tool.url
|
$assets = Invoke-RestMethodWithRetry -Url $tool.url
|
||||||
|
|
||||||
# Get github release asset for each version
|
# Get github release asset for each version
|
||||||
foreach ($version in $tool.versions) {
|
foreach ($version in $tool.versions) {
|
||||||
|
|||||||
Reference in New Issue
Block a user