From d582c39dc82397a7395dd436e8872edd66a6852e Mon Sep 17 00:00:00 2001 From: Mario Loriedo Date: Thu, 12 Dec 2024 15:27:04 +0100 Subject: [PATCH 1/5] Bump WiX toolset version to 5.0.2 Signed-off-by: Mario Loriedo --- build_windows.md | 2 +- contrib/win-installer/podman-setup.wixproj | 6 +++--- contrib/win-installer/podman.wixproj | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build_windows.md b/build_windows.md index b7b180a9e4..9785dcbe63 100644 --- a/build_windows.md +++ b/build_windows.md @@ -315,7 +315,7 @@ The Podman Windows installer (e.g., `podman-5.1.0-dev-setup.exe`) is a bundle that includes an msi package (`podman.msi`) and installs the WSL kernel (`podman-wslkerninst.exe`). It's built using the [WiX Toolset](https://wixtoolset.org/) and the -[PanelSwWixExtension](https://github.com/nirbar/PanelSwWixExtension/tree/wix3-v3.11.1.353) +[PanelSwWixExtension](https://github.com/nirbar/PanelSwWixExtension/tree/master5) WiX extension. The source code is in the folder `contrib\win-installer`. ### Build the Windows installer diff --git a/contrib/win-installer/podman-setup.wixproj b/contrib/win-installer/podman-setup.wixproj index 361873a26c..e3c7797bf1 100644 --- a/contrib/win-installer/podman-setup.wixproj +++ b/contrib/win-installer/podman-setup.wixproj @@ -1,12 +1,12 @@ - + x64 false Bundle - - + + diff --git a/contrib/win-installer/podman.wixproj b/contrib/win-installer/podman.wixproj index 7bccb56ffb..3f03dd02cd 100644 --- a/contrib/win-installer/podman.wixproj +++ b/contrib/win-installer/podman.wixproj @@ -1,4 +1,4 @@ - + x64 false @@ -13,9 +13,9 @@ - - - - + + + + From af607d0de41bed86056bbf9250d2b27a8bfaaeb8 Mon Sep 17 00:00:00 2001 From: Mario Loriedo Date: Wed, 11 Dec 2024 13:23:21 +0100 Subject: [PATCH 2/5] Add win installer patch Adding a patch to the bundle so that the update from previous version (v5.3.1) is a minor update, not a major one. A minor update prevents the full uninstallation of v5.3.1 and an unrequested reboot of the machine. Signed-off-by: Mario Loriedo --- contrib/cirrus/win-installer-main.ps1 | 22 +- contrib/win-installer/README.md | 61 ++++++ contrib/win-installer/build.ps1 | 20 ++ contrib/win-installer/burn.wxs | 1 + contrib/win-installer/podman-patch.wxs | 21 ++ contrib/win-installer/podman.wxs | 4 +- contrib/win-installer/test-installer.ps1 | 245 ++++++++++++++++------- contrib/win-installer/utils.ps1 | 23 +++ 8 files changed, 321 insertions(+), 76 deletions(-) create mode 100644 contrib/win-installer/podman-patch.wxs create mode 100644 contrib/win-installer/utils.ps1 diff --git a/contrib/cirrus/win-installer-main.ps1 b/contrib/cirrus/win-installer-main.ps1 index 57ec2a9888..26d4cf1d58 100644 --- a/contrib/cirrus/win-installer-main.ps1 +++ b/contrib/cirrus/win-installer-main.ps1 @@ -7,17 +7,32 @@ if ($Env:CI -eq "true") { $RELEASE_DIR = "$ENV:CIRRUS_WORKING_DIR\repo" } else { $WIN_INST_FOLDER = "$PSScriptRoot\..\win-installer" - $ENV:WIN_INST_VER = "9.9.9" + $ENV:WIN_INST_VER = "9.9.8" $RELEASE_DIR = "$PSScriptRoot\..\..\contrib\win-installer\current" if ($null -eq $ENV:CONTAINERS_MACHINE_PROVIDER) { $ENV:CONTAINERS_MACHINE_PROVIDER = 'wsl' } } Push-Location $WIN_INST_FOLDER -# Build Installer +# Build and test the windows installer + +# Downlaod v5.3.1 installer as `build.ps1` uses it to build the patch +# (podman.msp). `build.ps1` reads `$env:V531_SETUP_EXE_PATH` to get its path. +# The v5.3.1 installer is also used to test the "v5.3.1 -> current" version minor +# update (with patch). +$env:V531_SETUP_EXE_PATH = Get-Podman-Setup-From-GitHub -version "tags/v5.3.1" + +# Downlaod the previous installer to test a major update (without patch) +# After v5.3.2 release we should download latest instead of v5.3.0 (i.e. +# `Get-Latest-Podman-Setup-From-GitHub`) +$env:PREV_SETUP_EXE_PATH = Get-Podman-Setup-From-GitHub -version "tags/v5.3.0" + # Note: consumes podman-remote-release-windows_amd64.zip from repo.tar.zst Run-Command ".\build.ps1 $Env:WIN_INST_VER dev `"$RELEASE_DIR`"" +# Build a v9.9.9 installer to test an update from current to next version +Run-Command ".\build.ps1 9.9.9 dev `"$RELEASE_DIR`"" + Pop-Location # Run the installer silently and WSL/HyperV install options disabled (prevent reboots) @@ -25,4 +40,7 @@ $command = "$WIN_INST_FOLDER\test-installer.ps1 " $command += "-scenario all " $command += "-provider $ENV:CONTAINERS_MACHINE_PROVIDER " $command += "-setupExePath `"$WIN_INST_FOLDER\podman-$ENV:WIN_INST_VER-dev-setup.exe`"" +$command += "-previousSetupExePath `"$env:PREV_SETUP_EXE_PATH`"" +$command += "-nextSetupExePath `"$WIN_INST_FOLDER\podman-9.9.9-dev-setup.exe`"" +$command += "-v531SetupExePath `"$env:V531_SETUP_EXE_PATH`"" Run-Command "${command}" diff --git a/contrib/win-installer/README.md b/contrib/win-installer/README.md index 2afa2c52ea..8fb85175f9 100644 --- a/contrib/win-installer/README.md +++ b/contrib/win-installer/README.md @@ -1,3 +1,64 @@ # Windows Installer Build Instructions [have moved here](Build and test the Podman Windows installer](#build-and-test-the-podman-windows-installer)). + +## How to run a full tests scenarios + +Manual tests to validate changes the wxs files or a WiX upgrade. + +## Preparation + +- checkout previous release tag (e.g. 5.3.0) +`git fetch --all --tags --prune && git tag --list v5.* && git checkout tags/v5.3.0` +- make the installer +`./winmake podman && ./winmake docs && ./winmake win-gvproxy && ./winmake installer` +- checkout tag `v5.3.1` make the installer +`./winmake podman && ./winmake docs && ./winmake win-gvproxy && ./winmake installer` +- get the `v5.3.1` msi product id (with superorca) +- checkout the main branch and change the product id on `podman.wxs` to match `v5.3.1` product id +- set `$env:V531_SETUP_EXE_PATH` and make current and next installer +`$env:V531_SETUP_EXE_PATH= && ./winmake podman && ./winmake docs && ./winmake win-gvproxy && ./winmake installer && ./winmake installer 9.9.9` +- patch installertest to make sure it doesn't download the setup.exe from internet but uses the one just built + +## Run the tests + +1. Uninstall the virtualization providers (WSL and Hyper-V) using the "Windows Features" app +2. Run installtest for both `wsl` and `hyperv` (**as an admin**) +```pwsh +.\contrib\win-installer\test-installer.ps1 ` + -scenario all ` + -setupExePath ".\contrib\win-installer\podman-5.4.0-dev-setup.exe" ` + -previousSetupExePath ".\contrib\win-installer\podman-5.3.0-dev-setup.exe" ` + -nextSetupExePath ".\contrib\win-installer\podman-9.9.9-dev-setup.exe" ` + -v531SetupExePath ".\contrib\win-installer\podman-5.3.1-dev-setup.exe" ` + -provider hyperv +``` +3. Manually test the upgrade "from v5.3.1 to current to next" +```pwsh +contrib\win-installer\podman-5.3.1-dev-setup.exe /install /log contrib\win-installer\podman-setup-531.log +contrib\win-installer\podman-5.4.0-dev-setup.exe /install /log contrib\win-installer\podman-setup-540.log +contrib\win-installer\podman-9.9.9-dev-setup.exe /install /log contrib\win-installer\podman-setup-999.log +contrib\win-installer\podman-9.9.9-dev-setup.exe /x /log contrib\win-installer\podman-uninstall-999.log +``` +4. manually run the current installer with the option to install wsl and confirm it reboots and install both podman and wsl +5. manually run the current installer with the option to install hyperv and confirm it reboots and install both podman and wsl +6. run installtest for both wsl and hyperv +7. manually run the current installer with the option to install wsl and confirm it doesn't reboot +8. manually run the current installer with the option to install hyperv and confirm it doesn't reboot + +## retrieve installed podman msi package information + +```pwsh +$Installer = New-Object -ComObject WindowsInstaller.Installer; +$InstallerProducts = $Installer.ProductsEx("", "", 7); +$InstalledProducts = ForEach($Product in $InstallerProducts){ + [PSCustomObject]@{ProductCode = $Product.ProductCode(); + LocalPackage = $Product.InstallProperty("LocalPackage"); + VersionString = $Product.InstallProperty("VersionString"); + ProductName = $Product.InstallProperty("ProductName") + } +}; +$InstalledProducts | Where-Object {$_.ProductName -match "podman"} +``` + +and uninstall it with `msiexec /x "{}"` diff --git a/contrib/win-installer/build.ps1 b/contrib/win-installer/build.ps1 index a6bc61ec92..ae3dd8f61e 100644 --- a/contrib/win-installer/build.ps1 +++ b/contrib/win-installer/build.ps1 @@ -49,12 +49,28 @@ function CheckRequirements() { CheckCommand "go" "Golang" } +function Build-531-Patch() { + param( + [ValidateScript({Test-Path $_ -PathType Leaf})] + [string]$v531SetupExePath=$ENV:V531_SETUP_EXE_PATH + ) + + if (!$v531SetupExePath) { + . $PSScriptRoot\utils.ps1 + $v531SetupExePath=Get-Podman-Setup-From-GitHub "tags/v5.3.1" + } + wix burn extract $v531SetupExePath -o $PSScriptRoot\prevPodmanMsi; ExitOnError + Move-Item $PSScriptRoot\prevPodmanMsi\a1 $PSScriptRoot\en-US\prev-podman.wixpdb -Force; ExitOnError + Move-Item $PSScriptRoot\prevPodmanMsi\a0 $PSScriptRoot\en-US\prev-podman.msi -Force; ExitOnError + wix build -define "Version=$ENV:INSTVER" -bindpath $PSScriptRoot\en-US -out $PSScriptRoot\en-US\podman.msp podman-patch.wxs; ExitOnError +} if ($args.Count -lt 1 -or $args[0].Length -lt 1) { Write-Host "Usage: " $MyInvocation.MyCommand.Name " [dev|prod] [release_dir]" Write-Host Write-Host 'Uses Env Vars: ' Write-Host ' $ENV:FETCH_BASE_URL - GitHub Repo Address to locate release on' + Write-Host ' $ENV:V531_SETUP_EXE_PATH - Path to v5.3.1 setup.exe used to build the patch' Write-Host 'Env Settings for signing (optional)' Write-Host ' $ENV:VAULT_ID' Write-Host ' $ENV:APP_ID' @@ -129,6 +145,10 @@ if (Test-Path ./obj) { dotnet build podman.wixproj /property:DefineConstants="VERSION=$ENV:INSTVER" -o .; ExitOnError SignItem @("en-US\podman.msi") +# Build the Patch for 5.3.1 +Build-531-Patch +SignItem @("en-US\podman.msp") + dotnet build podman-setup.wixproj /property:DefineConstants="VERSION=$ENV:INSTVER" -o .; ExitOnError wix burn detach podman-setup.exe -engine engine.exe; ExitOnError SignItem @("engine.exe") diff --git a/contrib/win-installer/burn.wxs b/contrib/win-installer/burn.wxs index 9481b7a9e8..f0deda302e 100644 --- a/contrib/win-installer/burn.wxs +++ b/contrib/win-installer/burn.wxs @@ -30,6 +30,7 @@ + diff --git a/contrib/win-installer/podman-patch.wxs b/contrib/win-installer/podman-patch.wxs new file mode 100644 index 0000000000..4f6b6c9ca0 --- /dev/null +++ b/contrib/win-installer/podman-patch.wxs @@ -0,0 +1,21 @@ + + + + + + + + + + diff --git a/contrib/win-installer/podman.wxs b/contrib/win-installer/podman.wxs index 7157776821..b5da76a9fe 100644 --- a/contrib/win-installer/podman.wxs +++ b/contrib/win-installer/podman.wxs @@ -10,7 +10,7 @@ - + @@ -154,7 +154,7 @@ - + diff --git a/contrib/win-installer/test-installer.ps1 b/contrib/win-installer/test-installer.ps1 index 02990170cd..1696034988 100644 --- a/contrib/win-installer/test-installer.ps1 +++ b/contrib/win-installer/test-installer.ps1 @@ -4,21 +4,34 @@ # rm .\contrib\win-installer\*.log && # rm .\contrib\win-installer\*.exe && # rm .\contrib\win-installer\*.wixpdb && +# .\winmake.ps1 installer && # .\winmake.ps1 installer 9.9.9 && # .\contrib\win-installer\test-installer.ps1 ` # -scenario update-without-user-changes ` -# -setupExePath ".\contrib\win-installer\podman-9.9.9-dev-setup.exe" ` +# -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" ` +# -v531SetupExePath ".\contrib\win-installer\podman-5.3.1-dev-setup.exe" ` # -provider hyperv +# # The Param statement must be the first statement, except for comments and any #Require statements. param ( [Parameter(Mandatory)] - [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", "all")] + [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-from-531", "update-with-user-changed-config-file-from-531", "update-with-user-removed-config-file-from-531", + "update-without-user-changes-to-next", "update-with-user-changed-config-file-to-next", "update-with-user-removed-config-file-to-next", + "all")] [string]$scenario, [ValidateScript({Test-Path $_ -PathType Leaf})] [string]$setupExePath, [ValidateScript({Test-Path $_ -PathType Leaf})] [string]$previousSetupExePath, + [ValidateScript({Test-Path $_ -PathType Leaf})] + [string]$nextSetupExePath, + [ValidateScript({Test-Path $_ -PathType Leaf})] + [string]$v531SetupExePath, [ValidateSet("wsl", "hyperv")] [string]$provider="wsl", [switch]$installWSL=$false, @@ -27,6 +40,8 @@ param ( [switch]$skipConfigFileCreation=$false ) +. $PSScriptRoot\utils.ps1 + $MachineConfPath = "$env:ProgramData\containers\containers.conf.d\99-podman-machine-provider.conf" $PodmanFolderPath = "$env:ProgramFiles\RedHat\Podman" $PodmanExePath = "$PodmanFolderPath\podman.exe" @@ -86,22 +101,10 @@ function Install-Podman-With-Defaults { Write-Host "Installation completed successfully!`n" } -function Install-Previous-Podman { - Install-Podman -setupExePath $previousSetupExePath -} - -function Install-Previous-Podman-With-Defaults { - Install-Podman-With-Defaults -setupExePath $previousSetupExePath -} - function Install-Current-Podman { Install-Podman -setupExePath $setupExePath } -function Install-Current-Podman-With-Defaults { - Install-Podman-With-Defaults -setupExePath $setupExePath -} - function Test-Podman-Objects-Exist { Write-Host "Verifying that podman files, folders and registry entries exist..." $WindowsPathsToTest | ForEach-Object { @@ -156,10 +159,6 @@ function Uninstall-Current-Podman { Uninstall-Podman -setupExePath $setupExePath } -function Uninstall-Previous-Podman { - Uninstall-Podman -setupExePath $previousSetupExePath -} - function Test-Podman-Objects-Exist-Not { Write-Host "Verifying that podman files, folders and registry entries don't exist..." $WindowsPathsToTest | ForEach-Object { @@ -212,18 +211,39 @@ function Get-Latest-Podman-Setup-From-GitHub { return $destinationPath } +function Test-Installation { + param ( + [ValidateSet("wsl", "hyperv")] + [string]$expectedConf + ) + Test-Podman-Objects-Exist + Test-Podman-Machine-Conf-Exist + if ($expectedConf) { + Test-Podman-Machine-Conf-Content -expected $expectedConf + } else { + Test-Podman-Machine-Conf-Content + } +} + +function Test-Installation-No-Config { + Test-Podman-Objects-Exist + Test-Podman-Machine-Conf-Exist-Not +} + +function Test-Uninstallation { + Test-Podman-Objects-Exist-Not + Test-Podman-Machine-Conf-Exist-Not +} + # SCENARIOS function Start-Scenario-Installation-Green-Field { Write-Host "`n===========================================" Write-Host " Running scenario: Installation-Green-Field" Write-Host "===========================================" Install-Current-Podman - Test-Podman-Objects-Exist - Test-Podman-Machine-Conf-Exist - Test-Podman-Machine-Conf-Content + Test-Installation Uninstall-Current-Podman - Test-Podman-Objects-Exist-Not - Test-Podman-Machine-Conf-Exist-Not + Test-Uninstallation } function Start-Scenario-Installation-Skip-Config-Creation-Flag { @@ -232,11 +252,9 @@ function Start-Scenario-Installation-Skip-Config-Creation-Flag { Write-Host "=========================================================" $skipConfigFileCreation = $true Install-Current-Podman - Test-Podman-Objects-Exist - Test-Podman-Machine-Conf-Exist-Not + Test-Installation-No-Config Uninstall-Current-Podman - Test-Podman-Objects-Exist-Not - Test-Podman-Machine-Conf-Exist-Not + Test-Uninstallation } function Start-Scenario-Installation-With-Pre-Existing-Podman-Exe { @@ -245,63 +263,98 @@ function Start-Scenario-Installation-With-Pre-Existing-Podman-Exe { Write-Host "============================================================" New-Fake-Podman-Exe Install-Current-Podman - Test-Podman-Objects-Exist - Test-Podman-Machine-Conf-Exist-Not + Test-Installation-No-Config Uninstall-Current-Podman - Test-Podman-Objects-Exist-Not - Test-Podman-Machine-Conf-Exist-Not + Test-Uninstallation } function Start-Scenario-Update-Without-User-Changes { - Write-Host "`n==============================================" - Write-Host " Running scenario: Update-Without-User-Changes" - Write-Host "==============================================" - Install-Previous-Podman - Test-Podman-Objects-Exist - Test-Podman-Machine-Conf-Exist - Test-Podman-Machine-Conf-Content - Install-Current-Podman-With-Defaults - Test-Podman-Objects-Exist - Test-Podman-Machine-Conf-Exist - Test-Podman-Machine-Conf-Content - Uninstall-Current-Podman - Test-Podman-Objects-Exist-Not - Test-Podman-Machine-Conf-Exist-Not + param ( + [ValidateSet("From-Previous", "From-531", "To-Next")] + [string]$mode="From-Previous" + ) + Write-Host "`n======================================================" + Write-Host " Running scenario: Update-Without-User-Changes-$mode" + Write-Host "======================================================" + switch ($mode) { + 'From-Previous' {$i = $previousSetupExePath; $u = $setupExePath} + 'From-531' {$i = $v531SetupExePath; $u = $setupExePath} + 'To-Next' {$i = $setupExePath; $u = $nextSetupExePath} + } + Install-Podman -setupExePath $i + Test-Installation + Install-Podman-With-Defaults -setupExePath $u + Test-Installation + Uninstall-Podman -setupExePath $u + Test-Uninstallation +} + +function Start-Scenario-Update-Without-User-Changes-From-531 { + Start-Scenario-Update-Without-User-Changes -mode "From-531" +} + +function Start-Scenario-Update-Without-User-Changes-To-Next { + Start-Scenario-Update-Without-User-Changes -mode "To-Next" } function Start-Scenario-Update-With-User-Changed-Config-File { - Write-Host "`n=======================================================" - Write-Host " Running scenario: Update-With-User-Changed-Config-File" - Write-Host "=======================================================" - Install-Previous-Podman - Test-Podman-Objects-Exist - Test-Podman-Machine-Conf-Exist - Test-Podman-Machine-Conf-Content + param ( + [ValidateSet("From-Previous", "From-531", "To-Next")] + [string]$mode="From-Previous" + ) + Write-Host "`n==============================================================" + Write-Host " Running scenario: Update-With-User-Changed-Config-File-$mode" + Write-Host "==============================================================" + switch ($mode) { + 'From-Previous' {$i = $previousSetupExePath; $u = $setupExePath} + 'From-531' {$i = $v531SetupExePath; $u = $setupExePath} + 'To-Next' {$i = $setupExePath; $u = $nextSetupExePath} + } + Install-Podman -setupExePath $i + Test-Installation $newProvider = Switch-Podman-Machine-Conf-Content - Install-Current-Podman-With-Defaults - Test-Podman-Objects-Exist - Test-Podman-Machine-Conf-Exist - Test-Podman-Machine-Conf-Content -expected $newProvider - Uninstall-Current-Podman - Test-Podman-Objects-Exist-Not - Test-Podman-Machine-Conf-Exist-Not + Install-Podman-With-Defaults -setupExePath $u + Test-Installation -expectedConf $newProvider + Uninstall-Podman -setupExePath $u + Test-Uninstallation +} + +function Start-Scenario-Update-With-User-Changed-Config-File-From-531 { + Start-Scenario-Update-With-User-Changed-Config-File -mode "From-531" +} + +function Start-Scenario-Update-With-User-Changed-Config-File-To-Next { + Start-Scenario-Update-With-User-Changed-Config-File -mode "To-Next" } function Start-Scenario-Update-With-User-Removed-Config-File { - Write-Host "`n=======================================================" - Write-Host " Running scenario: Update-With-User-Removed-Config-File" - Write-Host "=======================================================" - Install-Previous-Podman - Test-Podman-Objects-Exist - Test-Podman-Machine-Conf-Exist - Test-Podman-Machine-Conf-Content + param ( + [ValidateSet("From-Previous", "From-531", "To-Next")] + [string]$mode="From-Previous" + ) + Write-Host "`n==============================================================" + Write-Host " Running scenario: Update-With-User-Removed-Config-File-$mode" + Write-Host "==============================================================" + switch ($mode) { + 'From-Previous' {$i = $previousSetupExePath; $u = $setupExePath} + 'From-531' {$i = $v531SetupExePath; $u = $setupExePath} + 'To-Next' {$i = $setupExePath; $u = $nextSetupExePath} + } + Install-Podman -setupExePath $i + Test-Installation Remove-Podman-Machine-Conf - Install-Current-Podman-With-Defaults - Test-Podman-Objects-Exist - Test-Podman-Machine-Conf-Exist-Not - Uninstall-Current-Podman - Test-Podman-Objects-Exist-Not - Test-Podman-Machine-Conf-Exist-Not + Install-Podman-With-Defaults -setupExePath $u + Test-Installation-No-Config + Uninstall-Podman -setupExePath $u + Test-Uninstallation +} + +function Start-Scenario-Update-With-User-Removed-Config-File-From-531 { + Start-Scenario-Update-With-User-Removed-Config-File -mode "From-531" +} + +function Start-Scenario-Update-With-User-Removed-Config-File-To-Next { + Start-Scenario-Update-With-User-Removed-Config-File -mode "To-Next" } switch ($scenario) { @@ -326,27 +379,75 @@ switch ($scenario) { } Start-Scenario-Update-Without-User-Changes } + '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-531 + } + 'update-without-user-changes-to-next' { + if (!$nextSetupExePath) { + throw "Next version installer path is not defined. Use '-nextSetupExePath ' to define it." + } + Start-Scenario-Update-Without-User-Changes-To-Next + } 'update-with-user-changed-config-file' { if (!$previousSetupExePath) { $previousSetupExePath = Get-Latest-Podman-Setup-From-GitHub } Start-Scenario-Update-With-User-Changed-Config-File } + 'update-with-user-changed-config-file-from-531' { + if (!$v531SetupExePath) { + $v531SetupExePath = Get-Podman-Setup-From-GitHub -version "tags/v5.3.1" + } + Start-Scenario-Update-With-User-Changed-Config-File-From-531 + } + 'update-with-user-changed-config-file-to-next' { + if (!$nextSetupExePath) { + throw "Next version installer path is not defined. Use '-nextSetupExePath ' to define it." + } + Start-Scenario-Update-With-User-Changed-Config-File-To-Next + } 'update-with-user-removed-config-file' { if (!$previousSetupExePath) { $previousSetupExePath = Get-Latest-Podman-Setup-From-GitHub } Start-Scenario-Update-With-User-Removed-Config-File } + 'update-with-user-removed-config-file-from-531' { + if (!$v531SetupExePath) { + $v531SetupExePath = Get-Podman-Setup-From-GitHub -version "tags/v5.3.1" + } + Start-Scenario-Update-With-User-Removed-Config-File-From-531 + } + 'update-with-user-removed-config-file-to-next' { + if (!$nextSetupExePath) { + throw "Next version installer path is not defined. Use '-nextSetupExePath ' to define it." + } + Start-Scenario-Update-With-User-Removed-Config-File-To-Next + } 'all' { + if (!$nextSetupExePath) { + throw "Next version installer path is not defined. Use '-nextSetupExePath ' to define it." + } if (!$previousSetupExePath) { $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 Start-Scenario-Installation-With-Pre-Existing-Podman-Exe Start-Scenario-Update-Without-User-Changes + Start-Scenario-Update-Without-User-Changes-From-531 + Start-Scenario-Update-Without-User-Changes-To-Next Start-Scenario-Update-With-User-Changed-Config-File + Start-Scenario-Update-With-User-Changed-Config-File-From-531 + 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-From-531 + Start-Scenario-Update-With-User-Removed-Config-File-To-Next } } diff --git a/contrib/win-installer/utils.ps1 b/contrib/win-installer/utils.ps1 new file mode 100644 index 0000000000..7d08b220d7 --- /dev/null +++ b/contrib/win-installer/utils.ps1 @@ -0,0 +1,23 @@ +#!/usr/bin/env pwsh +function Get-Latest-Podman-Setup-From-GitHub { + return Get-Podman-Setup-From-GitHub "latest" +} + +function Get-Podman-Setup-From-GitHub { + param( + [Parameter(Mandatory)] + [string] $version + ) + + Write-Host "Downloading the $version Podman windows setup from GitHub..." + $apiUrl = "https://api.github.com/repos/containers/podman/releases/$version" + $response = Invoke-RestMethod -Uri $apiUrl -Headers @{"User-Agent"="PowerShell"} -ErrorAction Stop + $downloadUrl = $response.assets[0].browser_download_url + Write-Host "Downloading URL: $downloadUrl" + $latestTag = $response.tag_name + $destinationPath = "$PSScriptRoot\podman-$latestTag-setup.exe" + Write-Host "Destination Path: $destinationPath" + Invoke-WebRequest -Uri $downloadUrl -OutFile $destinationPath + Write-Host "Command completed successfully!`n" + return $destinationPath +} From 2bca5052f137b932c1f6492f55f6f208d9796127 Mon Sep 17 00:00:00 2001 From: Mario Loriedo Date: Wed, 4 Dec 2024 11:16:16 +0100 Subject: [PATCH 3/5] Avoid rebooting on Windows when upgrading and WSL isn't installed When building an installer from main branch, and using it to upgrade the latest Podman release on Windows, a reboot is triggered if WSL is not installed. This is a regression caused by an update of the condition to execute `ForceReboot`. This commit fixes the condition and updates some defaults to make it even more unlikely that reboot happens withtout a specific user request for it. It doesn't fix the v5.3.1 to v5.3.2 upgrade though. v5.3.1 has been released already and this commit doesn't avoid that it triggers a reboot when updated. Signed-off-by: Mario Loriedo --- contrib/win-installer/podman.wxs | 8 ++++---- contrib/win-installer/test-installer.ps1 | 11 ++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/contrib/win-installer/podman.wxs b/contrib/win-installer/podman.wxs index b5da76a9fe..e78afa00e8 100644 --- a/contrib/win-installer/podman.wxs +++ b/contrib/win-installer/podman.wxs @@ -72,14 +72,14 @@ - + - + @@ -110,13 +110,13 @@ - + - + diff --git a/contrib/win-installer/test-installer.ps1 b/contrib/win-installer/test-installer.ps1 index 1696034988..f8c466eaa6 100644 --- a/contrib/win-installer/test-installer.ps1 +++ b/contrib/win-installer/test-installer.ps1 @@ -1,6 +1,11 @@ #!/usr/bin/env pwsh -# Example usage: +# 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): +# # rm .\contrib\win-installer\*.log && # rm .\contrib\win-installer\*.exe && # rm .\contrib\win-installer\*.wixpdb && @@ -92,10 +97,10 @@ function Install-Podman-With-Defaults { $ret = Start-Process -Wait ` -PassThru "$setupExePath" ` -ArgumentList "/install /quiet ` - /log $PSScriptRoot\podman-setup.log" + /log $PSScriptRoot\podman-setup-default.log" if ($ret.ExitCode -ne 0) { Write-Host "Install failed, dumping log" - Get-Content $PSScriptRoot\podman-setup.log + Get-Content $PSScriptRoot\podman-setup-default.log throw "Exit code is $($ret.ExitCode)" } Write-Host "Installation completed successfully!`n" From e3d2463a48ba24101c474b5e1c2204daf338db05 Mon Sep 17 00:00:00 2001 From: Mario Loriedo Date: Thu, 12 Dec 2024 15:49:24 +0100 Subject: [PATCH 4/5] Avoid rebooting twice when installing WSL For some reason, after upgrading to WiX v5, the forceReboot action appeared before the Dism actions in the msi InstallExecuteSequence table. As a consequence the user was asked to reboot before WSL or Hyper-V installation and to reboot a second time after their installation. To avoid that the ForceReboot action field `Before=StopServices` is replaced with `After=DismX86` Signed-off-by: Mario Loriedo --- contrib/win-installer/podman.wxs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/win-installer/podman.wxs b/contrib/win-installer/podman.wxs index e78afa00e8..10ca61c5bc 100644 --- a/contrib/win-installer/podman.wxs +++ b/contrib/win-installer/podman.wxs @@ -116,7 +116,7 @@ - + From 5f79cd3aef5d9af9c5d5c95ce7be9ba6a7f57f0b Mon Sep 17 00:00:00 2001 From: Mario Loriedo Date: Thu, 5 Dec 2024 15:21:43 +0100 Subject: [PATCH 5/5] Revert "win-installer test: revert to v5.3.0" This reverts commit 916b805f9776d721aaba9972685d786d0e48624a. Signed-off-by: Mario Loriedo --- contrib/cirrus/win-installer-main.ps1 | 22 ++++++++++++++-------- contrib/win-installer/test-installer.ps1 | 12 ------------ 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/contrib/cirrus/win-installer-main.ps1 b/contrib/cirrus/win-installer-main.ps1 index 26d4cf1d58..a967c0dfe7 100644 --- a/contrib/cirrus/win-installer-main.ps1 +++ b/contrib/cirrus/win-installer-main.ps1 @@ -1,13 +1,14 @@ #!/usr/bin/env powershell . $PSScriptRoot\win-lib.ps1 +. $PSScriptRoot\..\win-installer\utils.ps1 if ($Env:CI -eq "true") { $WIN_INST_FOLDER = "$ENV:CIRRUS_WORKING_DIR\repo\contrib\win-installer" $RELEASE_DIR = "$ENV:CIRRUS_WORKING_DIR\repo" } else { $WIN_INST_FOLDER = "$PSScriptRoot\..\win-installer" - $ENV:WIN_INST_VER = "9.9.8" + $ENV:WIN_INST_VER = "9.9.9" $RELEASE_DIR = "$PSScriptRoot\..\..\contrib\win-installer\current" if ($null -eq $ENV:CONTAINERS_MACHINE_PROVIDER) { $ENV:CONTAINERS_MACHINE_PROVIDER = 'wsl' } } @@ -16,22 +17,27 @@ Push-Location $WIN_INST_FOLDER # Build and test the windows installer -# Downlaod v5.3.1 installer as `build.ps1` uses it to build the patch +# Download v5.3.1 installer as `build.ps1` uses it to build the patch # (podman.msp). `build.ps1` reads `$env:V531_SETUP_EXE_PATH` to get its path. # The v5.3.1 installer is also used to test the "v5.3.1 -> current" version minor # update (with patch). -$env:V531_SETUP_EXE_PATH = Get-Podman-Setup-From-GitHub -version "tags/v5.3.1" +if (!$env:V531_SETUP_EXE_PATH) { + $env:V531_SETUP_EXE_PATH = Get-Podman-Setup-From-GitHub -version "tags/v5.3.1" +} -# Downlaod the previous installer to test a major update (without patch) +# Download the previous installer to test a major update (without patch) # After v5.3.2 release we should download latest instead of v5.3.0 (i.e. # `Get-Latest-Podman-Setup-From-GitHub`) -$env:PREV_SETUP_EXE_PATH = Get-Podman-Setup-From-GitHub -version "tags/v5.3.0" +if (!$env:PREV_SETUP_EXE_PATH) { + $env:PREV_SETUP_EXE_PATH = Get-Podman-Setup-From-GitHub -version "tags/v5.3.0" +} # Note: consumes podman-remote-release-windows_amd64.zip from repo.tar.zst Run-Command ".\build.ps1 $Env:WIN_INST_VER dev `"$RELEASE_DIR`"" -# Build a v9.9.9 installer to test an update from current to next version -Run-Command ".\build.ps1 9.9.9 dev `"$RELEASE_DIR`"" +# Build a v9.9.10 installer to test an update from current to next version +$NEXT_WIN_INST_VER="9.9.10" +Run-Command ".\build.ps1 `"$NEXT_WIN_INST_VER`" dev `"$RELEASE_DIR`"" Pop-Location @@ -41,6 +47,6 @@ $command += "-scenario all " $command += "-provider $ENV:CONTAINERS_MACHINE_PROVIDER " $command += "-setupExePath `"$WIN_INST_FOLDER\podman-$ENV:WIN_INST_VER-dev-setup.exe`"" $command += "-previousSetupExePath `"$env:PREV_SETUP_EXE_PATH`"" -$command += "-nextSetupExePath `"$WIN_INST_FOLDER\podman-9.9.9-dev-setup.exe`"" +$command += "-nextSetupExePath `"$WIN_INST_FOLDER\podman-$NEXT_WIN_INST_VER-dev-setup.exe`"" $command += "-v531SetupExePath `"$env:V531_SETUP_EXE_PATH`"" Run-Command "${command}" diff --git a/contrib/win-installer/test-installer.ps1 b/contrib/win-installer/test-installer.ps1 index f8c466eaa6..a8adace025 100644 --- a/contrib/win-installer/test-installer.ps1 +++ b/contrib/win-installer/test-installer.ps1 @@ -204,18 +204,6 @@ function Remove-Podman-Machine-Conf { Write-Host "Deletion successful!`n" } -function Get-Latest-Podman-Setup-From-GitHub { - $tag = "5.3.0" - Write-Host "Downloading the $tag Podman windows setup from GitHub..." - $downloadUrl = "https://github.com/containers/podman/releases/download/v$tag/podman-$tag-setup.exe" - Write-Host "Downloading URL: $downloadUrl" - $destinationPath = "$PSScriptRoot\podman-$tag-setup.exe" - Write-Host "Destination Path: $destinationPath" - Invoke-WebRequest -Uri $downloadUrl -OutFile $destinationPath - Write-Host "Command completed successfully!`n" - return $destinationPath -} - function Test-Installation { param ( [ValidateSet("wsl", "hyperv")]