From ee34b8e37399b52a574cf53b86c462c90afc6156 Mon Sep 17 00:00:00 2001 From: sysadmin Date: Mon, 8 Jun 2026 20:54:33 +0100 Subject: [PATCH] ci: probe credential-less net use as SYSTEM (stored cmdkey) --- .gitea/workflows/runner-probe.yaml | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/runner-probe.yaml b/.gitea/workflows/runner-probe.yaml index dd96f65..c1f2585 100644 --- a/.gitea/workflows/runner-probe.yaml +++ b/.gitea/workflows/runner-probe.yaml @@ -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