Add version GC + same-version no-op to versioned upgrade
Summary
Two refinements to the blue-green versioned upgrade (both OSes, versioned-only, gated on the layout — flat installs untouched):
-
Version GC: after a successful upgrade, prune old version dirs keeping the newest N (
SQUID_UPGRADE_KEEP_VERSIONS, default 3) soversions/doesn't grow unbounded. Best-effort (runs only after SUCCESS), floored at 2 so it can never strand the rollback target, and it never deletes the active version. On Linux the retention env var is propagated across the systemd-run scope so the override actually reaches Phase B. -
Same-version re-upgrade is now a clean no-op: when the target equals the active version, skip stage+repoint and discard the download instead of moving it into the live version dir (which previously left an
extract/residue).
Test plan
-
694 upgrade unit tests green: updated guard pins + new GC/same-version drift assertions (env var + floor-2 + sort key + already-activeevent) + events-parity +bash -non the rendered Linux script + the Windows resource test (GC sorts byCreationTimeUtc, sidestepping the Phase-BLastWriteTimeanti-pattern guard). -
Real-OS E2E (dispatched on this branch): Linux systemd + Windows SCM — GC prunes the oldest beyond retention (4 versions → newest 3 kept); same-version re-upgrade is a no-op with no residue.
Notes
Non-breaking: gated entirely on the versioned layout. GC is best-effort and floored at 2.