ARTIFACTORY: Nuget virtual is showing different metadata than the remote when the remote repository is offline

ARTIFACTORY: Nuget virtual is showing different metadata than the remote when the remote repository is offline

Products
Frog_Artifactory
Content Type
Use_Case
AuthorFullName__c
Alec Choy
articleNumber
000006345
ft:sourceType
Salesforce
FirstPublishedDate
2025-02-03T12:35:03Z
lastModifiedDate
2025-02-04
VersionNumber
3
Introduction 

When offlining a remote repository in Artifactory, the virtual repository containing the remote repository may show inconsistent metadata. This behavior is especially noticeable with NuGet repositories where certain versions disappear or fail to display after the remote repository is offlined.

This article will walk you through troubleshooting and resolving the issue of missing metadata in a NuGet virtual repository when its associated remote repository is offlined. The solution involves modifying the Artifactory system property to prevent caching inconsistencies during searches.


Resolution 

1.    Set Up the Remote and Virtual Repositories
    •    Create a remote repository in Artifactory pointing to https://powershellgallery.com and name it powershell.
    •    Create a virtual repository and include the powershell remote repository in it. Name the virtual repository powerShell-virtual.

2.    Configure the PowerShell Repository on a Windows VM
    •    Run the following commands to register the repositories:
Register-PSRepository -Name "powershell" `
    -SourceLocation "https://<art-url>/artifactory/api/nuget/powershell" `
    -PublishLocation "https://<art-url>/artifactory/api/nuget/powershell" `
    -InstallationPolicy Trusted

Register-PSRepository -Name "powershell-virtual" `
    -SourceLocation "https://<art-url>/artifactory/api/nuget/powershell-virtual" `
    -PublishLocation "https://<art-url/artifactory/api/nuget/powershell-virtual" `
    -InstallationPolicy Trusted
3.    Search for NuGet Package Versions
    •    Execute the following command to list all versions of the package pspas in the remote repository
find-module -Name pspas -AllVersions -Repository powershell
Version              Name                                Repository           Description
-------              ----                                ----------           -----------
6.4.85               psPAS                               powershell           Module for CyberArk Privileged Access Security Web Service REST API
6.4.80               psPAS                               powershell           Module for CyberArk Privileged Access Security Web Service REST API
6.3.78               psPAS                               powershell           Module for CyberArk Privileged Access Security Web Service REST API
6.2.68               psPAS                               powershell           Module for CyberArk Privileged Access Security Web Service REST API
6.1.62               psPAS                               powershell           Module for CyberArk Privileged Access Security Web Service REST API
6.1.50               psPAS                               powershell           Module for CyberArk Privileged Access Security Web Service REST API
4. The next step, I offline the remote repository 'powershell' in the repository basic settings and then I run the search against the 'powershell-virtual' again.
The virtual repository does not show the correct metadata.

User-added image 

find-module -n pspas -allversions
Version              Name                                Repository           Description
-------              ----                                ----------           -----------
4.0.0                psPAS                               powershell-virtual   Module for CyberArk Privileged Access Security Web Service REST API
3.5.8                psPAS                               powershell-virtual   Module for CyberArk Privileged Access Security Web Service REST API
3.5.0                psPAS                               powershell-virtual   Module for CyberArk Privileged Access Security Web Service REST API
Conclusion

To ensure that the virtual repository is showing the correct metadata even when the remote repository is offline, please add the following system property in the artifactory.system.properties file. Perform an Artifactory restart to have the changes take effect and then the virtual repository should show the correct metadata.
artifactory.nuget.v2.search.cache.enabled=false