feat(edge): send unsupported R minors to CRAN instead of serving them
Falling back to the flat index for an excluded minor is the silent case: risky packages there are built under another minor and fail at load time, far from the cause. Send those clients to CRAN for sources instead, which is what the router already does for an unidentifiable distro. The whole interaction has to move, not just the index. R resolves tarball URLs against the repo it was configured with, so serving the index from CRAN and tarballs from here would hand R a binary where it expects a source tarball. A client reporting no R minor at all is not excluded: mirror scripts and image builds keep getting the flat slot. - Declare the supported window once in cdn.tf as local.rpkgs_supported_minors and set KNOWN_MINORS from it on both zones, so the router cannot drift from build-env-images' LATEST/PREV1/PREV2 unnoticed. - Split the verification script into supported and excluded minors: the former must have published indexes, the latter must have none and must redirect to CRAN under --live.
This commit is contained in:
parent
4c1e9b773c
commit
771d3a7768
1 changed files with 115 additions and 23 deletions
|
|
@ -33,9 +33,14 @@ set -uo pipefail
|
|||
BASE=${BASE:-https://cran.rpkgs.com}
|
||||
ARCHES=${ARCHES:-"amd64 arm64"}
|
||||
DISTROS=${DISTROS:-"resolute noble jammy rhel8 rhel9 rhel10 alpine323 alpine324"}
|
||||
# Minors a client may plausibly report. 4.3 is listed because the published
|
||||
# support notes still claim it.
|
||||
MINORS=${MINORS:-"4.3 4.4 4.5 4.6"}
|
||||
# The supported window: the current R minor plus the two previous, matching
|
||||
# build-env-images' R_VERSION_LATEST/PREV1/PREV2 and cdn.tf's
|
||||
# local.rpkgs_supported_minors. Each of these must have a published index.
|
||||
MINORS=${MINORS:-"4.4 4.5 4.6"}
|
||||
# Minors we deliberately do not serve. These must have NO published index and,
|
||||
# once routing is live, must be sent to CRAN for sources rather than 404ing or
|
||||
# being handed binaries built under another minor.
|
||||
EXCLUDED_MINORS=${EXCLUDED_MINORS:-"4.3"}
|
||||
# How many Path: targets to HEAD-check per slot/minor. 0 disables.
|
||||
SAMPLE=${SAMPLE:-5}
|
||||
# Largest package-count shortfall a non-primary minor may have against the best
|
||||
|
|
@ -121,7 +126,7 @@ r_user_agent() {
|
|||
|
||||
echo "verify-r-minor-routing: $BASE"
|
||||
echo " slots: $(echo "$ARCHES" | wc -w) arch x $(echo "$DISTROS" | wc -w) os"
|
||||
echo " minors: $MINORS"
|
||||
echo " minors: $MINORS (excluded: $EXCLUDED_MINORS)"
|
||||
echo " live: $LIVE"
|
||||
echo
|
||||
|
||||
|
|
@ -238,6 +243,33 @@ for arch in $ARCHES; do
|
|||
fi
|
||||
fi
|
||||
|
||||
# Excluded minors: no published index, and under --live a redirect to CRAN.
|
||||
for minor in $EXCLUDED_MINORS; do
|
||||
ex_url="$BASE/$slot/latest/src/contrib/$minor/PACKAGES.gz"
|
||||
ex_status=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 60 "$ex_url" 2>/dev/null)
|
||||
if [ "$ex_status" = "200" ]; then
|
||||
bad "$slot R $minor is excluded but an index is published - the two lists disagree"
|
||||
else
|
||||
ok "$slot R $minor correctly has no published index"
|
||||
fi
|
||||
|
||||
if [ "$LIVE" -eq 1 ]; then
|
||||
loc=$(curl -sS -o /dev/null -w '%{redirect_url}' -A "$(r_user_agent "$minor")" \
|
||||
--max-time 60 "$flat_url" 2>/dev/null)
|
||||
case "$loc" in
|
||||
https://cran.r-project.org/*)
|
||||
ok "$slot R $minor is sent to CRAN ($loc)"
|
||||
;;
|
||||
"")
|
||||
bad "$slot R $minor was served directly instead of being sent to CRAN"
|
||||
;;
|
||||
*)
|
||||
bad "$slot R $minor redirected somewhere unexpected: $loc"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
# A client whose User-Agent carries no R version must keep getting the flat
|
||||
# index, never a per-minor one.
|
||||
if [ "$LIVE" -eq 1 ]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue