fix(ci): ephemeral lint venv on main
Lint / python (push) Failing after 24s
Lint / pssa (push) Failing after 35s

Stops a main-triggered Lint run from poisoning the shared production
venv (see feature branch commit for full rationale).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Simone
2026-05-17 15:44:37 +02:00
parent 719317ed91
commit 72defb2601
+9 -20
View File
@@ -69,7 +69,12 @@ jobs:
env:
PYTHONIOENCODING: utf-8
VENV_DIR: F:\CI\python\venv
# Job-local, ephemeral venv. MUST NOT be the production venv
# (F:\CI\python\venv): an editable install here would repoint the
# shared orchestrator package at this run's transient checkout and
# break every later smoke/build job with "No module named
# ci_orchestrator". github.workspace is discarded after the job.
VENV_DIR: ${{ github.workspace }}\.venv-lint
steps:
- name: Checkout
@@ -94,30 +99,14 @@ jobs:
$venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe'
# Probe: a broken venv (pyvenv.cfg pointing to a deleted base interpreter)
# writes "No Python at ..." to stderr; under $ErrorActionPreference='Stop'
# native stderr becomes a terminating exception (AGENTS.md error #12),
# so probe with SilentlyContinue + try/catch.
$venvOk = $false
if (Test-Path $venvPy) {
try {
$prevEAP = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
& $venvPy --version 2>&1 | Out-Null
if ($LASTEXITCODE -eq 0) { $venvOk = $true }
}
catch { $venvOk = $false }
finally { $ErrorActionPreference = $prevEAP }
}
if (-not $venvOk) {
Write-Host "Venv missing or broken, (re)bootstrapping at $env:VENV_DIR with $env:CI_PYTHON_LAUNCHER"
# Always build a fresh, job-local venv. Never reuse or repair a
# shared one — lint must be fully isolated from the production
# orchestrator venv.
if (Test-Path $env:VENV_DIR) {
Remove-Item $env:VENV_DIR -Recurse -Force
}
& $env:CI_PYTHON_LAUNCHER -m venv $env:VENV_DIR
if ($LASTEXITCODE -ne 0) { throw "venv creation failed" }
}
Write-Host "Using venv python: $venvPy"
& $venvPy --version