Merge pull request #25135 from l0rd/win-installer-block-351-upgrade

Avoid upgrading from v5.3.1 on Windows
This commit is contained in:
openshift-merge-bot[bot]
2025-01-28 12:11:35 +00:00
committed by GitHub
4 changed files with 61 additions and 36 deletions

View File

@ -20,11 +20,7 @@ Push-Location $WIN_INST_FOLDER
# Download the previous installer to test a major update
if (!$env:PREV_SETUP_EXE_PATH) {
# After v5.3.2 is released we should replace
# `Get-Podman-Setup-From-GitHub -version "tags/v5.3.0"`
# with
# `Get-Latest-Podman-Setup-From-GitHub`
$env:PREV_SETUP_EXE_PATH = Get-Podman-Setup-From-GitHub -version "tags/v5.3.0"
$env:PREV_SETUP_EXE_PATH = Get-Latest-Podman-Setup-From-GitHub
}
# Note: consumes podman-remote-release-windows_amd64.zip from repo.tar.zst

View File

@ -22,6 +22,11 @@
<util:RegistrySearch Id="CurrentBuild" Variable="CBNumber" Result="value" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" Value="CurrentBuildNumber" />
<bal:Condition Message="Windows 10 (19041) or later is required to run this application." Condition="VersionNT &gt;= v10.0 AND (CBNumber &gt;= 19041 OR AllowOldWin = 1)" />
<bal:Condition Message="You have an installed development, pre-release version, or alternative build identifying as the same version of this installer. You must uninstall the existing version of Podman first, before proceeding." Condition="WixBundleInstalled OR WixBundleForcedRestartPackage OR PreviousVersion &lt;&gt; VERSION" />
<!-- Next condition blocks upgrades from v5.3.1. That's because that version
of the installer has a bug (that got patched in v5.3.2) and upgrading
from v5.3.1 requires upgrading to v5.3.2 first.
c.f. https://github.com/containers/podman/issues/24735 -->
<bal:Condition Message="You have v5.3.1 of Podman installed and upgrading to this version is not allowed. You must upgrade to v5.3.2 first." Condition="PreviousVersion &lt;&gt; v5.3.1" />
<Chain>
<MsiPackage Id="Setup" SourceFile="en-US\podman.msi" Vital="yes">
<MsiProperty Name="INSTALLDIR" Value="[InstallFolder]" />

View File

@ -10,7 +10,7 @@
<?define UseGVProxy = ""?>
<?endif?>
<Package Name="podman" Manufacturer="Red Hat Inc." Version="$(VERSION)" UpgradeCode="a6a9dd9c-0732-44ba-9279-ffe22ea50671" ProductCode="18107131-1820-4878-8AEE-65AAE37BC1E3">
<Package Name="podman" Manufacturer="Red Hat Inc." Version="$(VERSION)" UpgradeCode="a6a9dd9c-0732-44ba-9279-ffe22ea50671">
<Media Id="1" Cabinet="Podman.cab" EmbedCab="yes" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." RemoveFeatures="Complete" Schedule="afterInstallExecute" />
<Property Id="DiskPrompt" Value="Red Hat's Podman $(VERSION) Installation" />

View File

