Skip to content

ci: resolve Tier 2 package versions weekly and open a drift PR - #5528

Merged
zackees merged 1 commit into
masterfrom
feat/apt-updates
Nov 23, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/apt-updates

Conversation

@zackees

@zackees zackees commented Nov 23, 2026

Copy link
Copy Markdown
Member

Stacked on #5527 (both edit ci.toml's workflow allow list; merge that first).

Why

apt-packages.txt names packages, not versions. Two consequences today:

  1. The image identity isn't an identity. tier2_image.py identity() hashes the Dockerfile plus the two package lists. Rebuild the same tag a month later and apt-get install resolves to newer -updates/-security versions — same tag, different content.
  2. Stale archives 404. A superseded .deb disappears and apt-get fails on it — the reason the retry paths in Install Git exist at all (bug: CI: AI rebase feedback and unlimited retries burn runner capacity #5497).

Neither is visible until something breaks in a red merge queue.

What this adds

ci/apt_updates.py, with two stages:

  • resolve — runs apt-get --reinstall -s install -y --no-install-recommends <list> and parses the Inst <name> (<version> ...) lines into a sorted name=version lock. --reinstall is what makes preinstalled packages (a runner's git, curl) appear too, so the lock is complete rather than "whatever wasn't already there".
  • check — resolves and diffs against the committed lock; prints changed cmake: 3.30 -> 3.31 / added … / removed … and exits 1 on drift, so it also works as a local gate.

.github/workflows/apt-updates.yaml — weekly (Mon 05:23) plus workflow_dispatch:

  1. regenerate rust/tools/linux-validate/apt-versions.txt,
  2. git diff --quiet to decide whether anything moved,
  3. open/refresh a PR via peter-evans/create-pull-request (already in the allow list) only when it moved.

So the job is silent while the archive is stable, and hands you a reviewable diff the week it isn't.

Why a PR and not an auto-commit

A version bump that breaks Tier 2 is worth one human look. Merging the PR is what rebuilds the prebaked image under a new identity — the change and its blast radius stay in one place.

Tests

ci/test_apt_updates.py covers the half that doesn't need a live archive:

  • Inst lines → name/version, Conf lines and chatter ignored,
  • lock render is sorted and round-trips; a line without =version is refused,
  • changed() reports added / removed / changed, sorted, and returns [] when nothing moved,
  • the resolve command end-to-end against a fake apt-get on PATH, so the subprocess plumbing and the printed lock are exercised without an apt host,
  • the workflow is scheduled, guarded off forks (bug: ci: scheduled workflows run on forks and fail every day #1258), declares timeout-minutes, pins every action by SHA, and writes the same path the script reads.
$ cd ci && uv run --no-project python -m unittest test_apt_updates test_apt_seed test_ci_toml test_workflow_schedule_guard
Ran 70 tests ... OK
$ uv run --no-project ci/local_gate.py --only self-test
== self-test: ok

Follow-up (not in this PR)

The lock exists but the Dockerfile still installs unpinned names. Wiring apt-versions.txt into the build — install name=version — would make the image tag genuinely content-addressed and turn a lock mismatch into a hard build failure instead of a silent drift. That changes what the build does, so it wants your call rather than mine.

Base automatically changed from feat/apt-cache-self-seed to master November 23, 2026 20:37
apt-packages.txt names packages, not versions, so the image identity hashes
a list that resolves to different content as -updates and -security move. A
stale archive also 404s a superseded .deb, which is the failure the cache
retry paths exist to paper over (#5497).

ci/apt_updates.py resolves the list against the current archive with
`apt-get -s --reinstall install` and renders a sorted name=version lock; the
scheduled job regenerates it and opens a pull request only when the lock
moves. A version bump that breaks Tier 2 is then reviewable in a diff instead
of being discovered inside a red merge queue.

The lock is generated, sorted and one package per line, so the PR diff is the
review. check exit status is non-zero on drift, so the same command works as
a local gate.

Stacked on #5527 because both edit ci.toml's workflow allow list.
@zackees
zackees added this pull request to the merge queue Nov 23, 2026
Merged via the queue into master with commit 40fe9a8 Nov 23, 2026
42 checks passed
@zackees
zackees deleted the feat/apt-updates branch November 23, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant