fix(test): Fix §3.3 e2e — pipeline pollution + SSH URL not usable in guest

Two bugs:
1. Run-Test used '& $orchestrator @params' without Out-Host — orchestrator output
   collected in function pipeline, mixed with returned hashtable → caller received
   array instead of hashtable → .Success property lookup threw under StrictMode.
   Fix: pipe to Out-Host.

2. RepoUrl was ssh://gitea-ci/... (SSH config alias) — alias exists only on
   host SSH config, not in guest VM. Guest-side clone (§3.3) needs HTTP URL
   directly reachable from inside the VM.
   Fix: separate -HostRepoUrl / -GuestRepoUrl params, inject per mode.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Simone
2026-05-10 21:59:51 +02:00
parent e2f1f8b1ea
commit c10c79d4f4
+15 -3
View File
@@ -26,6 +26,11 @@
Path to template VMX. Default: env:GITEA_CI_TEMPLATE_PATH or Path to template VMX. Default: env:GITEA_CI_TEMPLATE_PATH or
F:\CI\Templates\WinBuild2025\WinBuild2025.vmx F:\CI\Templates\WinBuild2025\WinBuild2025.vmx
.PARAMETER GuestRepoUrl
HTTP(S) URL for guest-side clone. Must be reachable from inside the VM.
Default: https://gitea.emulab.it/Simone/nsis-plugin-nsinnounp.git
NOTE: ssh://gitea-ci alias works only on the host (SSH config), not inside the VM.
.PARAMETER SkipBaseline .PARAMETER SkipBaseline
If set, skip baseline run and only run with -UseGitClone. If set, skip baseline run and only run with -UseGitClone.
@@ -51,6 +56,10 @@ param(
if ($env:GITEA_CI_TEMPLATE_PATH) { $env:GITEA_CI_TEMPLATE_PATH } if ($env:GITEA_CI_TEMPLATE_PATH) { $env:GITEA_CI_TEMPLATE_PATH }
else { 'F:\CI\Templates\WinBuild2025\WinBuild2025.vmx' } else { 'F:\CI\Templates\WinBuild2025\WinBuild2025.vmx' }
), ),
# URL for host-side clone (SSH alias works on host)
[string] $HostRepoUrl = 'ssh://gitea-ci/Simone/nsis-plugin-nsinnounp.git',
# URL for guest-side clone (must be HTTP reachable from inside VM — SSH alias not available in guest)
[string] $GuestRepoUrl = 'https://gitea.emulab.it/Simone/nsis-plugin-nsinnounp.git',
[switch] $SkipBaseline, [switch] $SkipBaseline,
[switch] $SkipGuestClone [switch] $SkipGuestClone
) )
@@ -61,7 +70,7 @@ $ErrorActionPreference = 'Stop'
$scriptDir = Split-Path $MyInvocation.MyCommand.Path -Parent $scriptDir = Split-Path $MyInvocation.MyCommand.Path -Parent
$orchestrator = Join-Path $scriptDir 'Invoke-CIJob.ps1' $orchestrator = Join-Path $scriptDir 'Invoke-CIJob.ps1'
# Common parameters for both runs # Common parameters (RepoUrl set per-mode below)
$commonParams = @{ $commonParams = @{
Branch = $Branch Branch = $Branch
TemplatePath = $TemplatePath TemplatePath = $TemplatePath
@@ -69,7 +78,6 @@ $commonParams = @{
BuildCommand = 'python build_plugin.py --final --dist-dir dist' BuildCommand = 'python build_plugin.py --final --dist-dir dist'
GuestArtifactSource = 'dist' GuestArtifactSource = 'dist'
GuestCredentialTarget = 'BuildVMGuest' GuestCredentialTarget = 'BuildVMGuest'
RepoUrl = 'ssh://gitea-ci/Simone/nsis-plugin-nsinnounp.git'
} }
function Format-Elapsed { function Format-Elapsed {
@@ -102,13 +110,17 @@ function Run-Test {
$params['JobId'] = $JobId $params['JobId'] = $JobId
if ($UseGitClone) { if ($UseGitClone) {
$params['UseGitClone'] = $true $params['UseGitClone'] = $true
$params['RepoUrl'] = $script:GuestRepoUrl # HTTP URL reachable from inside VM
} else {
$params['RepoUrl'] = $script:HostRepoUrl # SSH alias — works on host
} }
$startTime = Get-Date $startTime = Get-Date
$exitCode = 0 $exitCode = 0
try { try {
& $orchestrator @params # Pipe to Out-Host so orchestrator output doesn't pollute this function's pipeline
& $orchestrator @params | Out-Host
$exitCode = $LASTEXITCODE $exitCode = $LASTEXITCODE
} }
catch { catch {