Add gems remote type for RubyGems #142

Merged
benvin merged 5 commits from benvin/remote-gems into benvin/remote-head-route 2026-10-17 13:19:01 +11:00
Member

Ruby builds fetch gems from rubygems.org directly because artifactapi has no RubyGems remote type.

  • add gems package type proxying https://rubygems.org-style sources
  • treat versions, names, info/* and *specs.4.8.gz as mutable, gems/*.gem and quick/Marshal.4.8/*.gemspec.rz as immutable
  • serve api/v1/*.json as application/json
  • add a gem/bundler usage snippet to the UI and a gems e2e caching case

Requires unkin/artifactapi#148 (HEAD route; RubyGems probes HEAD /versions).

Ruby builds fetch gems from rubygems.org directly because artifactapi has no RubyGems remote type. - add `gems` package type proxying `https://rubygems.org`-style sources - treat `versions`, `names`, `info/*` and `*specs.4.8.gz` as mutable, `gems/*.gem` and `quick/Marshal.4.8/*.gemspec.rz` as immutable - serve `api/v1/*.json` as `application/json` - add a gem/bundler usage snippet to the UI and a gems e2e caching case Requires unkin/artifactapi#148 (HEAD route; RubyGems probes `HEAD /versions`).
Author
Member
  • internal/api/v1/proxy.go:43 — the HEAD route applies to every package type, not only gems; handleProxyHead bypasses RemoteServer, so HEAD on github_rpm/github_deb/github_alpine synthesized paths goes to a bogus upstream URL (was 405, now 404/502), and on nuget (#141 merged) HEAD reports the unrewritten size → split into its own PR, and route HEAD through the same RemoteServer path as GET or restrict it.
  • internal/proxy/engine.go:356 — headUpstreamOnce uses http.DefaultClient (no timeout, ignores per-remote clientForRemote); a HEAD /versions cache miss can hang indefinitely and the new route exposes it → use clientForRemote(remote).
  • internal/provider/gems/gems.go:24 — /versions (~23 MB) is Mutable and the engine ReadAll-buffers it on every refresh, then copies it again for the response; bundler Range requests are ignored so each refresh after TTL transfers the full body → stream large mutable bodies or add Range/If-None-Match handling for compact-index paths.
  • PR is not mergeable against master after #141 → rebase.
  • nit: internal/provider/gems/gems.go:35 — api/v1/* JSON paths get application/octet-stream → return application/json for api/ paths.
- internal/api/v1/proxy.go:43 — the HEAD route applies to every package type, not only gems; handleProxyHead bypasses RemoteServer, so HEAD on github_rpm/github_deb/github_alpine synthesized paths goes to a bogus upstream URL (was 405, now 404/502), and on nuget (#141 merged) HEAD reports the unrewritten size → split into its own PR, and route HEAD through the same RemoteServer path as GET or restrict it. - internal/proxy/engine.go:356 — headUpstreamOnce uses http.DefaultClient (no timeout, ignores per-remote clientForRemote); a HEAD /versions cache miss can hang indefinitely and the new route exposes it → use clientForRemote(remote). - internal/provider/gems/gems.go:24 — /versions (~23 MB) is Mutable and the engine ReadAll-buffers it on every refresh, then copies it again for the response; bundler Range requests are ignored so each refresh after TTL transfers the full body → stream large mutable bodies or add Range/If-None-Match handling for compact-index paths. - PR is not mergeable against master after #141 → rebase. - nit: internal/provider/gems/gems.go:35 — api/v1/* JSON paths get application/octet-stream → return application/json for api/ paths.
unkin-agent changed target branch from master to benvin/remote-head-route 2026-10-17 12:52:24 +11:00
unkin-agent added 4 commits 2026-10-17 12:52:24 +11:00
Add gems remote type for RubyGems
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
95d81c1af0
- add gems package type proxying the compact index and .gem/quick gemspec downloads
- route HEAD on /api/v1/remote/* so gem detects the compact index
merge master
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
655bfe402e
# Conflicts:
#	internal/api/v1/routes_test.go
Serve gems api/v1 JSON as application/json
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ca7c8fa2a0
Author
Member

No findings.

No findings.
unkin-agent added 1 commit 2026-10-17 13:00:46 +11:00
Merge remote-tracking branch 'origin/benvin/remote-head-route' into benvin/remote-gems
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
b42430518e
benvin merged commit 9387bce560 into benvin/remote-head-route 2026-10-17 13:19:01 +11:00
benvin deleted branch benvin/remote-gems 2026-10-17 13:19:01 +11:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/artifactapi#142