Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce pkg retry logic in win installer verify task #17062

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions contrib/cirrus/win-installer-install.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# Update service is required for dotnet 3.5 (dep of wix)
Set-Service -Name wuauserv -StartupType "Manual"
choco install -y wixtoolset mingw golang archiver
if ($LASTEXITCODE -ne 0) {
Exit 1
function retryInstall {
param([Parameter(ValueFromRemainingArguments)] [string[]] $pkgs)

foreach ($pkg in $pkgs) {
for ($retries = 0; ; $retries++) {
if ($retries -gt 5) {
throw "Could not install package $pkg"
}

if ($pkg -match '(.[^\@]+)@(.+)') {
$pkg = @("--version", $Matches.2, $Matches.1)
}

choco install -y $pkg
if ($LASTEXITCODE -eq 0) {
break
}
Write-Output "Error installing, waiting before retry..."
Start-Sleep -Seconds 6
}
}
}
retryInstall wixtoolset [email protected] golang archiver
7 changes: 3 additions & 4 deletions contrib/cirrus/win-installer-main.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Powershell doesn't exit after
function CheckExit {
if ($LASTEXITCODE -ne 0) {
Exit $LASTEXITCODE
throw "Exit code = $LASTEXITCODE"
}
}
function DownloadFile {
Expand Down Expand Up @@ -50,11 +50,10 @@ $ret = Start-Process -Wait -PassThru ".\podman-${ENV:WIN_INST_VER}-dev-setup.exe
if ($ret.ExitCode -ne 0) {
Write-Host "Install failed, dumping log"
Get-Content inst.log
Exit $ret.ExitCode
throw "Exit code is $($ret.ExitCode)"
}
if (! ((Test-Path -Path "C:\Program Files\RedHat\Podman\podman.exe") -and `
(Test-Path -Path "C:\Program Files\RedHat\Podman\win-sshproxy.exe"))) {
Write-Host "Expected podman.exe and win-sshproxy.exe, one or both not present after install"
Exit 1
throw "Expected podman.exe and win-sshproxy.exe, one or both not present after install"
}
Write-Host "Installer verification successful!"