File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change 55
66LogGroup ' Init - Setup prerequisites' {
77 ' Markdown' | ForEach-Object {
8- Write-Output " Installing module: $_ "
9- Install-PSResource - Name $_ - WarningAction SilentlyContinue - TrustRepository - Repository PSGallery
10- Import-Module - Name $_
8+ $name = $_
9+ Write-Output " Installing module: $name "
10+ $retryCount = 5
11+ $retryDelay = 10
12+ for ($i = 0 ; $i -lt $retryCount ; $i ++ ) {
13+ try {
14+ Install-PSResource - Name $name - WarningAction SilentlyContinue - TrustRepository - Repository PSGallery
15+ break
16+ } catch {
17+ Write-Warning " Installation of $name failed with error: $_ "
18+ if ($i -eq $retryCount - 1 ) {
19+ throw
20+ }
21+ Write-Warning " Retrying in $retryDelay seconds..."
22+ Start-Sleep - Seconds $retryDelay
23+ }
24+ }
25+ Import-Module - Name $name
1126 }
1227 Import-Module " $PSScriptRoot /Helpers.psm1"
1328}
You can’t perform that action at this time.
0 commit comments