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 = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
|
||||||
& "$scriptDir\Test-CapacityBurnIn.ps1" `
|
$burnInParams = @{
|
||||||
-RepoUrl 'http://10.10.20.11:3100/ci/burnin-dummy.git' `
|
RepoUrl = 'http://10.10.20.11:3100/ci/burnin-dummy.git'
|
||||||
-Branch 'main' `
|
Branch = 'main'
|
||||||
-TemplatePath 'F:\CI\Templates\WinBuild2025\WinBuild2025.vmx' `
|
TemplatePath = 'F:\CI\Templates\WinBuild2025\WinBuild2025.vmx'
|
||||||
-SnapshotName 'BaseClean' `
|
SnapshotName = 'BaseClean'
|
||||||
-CloneBaseDir 'F:\CI\BuildVMs' `
|
CloneBaseDir = 'F:\CI\BuildVMs'
|
||||||
-ArtifactBaseDir 'F:\CI\Artifacts' `
|
ArtifactBaseDir = 'F:\CI\Artifacts'
|
||||||
-GuestCredentialTarget 'BuildVMGuest' `
|
GuestCredentialTarget = 'BuildVMGuest'
|
||||||
-GiteaCredentialTarget 'GiteaPAT' `
|
GiteaCredentialTarget = 'GiteaPAT'
|
||||||
-VmrunPath 'C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe' `
|
VmrunPath = 'C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe'
|
||||||
-GuestOS 'Auto' `
|
GuestOS = 'Auto'
|
||||||
-BuildCommand $BuildCommand `
|
BuildCommand = $BuildCommand
|
||||||
-Parallelism $Parallelism `
|
Parallelism = $Parallelism
|
||||||
-Rounds $Rounds `
|
Rounds = $Rounds
|
||||||
-RoundTimeoutMinutes $RoundTimeoutMinutes `
|
RoundTimeoutMinutes = $RoundTimeoutMinutes
|
||||||
$(if (-not $NoSkipArtifact) { '-SkipArtifact' })
|
}
|
||||||
|
if (-not $NoSkipArtifact) { $burnInParams['SkipArtifact'] = $true }
|
||||||
|
|
||||||
|
& "$scriptDir\Test-CapacityBurnIn.ps1" @burnInParams
|
||||||
|
|
||||||
exit $LASTEXITCODE
|
exit $LASTEXITCODE
|
||||||
|
|||||||
Reference in New Issue
Block a user