Extend Artifact Registry client with remote settings and a connection test

What does this MR do and why?

ArtifactRegistry::Client cannot send a remote repository's settings and cannot probe its upstream, so the remote create, edit, and test surfaces have no transport to call.

  • create_repository and update_repository take a settings Hash and pass it through uninterpreted. The caller expresses the credential three-state through key presence inside that Hash: an absent credentials key leaves the stored values alone, and an explicit nil clears them. Neither method flattens a nested nil.
  • Both methods refuse the two calls Artifact Registry rejects unconditionally, so a caller gets a message naming the reason rather than an opaque 400. create_repository raises when settings accompanies a kind other than remote, since an absent kind resolves to hosted, and when a remote create carries no settings. update_repository raises on an explicit nil settings, since a leading null in that key is refused on every request.
  • test_upstream_connection posts to .../repositories/:name/test with no request body, because Artifact Registry answers 400 to a non-empty one, and returns the verdict as the new ArtifactRegistry::ConnectionTestResult value object.
  • A 404 from the test route raises ApiError rather than resolving nil. That route exists on remote repositories only, so a hosted or virtual repository is a genuine not-found. The method therefore does not use the nil_on_missing helper that the read methods use.
  • A 200 whose body carries no passed key raises UnavailableError. It would otherwise read as a probe that found the upstream unreachable, which is a verdict Artifact Registry did not give. ConnectionTestResult#passed reads only a boolean true as reachable, for the same reason.

Backend only. Nothing calls either addition yet, so there is no user-visible change. Every caller is gated by the artifact_registry_ui feature flag, which is default off. The client itself is not gated. No changelog entry, and no strings to externalize.

References

  • Issue: #618512 (closed)
  • Contract: POST /api/v1/{slug}/repositories/{repository_name}/test and the ConnectionTestResult schema in api/openapi/v1.yaml

How to set up and validate locally

There is no UI to drive. Run the specs:

bundle exec rspec ee/spec/lib/artifact_registry/client_spec.rb ee/spec/lib/artifact_registry/connection_test_result_spec.rb

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rahul Chanila

Merge request reports

Loading
Loading