Loading
Add artifact registry repository listing and write methods
What does this MR do and why?
Completes the repository CRUD surface of the ee/lib Artifact Registry client, on top of the merged step 1 foundation (!244245 (merged)):
Client#repositoriesfetches the collection endpoint with filtering, sorting, and pagination arguments forwarded as query parameters, and returns aRepositoryPagevalue object. The opaque next/prev cursors are parsed from the RFC 8288Linkresponse header; only thecursorquery-parameter value of each link is exposed, and a missing or partialLinkheader tolerantly yields nil cursors. A header that is present but carries none of the relations the client reads logs, rather than silently ending pagination.Client#create_repository,Client#update_repository, andClient#delete_repositorycomplete the mutations. Optional fields are compacted out of the request bodies. Delete is idempotent: a 404 returnstrue, which also covers the retry race where the first attempt times out after deleting and the retry sees a 404. POST and PATCH are never retried.- The request primitive returns the raw response (the listing needs the
Linkheader), with each public method extracting the body shape it expects viasuccess_body(slug:, expected:). - The blank and dot-segment path guards are extracted into a shared
guard_segments!helper and applied to every new endpoint, including thenamethatcreate_repositorysends, so the traversal protections from the step 1 review carry over. - An error body in an unrecognized JSON shape contributes only the values of a small allowlist of conventional human-readable keys (
detail,message,title), rather than a dump of the whole object. The AR error envelope forbids additional properties on every error path, so a JSON body without anerrorkey came from an intermediary such as an auth proxy, whose fields the client cannot vouch for.
This MR combines the previously separate step 2 (listing) and step 3 (write methods, !245812 (closed), now closed) into a single MR, to reduce review round trips and speed up landing.
Client plan (steps 2 and 3): https://gitlab.com/gitlab-org/ops/artifact-registry/-/blob/main/docs/plans/monolith/2026-07-02-ar-ruby-client.md
Related to #605078 (closed) and #605079 (closed).
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist.
How to set up and validate locally
The client has no callers yet. From a Rails console with the AR service running locally on the GDK:
client = ArtifactRegistry::Client.new(current_user: User.first, token_exchange: Class.new { def token_for(_user, _slug) = 'dev-token' }.new)
client.repositories(slug: 'my-org')
client.create_repository(slug: 'my-org', name: 'demo', format: 'maven')
client.delete_repository(slug: 'my-org', name: 'demo')Edited by Rahul Chanila