ci: probe credential-less net use as SYSTEM (stored cmdkey)
Some checks failed
Build SilverMetal Enhanced - Windows ISO / build (pull_request) Failing after 4s

This commit is contained in:
sysadmin
2026-06-08 20:54:33 +01:00
parent 78d4d84f88
commit ee34b8e373

View File

@@ -13,23 +13,15 @@ jobs:
runs-on: windows-latest
timeout-minutes: 5
steps:
- name: Probe
- name: Probe SMB as SYSTEM (credential-less net use via stored cmdkey)
shell: pwsh
env:
ISO_SRC: ${{ vars.SILVERMETAL_BASE_ISO_URL }}
run: |
Write-Host "host=$env:COMPUTERNAME user=$(whoami)"
Write-Host "--- IPv4 (is the runner itself 10.0.0.60?) ---"
(Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.IPAddress -ne '127.0.0.1' }).IPAddress
Write-Host "--- local filesystem drives ---"
Get-PSDrive -PSProvider FileSystem | Format-Table Name, @{n='UsedGB';e={[math]::Round($_.Used/1GB,1)}}, @{n='FreeGB';e={[math]::Round($_.Free/1GB,1)}}, Root -AutoSize
Write-Host "--- existing net use mappings ---"; cmd /c "net use"
Write-Host "--- stored credentials (cmdkey) ---"; cmd /c "cmdkey /list"
Write-Host "--- UNC reachability as SYSTEM ---"
Write-Host ("UNC exists = {0}" -f [bool](Test-Path -LiteralPath $env:ISO_SRC))
Write-Host "--- top-level dirs on each drive matching ISO/private/SILVERLABS ---"
Get-PSDrive -PSProvider FileSystem | ForEach-Object {
Get-ChildItem $_.Root -Directory -EA SilentlyContinue |
Where-Object Name -match 'ISO|private|SILVERLABS|template' |
Select-Object -ExpandProperty FullName
}
Write-Host "user=$(whoami)"
$root = [regex]::Match($env:ISO_SRC, '^\\\\[^\\]+\\[^\\]+').Value
Write-Host "--- credential-less net use $root (should consume stored SYSTEM cmdkey) ---"
$r = cmd /c "net use `"$root`"" 2>&1 | Out-String
Write-Host $r
Write-Host ("UNC exists after net use = {0}" -f [bool](Test-Path -LiteralPath $env:ISO_SRC))
cmd /c "net use `"$root`" /delete /y" 2>&1 | Out-Null