we are working with nexus repository 3.74.0 and having several nuget v3 feeds. We enabled the cleanup policies for some test repositories and want to delete assets which are older than 10 days.
We hosting chocolatey packages on these feeds and when chocolatey is downloading a asset, its creating a /v3/registration//index.json.
When you deleting a asset from the nexus webgui, the index is automatically deleting too.
When you do this over the api with: Invoke-RestMethod -Uri “/repository///” -Method DELETE -Headers @{“Authorization”=“Basic $cred”}
The index will also be deleted correctly.
When you using the cleanup policy, it will delete the asset but not the index.
It sounds like you may have a misconfigured repository, there should only be a single index.json in a Nuget proxy repository in Nexus.
With a NuGet v3 proxy repository the URL used should be to the index.json (e.g. for the NuGet gallery it would be https://api.nuget.org/v3/index.json ).
Generally speaking however, the Cleanup feature in Nexus is built around what we call Components which is nominally coordinates or the identifier for one or more assets. With a nuget v3 repository the index.json file isn’t associated with a Component and is not considered as part of cleanup.
thanks for your reply. Sorry I was not specified enough… We using nuget (hosted) repositories not proxy.
The files under /v3/registration/(assets)/index.json will be created when a chocolatey agent is downloading the asset.
I dunno if there is a difference between proxy and hosted for the v3 index, but what I can say, is that the index will be cleaned/delete when you deleting the asset from the web gui or from the api, but not from a cleanup task.
It looks to me like a bug, but when you say its generally will not be touched from a cleanup policy, then the cleanup policies is unusable for nuget v3 feeds, because it breaks the search/download mechanism for clients. In my case the chocolatey agent is searching and trying to download packages which not existing. In my opinion it should work in the same way when you deleting from web gui or the api.
This still sounds like some sort of misconfiguration, I haven’t looked at NuGet in some time but I believe the only index.json should be at the root of the repository and managed by Nexus. If you take a look at the previous link for the contents this is a service reference file which defines patterns for URLs to access various services on the server.
Is there a chance you’ve configured a raw repository, or something aside from nuget v3?
Hi Matthew,
no im sorry, a raw repository is not supported from chocolatey. I dunno see a misconfiguration here. Again… when you deleting from the web gui, its working… When the cleanup policy is used, its not working. Maybe my wording is the problem Microsoft decscribes that as the “registration page” for nuget v3 specification: Package Metadata, NuGet API | Microsoft Learn
For better understanding I recorded a video to demonstrate the issue:
Thanks for the video - I hadn’t interacted with the metadata shown here before. After checking the contents it does appear that this metadata ought to be removed when there are no packages with that particular packageId remaining.