fix(template): make prepare-win robust without prior Deploy run
- WinRM MaxProcessesPerShell: apply 100 if below threshold before asserting - DesktopHeap SharedSection: apply 4096 KB registry value if below threshold before asserting - Replace cleanmgr (hangs in WinRM Session 0, no window station) with direct PowerShell cleanup for dumps, WER files and Recycle Bin; DISM already covers component store and WU cache - vcpkg git clone/checkout: wrap with EAP=Continue to suppress PS5.1 NativeCommandError on git stderr (gotcha #3 from AGENTS.md) - template.py: filter CI_EXITCODE:N marker from displayed output - ci-static-ip.ps1: switch from vmware-rpctool (removed in recent Tools) to vmtoolsd --cmd; use temp-file redirect to capture output from native cmd Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -292,6 +292,13 @@ def _parse_exit_marker(stdout: str) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def _strip_exit_marker(stdout: str) -> str:
|
||||
"""Remove ``CI_EXITCODE:N`` lines from output before display."""
|
||||
return "\n".join(
|
||||
line for line in stdout.splitlines() if not line.strip().startswith("CI_EXITCODE:")
|
||||
)
|
||||
|
||||
|
||||
def _wait_winrm(transport: WinRmTransport, timeout: int) -> None:
|
||||
"""Poll *transport*.is_ready() until True or *timeout* seconds elapse."""
|
||||
deadline = time.monotonic() + timeout
|
||||
@@ -532,8 +539,9 @@ def template_prepare_win(
|
||||
try:
|
||||
result = _run_with_heartbeat(transport, invoke, check=False)
|
||||
exit_code = _parse_exit_marker(result.stdout)
|
||||
if result.stdout.strip():
|
||||
click.echo(result.stdout.strip())
|
||||
display = _strip_exit_marker(result.stdout).strip()
|
||||
if display:
|
||||
click.echo(display)
|
||||
if result.stderr.strip():
|
||||
click.echo(result.stderr.strip(), err=True)
|
||||
except TransportError:
|
||||
@@ -658,8 +666,9 @@ Register-ScheduledTask -TaskName 'CI-StaticIp' `
|
||||
)
|
||||
cleanup_result = _run_with_heartbeat(transport, cleanup_invoke, check=False)
|
||||
cleanup_ec = _parse_exit_marker(cleanup_result.stdout)
|
||||
if cleanup_result.stdout.strip():
|
||||
click.echo(cleanup_result.stdout.strip())
|
||||
display = _strip_exit_marker(cleanup_result.stdout).strip()
|
||||
if display:
|
||||
click.echo(display)
|
||||
if cleanup_result.stderr.strip():
|
||||
click.echo(cleanup_result.stderr.strip(), err=True)
|
||||
if cleanup_ec != 0:
|
||||
|
||||
Reference in New Issue
Block a user