From 4268a337f35e87abe554dddd945d946aaef59a6c Mon Sep 17 00:00:00 2001 From: sysadmin Date: Wed, 10 Jun 2026 01:02:31 +0100 Subject: [PATCH] fix(ci): ISO-assert discards stale WIM mount + asserts app catalog baked Assert-IsoStructure.ps1 reused a fixed mount dir; a prior aborted run left a WIM mounted there, so Mount-WindowsImage failed with 'directory is not empty' and the persist-to-stable-path step was skipped (no ISO deployed). Now discards stale mounts + clears corrupt mount points + uses a unique per-run mount dir (mirrors build.ps1 Stage 0), and removes the dir after. Also asserts apps/catalog.json baked into the WIM. Co-Authored-By: Claude Opus 4.8 --- windows/tests/Assert-IsoStructure.ps1 | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/windows/tests/Assert-IsoStructure.ps1 b/windows/tests/Assert-IsoStructure.ps1 index 37d9329..b7b749b 100644 --- a/windows/tests/Assert-IsoStructure.ps1 +++ b/windows/tests/Assert-IsoStructure.ps1 @@ -17,8 +17,16 @@ function Assert { param([string]$Name,[bool]$Cond) if (-not (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole( [Security.Principal.WindowsBuiltInRole]::Administrator))) { throw 'must run elevated (WIM mount).' } +# Discard any stale WIM mounts from a prior aborted run (CI reuses the runner) and +# use a fresh, unique mount dir — a leftover mount makes Mount-WindowsImage fail with +# "attempted to mount to a directory that is not empty." Mirrors build.ps1 Stage 0. +Get-WindowsImage -Mounted -EA SilentlyContinue | ForEach-Object { + Dismount-WindowsImage -Path $_.MountPath -Discard -EA SilentlyContinue | Out-Null +} +Clear-WindowsCorruptMountPoint -EA SilentlyContinue | Out-Null + $img = Mount-DiskImage -ImagePath $IsoPath -PassThru -$mount = Join-Path $env:TEMP 'sm-assert-wim' +$mount = Join-Path $env:TEMP ('sm-assert-wim-' + [guid]::NewGuid().ToString('N')) $null = New-Item -ItemType Directory -Force $mount try { $drive = ($img | Get-Volume).DriveLetter + ':' @@ -43,10 +51,15 @@ try { Assert 'Welcome exe baked into WIM' (Test-Path $welcomeExe) $welcomeFlavours = Get-ChildItem (Join-Path $mount 'Program Files\SilverOS\Welcome\flavours') -Filter '*.json' -EA SilentlyContinue Assert 'Welcome flavours baked (>=1 .json)' ($welcomeFlavours.Count -ge 1) + $welcomeCatalog = Join-Path $mount 'Program Files\SilverOS\Welcome\apps\catalog.json' + Assert 'Welcome app catalog baked' (Test-Path $welcomeCatalog) } } finally { Dismount-WindowsImage -Path $mount -Discard | Out-Null } } -} finally { Dismount-DiskImage -ImagePath $IsoPath | Out-Null } +} finally { + Dismount-DiskImage -ImagePath $IsoPath | Out-Null + Remove-Item $mount -Recurse -Force -EA SilentlyContinue +} Write-Host "`n$($fail) assertion(s) failed." exit $fail