fix(ci): ISO-assert discards stale WIM mount + asserts app catalog baked
All checks were successful
Build SilverMetal Enhanced - Windows ISO / build (pull_request) Successful in 5m55s

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 <noreply@anthropic.com>
This commit is contained in:
sysadmin
2026-06-10 01:02:31 +01:00
parent 129b8741fd
commit 4268a337f3

View File

@@ -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