@ -1,10 +1,6 @@
#!/usr/bin/env pwsh
# Usage examples:
#
# 1) Build a v9.9.9 installer and run `update-without-user-chages`
# scenario without specifying the previous setup exe (it will download from
# GitHub):
# Usage example:
#
# rm .\contrib\win-installer\*.log &&
# rm .\contrib\win-installer\*.exe &&
@ -12,7 +8,7 @@
# .\winmake.ps1 installer &&
# .\winmake.ps1 installer 9.9.9 &&
# .\contrib\win-installer\test-installer.ps1 `
# -scenario update-without-user-changes `
# -scenario all `
# -previousSetupExePath ".\contrib\win-installer\podman-5.3.0-dev-setup.exe" `
# -setupExePath ".\contrib\win-installer\podman-5.4.0-dev-setup.exe" `
# -nextSetupExePath ".\contrib\win-installer\podman-9.9.9-dev-setup.exe" `
@ -25,6 +21,7 @@ param (
[ValidateSet("test-objects-exist", "test-objects-exist-not", "installation-green-field", "installation-skip-config-creation-flag", "installation-with-pre-existing-podman-exe",
"update-without-user-changes", "update-with-user-changed-config-file", "update-with-user-removed-config-file",
"update-without-user-changes-to-next", "update-with-user-changed-config-file-to-next", "update-with-user-removed-config-file-to-next",
"update-without-user-changes-from-531",
"all")]
[string]$scenario,
[ValidateScript({Test-Path $_ -PathType Leaf})]
@ -101,6 +98,25 @@ function Install-Podman-With-Defaults {
}
Write-Host "Installation completed successfully!`n"
}
function Install-Podman-With-Defaults-Expected-Fail {
param (
[Parameter(Mandatory)]
[ValidateScript({Test-Path $_ -PathType Leaf})]
[string]$setupExePath
)
Write-Host "Running the installer using defaults ($setupExePath)..."
$ret = Start-Process -Wait `
-PassThru "$setupExePath" `
-ArgumentList "/install /quiet `
/log $PSScriptRoot\podman-setup-default.log"
if ($ret.ExitCode -eq 0) {
Write-Host "Install completed successfully but a failure was expected, dumping log"
Get-Content $PSScriptRoot\podman-setup-default.log
throw "Exit code is $($ret.ExitCode)"
}
Write-Host "Installation has failed as expected!`n"
}
function Install-Current-Podman {
Install-Podman -setupExePath $setupExePath
@ -259,7 +275,7 @@ function Start-Scenario-Installation-With-Pre-Existing-Podman-Exe {
function Start-Scenario-Update-Without-User-Changes {
param (
[ValidateSet("From-Previous", "To-Next")]
[ValidateSet("From-Previous", "To-Next", "From-v531")]
[string]$mode="From-Previous"
)
Write-Host "`n======================================================"
@ -268,12 +284,22 @@ function Start-Scenario-Update-Without-User-Changes {
switch ($mode) {
'From-Previous' {$i = $previousSetupExePath; $u = $setupExePath}
'To-Next' {$i = $setupExePath; $u = $nextSetupExePath}
'From-v531' {$i = $v531SetupExePath; $u = $setupExePath}
}
Install-Podman -setupExePath $i
Test-Installation
Install-Podman-With-Defaults -setupExePath $u
Test-Installation
Uninstall-Podman -setupExePath $u
# Updates are expected to succeed except when updating from v5.3.1
# The v5.3.1 installer has a bug that is patched in v5.3.2
# Upgrading from v5.3.1 requires upgrading to v5.3.2 first
if ($mode -eq "From-Previous" -or $mode -eq "To-Next") {
Install-Podman-With-Defaults -setupExePath $u
Test-Installation
Uninstall-Podman -setupExePath $u
} else { # From-v531 is expected to fail
Install-Podman-With-Defaults-Expected-Fail -setupExePath $u
Uninstall-Podman -setupExePath $i
}
Test-Uninstallation
}
@ -281,6 +307,10 @@ function Start-Scenario-Update-Without-User-Changes-To-Next {
Start-Scenario-Update-Without-User-Changes -mode "To-Next"
}
function Start-Scenario-Update-Without-User-Changes-From-v531 {
Start-Scenario-Update-Without-User-Changes -mode "From-v531"
}
function Start-Scenario-Update-With-User-Changed-Config-File {
param (
[ValidateSet("From-Previous", "To-Next")]
@ -349,11 +379,7 @@ switch ($scenario) {
}
'update-without-user-changes' {
if (!$previousSetupExePath) {
# After v5.3.2 is released we should replace
# `Get-Podman-Setup-From-GitHub -version "tags/v5.3.0"`
# with
# `Get-Latest-Podman-Setup-From-GitHub`
$previousSetupExePath = Get-Podman-Setup-From-GitHub -version "tags/v5.3.0"
$previousSetupExePath = Get-Latest-Podman-Setup-From-GitHub
}
Start-Scenario-Update-Without-User-Changes
}
@ -363,13 +389,15 @@ switch ($scenario) {
}
Start-Scenario-Update-Without-User-Changes-To-Next
}
'update-without-user-changes-from-531' {
if (!$v531SetupExePath) {
$v531SetupExePath = Get-Podman-Setup-From-GitHub -version "tags/v5.3.1"
}
Start-Scenario-Update-Without-User-Changes-From-v531
}
'update-with-user-changed-config-file' {
if (!$previousSetupExePath) {
# After v5.3.2 is released we should replace
# `Get-Podman-Setup-From-GitHub -version "tags/v5.3.0"`
# with
# `Get-Latest-Podman-Setup-From-GitHub`
$previousSetupExePath = Get-Podman-Setup-From-GitHub -version "tags/v5.3.0"
$previousSetupExePath = Get-Latest-Podman-Setup-From-GitHub
}
Start-Scenario-Update-With-User-Changed-Config-File
}
@ -381,11 +409,7 @@ switch ($scenario) {
}
'update-with-user-removed-config-file' {
if (!$previousSetupExePath) {
# After v5.3.2 is released we should replace
# `Get-Podman-Setup-From-GitHub -version "tags/v5.3.0"`
# with
# `Get-Latest-Podman-Setup-From-GitHub`
$previousSetupExePath = Get-Podman-Setup-From-GitHub -version "tags/v5.3.0"
$previousSetupExePath = Get-Latest-Podman-Setup-From-GitHub
}
Start-Scenario-Update-With-User-Removed-Config-File
}
@ -400,11 +424,10 @@ switch ($scenario) {
throw "Next version installer path is not defined. Use '-nextSetupExePath <setup-exe-path>' to define it."
}
if (!$previousSetupExePath) {
# After v5.3.2 is released we should replace
# `Get-Podman-Setup-From-GitHub -version "tags/v5.3.0"`
# with
# `Get-Latest-Podman-Setup-From-GitHub`
$previousSetupExePath = Get-Podman-Setup-From-GitHub -version "tags/v5.3.0"
$previousSetupExePath = Get-Latest-Podman-Setup-From-GitHub
}
if (!$v531SetupExePath) {
$v531SetupExePath = Get-Podman-Setup-From-GitHub -version "tags/v5.3.1"
}
Start-Scenario-Installation-Green-Field
Start-Scenario-Installation-Skip-Config-Creation-Flag
@ -415,5 +438,6 @@ switch ($scenario) {
Start-Scenario-Update-With-User-Changed-Config-File-To-Next
Start-Scenario-Update-With-User-Removed-Config-File
Start-Scenario-Update-With-User-Removed-Config-File-To-Next
Start-Scenario-Update-Without-User-Changes-From-v531
}
}