fix(registry_gc): correct Gitea packages API + Cloudflare-friendly UA #2

Merged
justin merged 1 commits from fix/registry-gc into main 2026-05-22 13:44:44 -04:00
1 Commits
Author SHA1 Message Date
justinandClaude Opus 4.7 3b9cb4f874 fix(registry_gc): correct Gitea package API + add Cloudflare-friendly UA
The script was hitting /api/v1/packages/{owner}/container/{name}/versions
which doesn't exist (Gitea returns 404 — interpreting the request as a
version named "versions"). Replaced with the actual endpoint
/api/v1/packages/{owner}/container/{name} which returns the array of
version rows directly. Delete path is now
/api/v1/packages/{owner}/container/{name}/{version} (URL-encoded version
string, not numeric ID).

Refactored the keep-set: always preserve `latest`, top --keep-latest
YYYY.MM.DD date tags AND top --keep-latest short-SHA tags (the rollback
pins) by created_at desc. Anything within --keep-days is kept; older
date/sha tags are deleted. sha256:* blob versions are skipped — Gitea's
internal package GC reclaims them when their last tag goes away.

Also added an explicit User-Agent header because git.jpaul.io sits
behind Cloudflare, whose Bot Fight Mode 403s the default
"Python-urllib/X.Y" UA with error code 1010. Affected run 104's GC
step (curl was fine; urllib was blocked).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-22 13:44:42 -04:00