fix(shims): add Linux fallback for venv Python path in all PS shims
All shims defaulted to F:\CI\python\venv\Scripts\python.exe when CI_VENV_PYTHON was not set. On Linux host this caused instant failure. Now uses $IsWindows (PS 6+ automatic var; absent on PS 5.1 = Windows) to select /opt/ci/venv/bin/python on Linux. Windows paths unchanged. Affects: Invoke-CIJob, Get-BuildArtifacts, Cleanup-OrphanedBuildVMs, New-BuildVM, Remove-BuildVM, Wait-VMReady, Get-CIJobSummary, Invoke-RemoteBuild, Watch-DiskSpace, Watch-RunnerHealth, Set-CIGuestCredential, Test-CIGuestWinRM. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+44
-37
@@ -1,37 +1,44 @@
|
||||
#Requires -Version 5.1
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Shim: delegates to the Python ci_orchestrator CLI.
|
||||
# Original PS implementation moved to git history; see plans/A2-closeout.md.
|
||||
# PowerShell common params (-ErrorAction etc.) must not be forwarded
|
||||
# to the Python CLI. Value-taking ones also consume the next token.
|
||||
$commonWithValue = @{
|
||||
erroraction = $true; warningaction = $true; informationaction = $true
|
||||
progressaction = $true; errorvariable = $true; warningvariable = $true
|
||||
informationvariable = $true; outvariable = $true; outbuffer = $true
|
||||
pipelinevariable = $true
|
||||
}
|
||||
$commonSwitch = @{ verbose = $true; debug = $true; whatif = $true; confirm = $true }
|
||||
|
||||
$pyArgs = @()
|
||||
for ($i = 0; $i -lt $args.Count; $i++) {
|
||||
$a = $args[$i]
|
||||
if ($a -is [string] -and $a.Length -gt 1 -and $a.StartsWith('-') -and -not $a.StartsWith('--')) {
|
||||
$name = $a.Substring(1)
|
||||
$lname = $name.ToLower()
|
||||
if ($commonSwitch.ContainsKey($lname)) { continue }
|
||||
if ($commonWithValue.ContainsKey($lname)) { $i++; continue }
|
||||
$kebab = [Regex]::Replace($name, '(?<=[a-z0-9])([A-Z])', '-$1')
|
||||
$kebab = [Regex]::Replace($kebab, '([A-Z]+)([A-Z][a-z])', '$1-$2')
|
||||
$pyArgs += '--' + $kebab.ToLower()
|
||||
}
|
||||
else {
|
||||
$pyArgs += $a
|
||||
}
|
||||
}
|
||||
|
||||
$venvPython = $env:CI_VENV_PYTHON
|
||||
if (-not $venvPython) { $venvPython = 'F:\CI\python\venv\Scripts\python.exe' }
|
||||
& $venvPython -m ci_orchestrator wait-ready @pyArgs
|
||||
exit $LASTEXITCODE
|
||||
#Requires -Version 5.1
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Shim: delegates to the Python ci_orchestrator CLI.
|
||||
# Original PS implementation moved to git history; see plans/A2-closeout.md.
|
||||
# PowerShell common params (-ErrorAction etc.) must not be forwarded
|
||||
# to the Python CLI. Value-taking ones also consume the next token.
|
||||
$commonWithValue = @{
|
||||
erroraction = $true; warningaction = $true; informationaction = $true
|
||||
progressaction = $true; errorvariable = $true; warningvariable = $true
|
||||
informationvariable = $true; outvariable = $true; outbuffer = $true
|
||||
pipelinevariable = $true
|
||||
}
|
||||
$commonSwitch = @{ verbose = $true; debug = $true; whatif = $true; confirm = $true }
|
||||
|
||||
$pyArgs = @()
|
||||
for ($i = 0; $i -lt $args.Count; $i++) {
|
||||
$a = $args[$i]
|
||||
if ($a -is [string] -and $a.Length -gt 1 -and $a.StartsWith('-') -and -not $a.StartsWith('--')) {
|
||||
$name = $a.Substring(1)
|
||||
$lname = $name.ToLower()
|
||||
if ($commonSwitch.ContainsKey($lname)) { continue }
|
||||
if ($commonWithValue.ContainsKey($lname)) { $i++; continue }
|
||||
$kebab = [Regex]::Replace($name, '(?<=[a-z0-9])([A-Z])', '-$1')
|
||||
$kebab = [Regex]::Replace($kebab, '([A-Z]+)([A-Z][a-z])', '$1-$2')
|
||||
$pyArgs += '--' + $kebab.ToLower()
|
||||
}
|
||||
else {
|
||||
$pyArgs += $a
|
||||
}
|
||||
}
|
||||
|
||||
$venvPython = $env:CI_VENV_PYTHON
|
||||
if (-not $venvPython) {
|
||||
# $IsWindows exists only on PS 6+; absent on PS 5.1 (always Windows)
|
||||
if ($null -ne $IsWindows -and $IsWindows -eq $false) {
|
||||
$venvPython = '/opt/ci/venv/bin/python'
|
||||
} else {
|
||||
$venvPython = 'F:\CI\python\venv\Scripts\python.exe'
|
||||
}
|
||||
}
|
||||
& $venvPython -m ci_orchestrator wait-ready @pyArgs
|
||||
exit $LASTEXITCODE
|
||||
|
||||
Reference in New Issue
Block a user