Add Nuget package authors, description & published to information returned with a package
What does this MR do and why?
Currently, when viewing a list of NuGet packages from a Gitlab Package registry, important package metadata such as authors
& description
is not returned.
This MR is creating two new columns (authors
& description
) in the packages_nuget_metadata
table. Once a package is uploaded to the GitLab registry, we extract the metadata from the .nuspec
file and store them in the database.
That newly added metadata authors
& description
can be fetched in the following 3 NuGet endpoints:
A new piece of information is also added: the published
property which is added to the package's catalogEntry
property. This is useful when displaying a list of NuGet packages in visual studio so the developer can see when a package is published.
Screenshots or screen recordings
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Download Visual Studio.
- Create a new
.net
empty project in Visual Studio. - In the Solution Explorer, right-click on the project or the solution and select "Manage NuGet Packages".
- This will open the "NuGet Package Manager" window, which displays the packages installed in the project and allows you to browse and search for new packages.
- At the bottom of the "NuGet Package Manager" window, select "Configure Sources" in the "Package source" dropdown menu.
- In the opened "Sources" window, click on "Add". This will open a new "Add Package Source" window. Fill in the details of your local GitLab instance as follows:
- Name: any name would work. ex: 'gitlab', 'gdk'.
- Location: http://gdk.test:3000/api/v4/projects/your_project_id/packages/nuget/index.json
- Username: your username on GitLab instance: ex: 'root'
- Password: your PAT
- Publish a new NuGet package.
- After successfully publishing the package, go back to Visual Studio's NuGet Package Manager, you should find your published package with the new metadata visible as in the above screenshot.
- You can also test using NuGet API and query the 3 endpoints mentioned above (Metadata Service, Version Metadata Service, Search Service)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #273532 (closed)