Skip to content

ci: take Python from the runner's tool cache, not from a mid-run download - #873

Merged
rafeekpro merged 1 commit into
developfrom
fix/ci-python-from-toolcache
Aug 13, 2026
Merged

ci: take Python from the runner's tool cache, not from a mid-run download#873
rafeekpro merged 1 commit into
developfrom
fix/ci-python-from-toolcache

Conversation

@rafeekpro

Copy link
Copy Markdown
Collaborator

Zamyka #872.

Problem

uv python install pobierał CPythona z GitHub Releases na starcie czterech jobów, przy
każdym przebiegu. 12 sierpnia jedno z tych pobrań padło:

error: Failed to install cpython-3.13.7-linux-x86_64-gnu
  Caused by: http2 error: refused stream before processing any application logic

To była czwarta tego dnia awaria pobierania narzędzia w CI floty:

repo narzędzie błąd
veracrew yq curl: (56) Connection died — naprawione
speacher kubectl wszystkie metody instalacji zawiodły — wciąż czerwone
trading-council Trivy exit 56 — przeszło po ponowieniu
dap CPython http2: refused stream — tutaj

Żadna z czterech nie miała związku z testowanym kodem.

Zmiana

env:
  UV_PYTHON_PREFERENCE: only-system

- uses: actions/setup-python@v5
  with:
    python-version-file: '.python-version'

Sam setup-python by tego nie naprawił — i to jest sedno. Domyślna preferencja uv to
managed: woli własnego CPythona i pobiera go nawet wtedy, gdy sprawny interpreter już
jest na PATH
. Dopiero only-system faktycznie usuwa pobieranie. W zgłoszeniu #872
zaproponowałem sam setup-python; to było niewystarczające.

Dlaczego akurat tu to działa

Te joby biegną na ubuntu-latest, gdzie Python 3.13 jest w tool-cache runnera, więc
setup-python rozwiązuje go bez sieci.

Mówię to wprost, bo na naszej puli self-hosted odpowiedź byłaby inna: tam setup-python
też schodzi po plik do GitHub Releases, i właściwym rozwiązaniem byłaby zadeklarowana
zdolność runnera — tak jak build już obiecuje start-test-postgres i stos WeasyPrint
(pr-review-gate/registry/repos.yml).

Weryfikacja

Prawdziwym testem jest zielone CI na tym PR: jeśli Python wstaje bez pobierania, kroki
Pin Python przejdą w sekundy zamiast w kilkanaście.

…load

`uv python install` fetched CPython from python-build-standalone on GitHub Releases at the
start of four separate jobs, every run. On 2026-08-12 one of those fetches died:

  error: Failed to install cpython-3.13.7-linux-x86_64-gnu
    Caused by: http2 error: refused stream before processing any application logic

It was the fourth toolchain download to break fleet CI that day — after `yq` (veracrew,
curl exit 56), `kubectl` (speacher, still red), and Trivy (trading-council, exit 56). None
of the four had anything to do with the code being tested.

Two changes, and the second is the one that matters:

  actions/setup-python with python-version-file: '.python-version'
  UV_PYTHON_PREFERENCE: only-system

setup-python alone would NOT have fixed this. uv's default preference is `managed`: it
prefers its own CPython and downloads it even when a perfectly good interpreter is already
on PATH. `only-system` is what actually removes the fetch.

These jobs run on ubuntu-latest, where Python 3.13 ships in the runner's tool cache, so
setup-python resolves it without crossing the network. (Worth stating because the answer
would be different on our self-hosted pool, where setup-python falls back to downloading
from GitHub Releases too — there the fix would be a declared runner capability, the way
`build` already promises `start-test-postgres` and the WeasyPrint stack.)

.python-version stays the single source of truth: 3.13, matching requires-python >=3.13.
Applied to all four jobs that had the step (lines 103, 188, 229, 278) — dap#872 said three;
there were four.

Closes #872

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@rafeekpro
rafeekpro merged commit ef891ba into develop Aug 13, 2026
17 checks passed
@rafeekpro
rafeekpro deleted the fix/ci-python-from-toolcache branch August 13, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants