Skip to content

Commit

Permalink
added max retries
Browse files Browse the repository at this point in the history
Signed-off-by: midays <[email protected]>
  • Loading branch information
midays committed Nov 21, 2024
1 parent 8e7c2b2 commit 6ecd9eb
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/windows-nightly-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,24 @@ jobs:
shell: powershell
run: |
$InstallerPath = "C:\vscode-installer.exe"
Invoke-WebRequest -Uri "https://update.code.visualstudio.com/latest/win32-x64-user/stable" -OutFile $InstallerPath
Start-Process -FilePath $InstallerPath -ArgumentList "/silent" -Wait
$Uri = "https://update.code.visualstudio.com/latest/win32-x64-user/stable"
$RetryCount = 0
$MaxRetries = 3
$Success = $false
while (-not $Success -and $RetryCount -lt $MaxRetries) {
try {
Invoke-WebRequest -Uri $Uri -OutFile $InstallerPath -TimeoutSec 60
$Success = $true
} catch {
$RetryCount++
Write-Output "Download failed. Retry $RetryCount of $MaxRetries..."
Start-Sleep -Seconds 10
}
}
if (-not $Success) {
throw "Failed to download VSCode installer after $MaxRetries attempts."
}
- name: Check VSCode installation
shell: powershell
Expand Down

0 comments on commit 6ecd9eb

Please sign in to comment.