Add name and description fields to Maven virtual registry models and APIs
Context
To match the UI on the virtual registry & upstream pages:
-
name(mandatory) &description(optional) fields need to be added to theVirtualRegistries::Packages::Maven::Registrymodel. -
name(mandatory) &description(optional) fields need to be added to theVirtualRegistries::Packages::Maven::Upstreammodel.
What does this MR do and why?
- Add
name&descriptioncolumns to thevirtual_registries_packages_maven_registries&virtual_registries_packages_maven_upstreamsdatabase tables and the respective model validations. - Update all related Rest API endpoints to accept and expose the new attributes.
- Add a new
PATCH /api/v4/virtual_registries/packages/maven/registries/:idRest API endpoint to update thename&descriptionof the registry. - Add the needed tests.
References
Screenshots or screen recordings
N/A
How to set up and validate locally
-
Enable the feature flag:
Feature.enable(:virtual_registry_maven) -
Have a top level group, a PAT (scope
api) and a GitLab instance with an EE licence ready. -
Let's create a registry and send the
nameanddescription:curl -i \ -H "PRIVATE-TOKEN: <PAT>" \ -H "Content-Type: application/json" \ -d '{"name": "foo", "description": "bar"}' \ -X POST \ "http://gdk.test:3000/api/v4/groups/<group_id>/-/virtual_registries/packages/maven/registries" -
Using the id of the registry we just created, let's create an upstream:
curl -i -H "PRIVATE-TOKEN: <PAT>" --data-urlencode 'url=https://repo.maven.apache.org/maven/' --data-urlencode 'name=foo' --data-urlencode 'description=bar' -X POST http://gdk.test:3000/api/v4/virtual_registries/packages/maven/registries/<registry_id>/upstreams -
Update the
name&descriptionof the created upstream:curl -i \ -H "PRIVATE-TOKEN:<PAT>" \ -H "Content-Type: application/json" \ -d '{"name": "updated name", "description": "updated desc"}' \ -X PATCH \ "http://gdk.test:3000/api/v4/virtual_registries/packages/maven/upstreams/<upstream_id>" -
Update the
name&descriptionof the created registry:curl -i \ -H "PRIVATE-TOKEN:<PAT>" \ -H "Content-Type: application/json" \ -d '{"name": "updated name", "description": "updated desc"}' \ -X PATCH \ "http://gdk.test:3000/api/v4/virtual_registries/packages/maven/registries/<registry_id>" -
Get the details of the registry, the
name&descriptionshould be exposed in the response:curl -H 'PRIVATE-TOKEN: <PAT>' http://gdk.test:3000/api/v4/virtual_registries/packages/maven/registries/<registry_id> | jq -
Get the details of the upstream, the
name&descriptionshould be exposed in the response:curl -H 'PRIVATE-TOKEN: <PAT>' http://gdk.test:3000/api/v4/virtual_registries/packages/maven/upstreams/<upstream_id> | jq
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.
Related to #526198 (closed)