Repository navigation
Conversation
mirror.refresh mirrors, for the top packages per ecosystem by recent downloads, the newest release of each major line a version is cached on. Releases within cooldown or on the denylist are skipped, and PyPI and conda get only the kinds of files clients fetched before. max_versions and max_bytes cap one run. Instances sharing a database take turns as for schedules.
The refresh fetches Debian, Alpine and RPM indexes again from the URLs clients fetched them from, which the hashed cache keys don't keep. Rows cached before get their URL on the next revalidation, even on a 304.
These clients find new versions in a repository index. The refresh fetches the InRelease, APKINDEX and repomd.xml files clients fetched again, reads the Packages and primary indexes they point at for the repositories the most used packages came from, and mirrors the newer file per package and architecture, checked against the index's SHA-256 where it has one.
An index file was mirrored only when it was newer than every cached version of the package and architecture. Debian suites share one pool, so once curl from trixie was cached, bookworm's security updates to curl were older than it and never mirrored. A run now mirrors the newest file an index lists when it isn't cached and an older version is, which still never downgrades and leaves a suite alone that only has a newer version cached. Tests also cover repositories listing several versions, an unreadable index next to working ones, Architecture: all packages, scoped npm packages, denied releases, a listing failure next to other packages, a cancelled run and Go version lines.
Contributor
Author
|
Fixed in b73980e: Debian suites share one pool, so once curl from trixie was cached, bookworm's updates to curl were older than every cached version and never mirrored. A run now mirrors the newest file an index lists when it isn't cached but an older version is, so it still never downgrades. Also added tests for repositories listing several versions, an unreadable index, |
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.
Closes #632.
Adds
mirror.refresh, a background job that mirrors new releases of the packages clients download most, so they are cached before the first install asks for them.How the open questions from the issue are answered:
0.minorbelow 1.0). Prereleases, yanked releases, releases within cooldown and denied ones are skipped, so a run mirrors what clients would be served. A release that leaves cooldown later is picked up by a later run.py312) and type.max_versionsandmax_bytescap one run. Mirrored files are evicted bymax_sizeand retention like any other.metadata_cachenow records the upstream URL (migration 020). A run fetches theInRelease,APKINDEX.tar.gzandrepomd.xmlfiles clients fetched again, reads thePackagesor primary index for the repositories and architectures of the cached packages, and mirrors the newest file an index lists per package and architecture when it isn't cached but an older version is, checked against the index's SHA-256. Suites sharing a pool, such as bookworm and trixie, are refreshed each on its own that way.job_runslike schedules.mirror.schedulesalready covers tags. Julia (cached by tree hash), Arch and FreeBSD are left out too.Tested end to end against the real upstreams: after a client fetched lodash 4.17.20, requests 2.31.0 (one wheel), curl from bookworm with the trixie
InRelease, and docker-ce-cli 28.0.4 from download.docker.com, one run mirrored lodash 4.18.1, the matching requests 2.34.2 wheel only, curl 8.14.1-2+deb13u5 and docker-ce-cli 28.1.1. The next run had nothing to do, and the new files were served from the cache.Migration 020 collides with #622 and #626; whichever lands later gets renumbered.