fix(burn-in): use hashtable splat for conditional -SkipArtifact in Start-BurnInTest
In PS 5.1, $(if (...) { '-SkipArtifact' }) inside a call produces the
literal string '-SkipArtifact' bound as a positional argument (-> IPList),
not interpreted as a switch name.
Fixed by building a hashtable and setting SkipArtifact = \True when needed.
This commit is contained in:
@@ -58,21 +58,24 @@ $ErrorActionPreference = 'Stop'
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
|
||||
& "$scriptDir\Test-CapacityBurnIn.ps1" `
|
||||
-RepoUrl 'http://10.10.20.11:3100/ci/burnin-dummy.git' `
|
||||
-Branch 'main' `
|
||||
-TemplatePath 'F:\CI\Templates\WinBuild2025\WinBuild2025.vmx' `
|
||||
-SnapshotName 'BaseClean' `
|
||||
-CloneBaseDir 'F:\CI\BuildVMs' `
|
||||
-ArtifactBaseDir 'F:\CI\Artifacts' `
|
||||
-GuestCredentialTarget 'BuildVMGuest' `
|
||||
-GiteaCredentialTarget 'GiteaPAT' `
|
||||
-VmrunPath 'C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe' `
|
||||
-GuestOS 'Auto' `
|
||||
-BuildCommand $BuildCommand `
|
||||
-Parallelism $Parallelism `
|
||||
-Rounds $Rounds `
|
||||
-RoundTimeoutMinutes $RoundTimeoutMinutes `
|
||||
$(if (-not $NoSkipArtifact) { '-SkipArtifact' })
|
||||
$burnInParams = @{
|
||||
RepoUrl = 'http://10.10.20.11:3100/ci/burnin-dummy.git'
|
||||
Branch = 'main'
|
||||
TemplatePath = 'F:\CI\Templates\WinBuild2025\WinBuild2025.vmx'
|
||||
SnapshotName = 'BaseClean'
|
||||
CloneBaseDir = 'F:\CI\BuildVMs'
|
||||
ArtifactBaseDir = 'F:\CI\Artifacts'
|
||||
GuestCredentialTarget = 'BuildVMGuest'
|
||||
GiteaCredentialTarget = 'GiteaPAT'
|
||||
VmrunPath = 'C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe'
|
||||
GuestOS = 'Auto'
|
||||
BuildCommand = $BuildCommand
|
||||
Parallelism = $Parallelism
|
||||
Rounds = $Rounds
|
||||
RoundTimeoutMinutes = $RoundTimeoutMinutes
|
||||
}
|
||||
if (-not $NoSkipArtifact) { $burnInParams['SkipArtifact'] = $true }
|
||||
|
||||
& "$scriptDir\Test-CapacityBurnIn.ps1" @burnInParams
|
||||
|
||||
exit $LASTEXITCODE
|
||||
|
||||
Reference in New Issue
Block a user