Module proxy and its self-check, observe-only (MQ-11 step 5a) #51
Loading…
Reference in a new issue
No description provided.
Delete branch "mq-11-goproxy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 5a of stage 6b of the anvil build: https://openproject.home.romaine.life/wp/MQ-11 (the design's "Module proxy" section; cutover step "merge-queue proxy (observe)").
Added
goproxy.go: a GOPROXY-protocol handler at/goproxy/<plan>/.... A plan (in memory) maps module@version to repository, commit and folder. For a registered version:list,.info(committer time),.mod(byte for byte) and.zip, which isx/mod/zip.CreateFromVCSrun on a scratch repo whose objects are the bare clone's, with the blobs it needs fetched by id first, cached on the volume (DATA_DIR/goproxy/zips) by module, version and tree.@latestand anything unregistered: 404. Unknown plan: 410. Paths and versions are case-escaped.CreateFromVCSruns withexport-ignoreandexport-substturned off, because cmd/go turns them off before its owngit archive(ensureGitAttributes). Without that, a file markedexport-ignoreis in Go's zip but not anvil's, and theh1:differs. A test caught this.GET /api/v1/repos/<plan's library repo>, and the verdict is cached 10 minutes, keyed by the token's sha256 and the repo. No token gets 401, a refused one 403, and Forgejo down 502 (not cached). No token is logged.h1:of anvil's zip and go.mod for its newest real tag, compared with what users' go.sum files on their default branches record. It runs at warm-up, whole after a fetch of the library's repository, and for one user's go.sum after a fetch of that user. Results are ok / mismatch (both hashes) / unknown. Shown inGET /selfcheckJSON, the gaugemerge_queue_goproxy_selfcheck_modules{result}, and one warn line per new mismatch. Also the countermerge_queue_goproxy_requests_total{answer}.register(test-only until step 5b plans landings).go mod downloadthrough the proxy, then the same commit tagged and fetched withGOPROXY=direct. Theh1:sums are equal for a root module and a module in a folder. On Linux (CI) the proxy run uses https with the token in the GOPROXY URL, since Go sends URL credentials over https only; elsewhere a forwarder adds the same basic auth.Changed
k8s/route.yaml: aPathPrefix /goproxymatch beside/healthon merge-queue.home.romaine.life.main.go,keep.go: wiring. The self-check runs afterclones readyand after each fetch.selftest.go: the image's self-test also checks the 410 for an unknown plan and/selfcheck.DATA_DIR.Removed
Nothing.
Left alone
No plan is ever registered, so nothing outside the tests is served yet (step 5b does that). queue.go, groups.go and lines.go are untouched (held mq-10-lines). The metrics are registered from goproxy.go rather than in metrics.go, so they don't collide with that branch.
Differs from the brief
The self-check page is
GET /selfcheck, not/goproxy/selfcheck: the route's/goproxyprefix would have published it.🤖 Generated with Claude Code