Loading
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_repositoryandupdate_repositorytake asettingsHash and pass it through uninterpreted. The caller expresses the credential three-state through key presence inside that Hash: an absentcredentialskey leaves the stored values alone, and an explicitnilclears them. Neither method flattens a nestednil.- 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_repositoryraises whensettingsaccompanies akindother thanremote, since an absentkindresolves to hosted, and when a remote create carries nosettings.update_repositoryraises on an explicitnilsettings, since a leading null in that key is refused on every request. test_upstream_connectionposts to.../repositories/:name/testwith no request body, because Artifact Registry answers400to a non-empty one, and returns the verdict as the newArtifactRegistry::ConnectionTestResultvalue object.- A
404from the test route raisesApiErrorrather than resolvingnil. That route exists on remote repositories only, so a hosted or virtual repository is a genuine not-found. The method therefore does not use thenil_on_missinghelper that the read methods use. - A
200whose body carries nopassedkey raisesUnavailableError. It would otherwise read as a probe that found the upstream unreachable, which is a verdict Artifact Registry did not give.ConnectionTestResult#passedreads only a booleantrueas 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}/testand theConnectionTestResultschema inapi/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.rbMR 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