mirror of
https://github.com/containers/podman.git
synced 2025-06-26 04:46:57 +08:00
Introduce pkg retry logic in win installer task
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
This commit is contained in:
@ -1,6 +1,25 @@
|
|||||||
# Update service is required for dotnet 3.5 (dep of wix)
|
# Update service is required for dotnet 3.5 (dep of wix)
|
||||||
Set-Service -Name wuauserv -StartupType "Manual"
|
Set-Service -Name wuauserv -StartupType "Manual"
|
||||||
choco install -y wixtoolset mingw golang archiver
|
function retryInstall {
|
||||||
if ($LASTEXITCODE -ne 0) {
|
param([Parameter(ValueFromRemainingArguments)] [string[]] $pkgs)
|
||||||
Exit 1
|
|
||||||
|
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 mingw@11.2 golang archiver
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Powershell doesn't exit after
|
# Powershell doesn't exit after
|
||||||
function CheckExit {
|
function CheckExit {
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
Exit $LASTEXITCODE
|
throw "Exit code = $LASTEXITCODE"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function DownloadFile {
|
function DownloadFile {
|
||||||
@ -50,11 +50,10 @@ $ret = Start-Process -Wait -PassThru ".\podman-${ENV:WIN_INST_VER}-dev-setup.exe
|
|||||||
if ($ret.ExitCode -ne 0) {
|
if ($ret.ExitCode -ne 0) {
|
||||||
Write-Host "Install failed, dumping log"
|
Write-Host "Install failed, dumping log"
|
||||||
Get-Content inst.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 `
|
if (! ((Test-Path -Path "C:\Program Files\RedHat\Podman\podman.exe") -and `
|
||||||
(Test-Path -Path "C:\Program Files\RedHat\Podman\win-sshproxy.exe"))) {
|
(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"
|
throw "Expected podman.exe and win-sshproxy.exe, one or both not present after install"
|
||||||
Exit 1
|
|
||||||
}
|
}
|
||||||
Write-Host "Installer verification successful!"
|
Write-Host "Installer verification successful!"
|
||||||
|
Reference in New Issue
Block a user