Repository navigation
ci: guard apt-get network bounds instead of trusting a comment - #11947
Merged
Merged
Conversation
apt has no built-in timeout. Against the hosted runners' default Azure Ubuntu mirror it can connect and then never complete the transfer, so the step emits no further output and the job runs to its ceiling - six hours, where no explicit timeout-minutes exists - and reports `cancelled`, which reads as an infrastructure mystery rather than a stalled mirror. #11872 fixed this by hand in two workflows. It left one line unbounded: desktop-windows-ci.yml bounds its `apt-get update` and not the `apt-get install` directly beneath it, under a comment that says "Bound apt's network calls explicitly". The comment was already true of one line and false of the next, and nothing could tell. Bound that line, and add a check that derives the requirement from the source signal - an apt-get subcommand that touches the network - so a newly added call cannot be unbounded and nobody has to remember. Each such line must carry Acquire::Retries plus http and https Acquire timeouts, and its step must declare timeout-minutes as a backstop for what the acquire options do not cover (dpkg, a debconf prompt, a wedged post-install). `clean` and `autoremove` touch no mirror and are deliberately left alone. The self-test asserts the exact regression shape - update bounded, install forgotten - rather than only asserting today's tree is clean, so the guard cannot pass by accident once the tree is fixed. Failure-Class: none Co-Authored-By: Claude Opus 5 <[email protected]>
The check failed in CI with `No module named pytest`. Two mistakes, both mine: it was written against pytest when nothing in checks-manifest.yaml uses pytest, and it was verified locally with the backend venv rather than the bare `python3` the preflight runner actually invokes. Convert the self-test to stdlib unittest, matching every sibling in .github/scripts, and route it through a wrapper that resolves the canonical backend interpreter and provisions it when PyYAML is absent - the same shape as scripts/run-release-process-guards.sh, which is the existing precedent for a guard that needs the repository's locked PyYAML. The self-test carries the tree-wide case, so the wrapper is both the proof and the enforcement. Verified by reintroducing the unbounded install line: the wrapper fails, and passes again once bounded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hang
apt has no built-in timeout. Against the hosted runners' default Azure Ubuntu mirror it can connect and then never complete the transfer, so the step emits no further output and the job runs to its ceiling — six hours, where no explicit
timeout-minutesexists — then reportscancelled. That reads as an infrastructure mystery rather than a stalled mirror.Observed on
Linux package · helper smokeat exactly 6h00m15s, and onReplay Harness Phase 0Aat its tighter 20-minute cap, on main and on several unrelated PRs.What was already fixed, and what was missed
#11872 fixed this by hand in two workflows. It left one line unbounded:
The comment was already true of one line and false of the next, and nothing could tell.
The change
Bound that line, and add a check that derives the requirement from the source signal — an
apt-getsubcommand that touches the network — so a newly added call cannot be unbounded and nobody has to remember.Each such line must carry
Acquire::Retriesplus http and https acquire timeouts, and its step must declaretimeout-minutesas a backstop for what the acquire options do not cover: dpkg, a debconf prompt, a wedged post-install.cleanandautoremovetouch no mirror and are deliberately left alone.Verification
Run against the tree, the guard found exactly one offender — the line above — and no false positives across 69 workflow files. After the fix: clean.
The self-test asserts the exact regression shape (update bounded, install forgotten) rather than only asserting today's tree is clean, so the guard cannot pass by accident once the tree is fixed. 10 tests.
Failure-Class: none