Repository navigation
gates: cache the declared apt packages on hosted Linux, warmed from the default branch - #202
Merged
Merged
Conversation
…he default branch On GitHub's Linux runners the Azure mirror can serve about 100 kB/s, and a large TeX and font set (arachne's: texlive-fonts-extra alone is 669 MB) then holds "Apply CI environment" past its 20-minute bound. A hosted Linux gate with apt packages now points apt at a directory the Actions cache restores, keyed by image, arch and the declared apt set. The planner names the set (apt_cache) and, on the default branch, the packages a new package-cache job downloads and saves (apt_warm): only the default branch's entries are served to every ref. Self-hosted runners are untouched.
…d the next resumes Measured on arachne: one warm fetched the 1167 MB set in 26 s, the next sat in the download for over 25 minutes. The download step gets a 45-minute bound; what it fetched is saved under a partial key that the next warm restores first and a gate only when no complete entry exists. docs/adopting.md gains the Package cache section.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…umes it A slow-mirror warm on arachne spent 37 minutes on texlive-fonts-extra (669 MB) without finishing; a partial save of complete files alone would start it over every time. The cache paths carry partial/ as well, opened to the cache before either save, and the warm's pruning covers it.
… its files A step's timeout ends its bash but not the apt-get under sudo, and its method went on writing texlive-fonts-extra: tar failed with 'file changed as we read it' (arachne run 42835893694).
…s own apt; resume across images Review of #202: - apt accepts a file in its archive directory on name and size alone (acquire-item.cc, pkgAcqArchive). After a fresh update, every restored .deb is checked against the index's SHA256 for its version, in both jobs; a mismatch or an unknown file is deleted and downloaded again. - The warm's download runs under setsid, its group recorded; after a timeout (no recorded return) the cleanup signals that group alone, never apt by name. - The warm's last fallback is the set's partial download on any image.
…hash On Ubuntu 26.04 apt names an amd64v3 build's file _amd64v3.deb while its index record says Architecture: amd64, so matching by file name dropped 68 of 98 good packages (arachne run 42841293986).
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.
Why
On GitHub's Linux runners the Azure Ubuntu mirror sometimes serves about 100 kB/s. When it does, arachne's declared TeX and font set (1167 MB;
texlive-fonts-extraalone is 669 MB) keeps "Apply CI environment" running until its 20-minute limit. That has happened 34 times since 11-02, and every rerun passed. The mirror's speed varies from runner to runner: during this work one download of the set took 22–48 s, while another download of the same set, started minutes later, was still running after 45 minutes.What
apt). Before the setup step, a step adds an apt drop-in that setsDir::Cache::Archivesto$RUNNER_TEMP/ci-kit-apt/andAPT::Sandbox::User root.actions/cache/restore@v6then restores*.debthere. The key isci-kit-apt-1-<ImageOS>-<arch>-<apt set hash>-<ImageVersion>. When it misses, the gate falls back first to the same set on an older image, then to any set, then to a partial warm. On a miss apt downloads from the mirror, as it does today.setup@v1, the setup hash and the stale-image check are unchanged. apt still resolves every package against fresh lists and downloads whatever the directory lacks. Self-hosted runners and macOS don't run these steps (runner.environment == 'github-hosted' && runner.os == 'Linux').package cachejob (default branch only). The planner emitsapt_cache(a hash of the sorted apt names) andapt_warm, the names to warm.apt_warmis non-empty only whencache_writeis true (the build cache's default-branch rule) and somehostedgate uses the shared setup. The job:--print-urisagainst an empty directory);apt-get install --download-only --no-upgrade;It has
continue-on-error, and the verdict doesn't wait for it. If the mirror is too slow for the download's 45-minute limit, what was downloaded is saved under apartialkey. That includes the file apt was still downloading (frompartial/), and the job stops theapt-getthat the step timeout leaves running under sudo before saving. The next warm resumes from that entry; gates read it only when no complete entry exists. The step limit sits below the 60-minute job limit on purpose: a job timeout marks the whole runcancelled(run 42825718305), while a step timeout leaves it green.ci/**ref or a PR is read only by that ref's own later runs, and everyci-gatecall pushes a new ref. Saving there would use the 10 GB quota for nothing.docs/adopting.mdgets a "Package cache" section. Callers addpush: [main]and a schedule, the same lines as the build cache's seeds.Measured
On an arachne scratch branch whose caller pointed at a ci-kit e2e branch: this PR plus a planner line that warms on any ref, and, for the partial rows, a separate key prefix and a forced step timeout. Both branches and every cache they saved have since been deleted.
texlive-fonts-extraran for 37 min until the 60-minute job limit (this commit had no step limit). That cancelled the runNeed to get 0 B/1167 MB. Apply CI environment: 2m41s / 2m06s. The warm job stopped after its lookupfailure, the partial save ran, and the run stayed greenNeed to get 0 B, saved the complete keyfile changed as we read itbecause apt was still running. Fixed in eb4d09eNeed to get 1146 MB/1167 MB), finished and saved the complete keyOn a hit, the step still unpacks and configures the packages, runs the TeX triggers (~45 s) and the setup script (~41 s). Those take about 2 minutes. The cache removes the download, which is the part a slow mirror stretches past the 20-minute limit.
Before v1 can move
push: branches: ['ci/**', main]and a schedule. Today nothing in arachne runs on main, so nothing would save the cache.ci-gate: GREEN https://github.com/SSFSKIM/ci-kit/actions/runs/42830999563
Review fixes (91df9b7, dd9464a)
apt-get updateand before the install, both jobs check each restored deb's SHA256 against the index entry for its package and version, using a singleapt-cache showfor all of them. A deb whose hash differs, or that the index doesn't know, is deleted and downloaded again. If the update fails, no restored deb is used. Files inpartial/aren't checked: apt hashes a resumed download as a whole._amd64v3.deb, but the index entry saysamd64, so 68 of 98 good debs were dropped (run 42841293986). It now matches by package, version and hash.Need to get 0 B/1167 MBand took 2m39s / 2m27s (run 42841768617).sudo setsid --wait, and records its process group and, once apt returns, its exit status. The cleanup signals that group, TERM and then KILL, only when no exit status was recorded, which means a timeout or a cancel. Nothing is stopped by name anymore. Tested in e2e: the download hit its limit partway throughtexlive-fonts-extra, the job stopped that group, the partial save went through cleanly (559 MB, run 42840531108), and the next warm resumed:Need to get 990 MB,Fetched 632 MB(run 42841293986).