Open oed-metzb opened 1 year ago
Thanks for opening the issue @oed-metzb we are looking into it
Additional information: The same behavior also occurs with Install-PSResource.
PS> Install-PSResource Microsoft.PowerShell.SecretManagement -Repository PSGallery-Proxy -TrustRepository -Debug -Verbose
VERBOSE: All paths to search: 'C:\Users\Administrator\Documents\WindowsPowerShell\Modules'
VERBOSE: All paths to search: 'C:\Users\Administrator\Documents\WindowsPowerShell\Scripts'
VERBOSE: Retrieving directories in the path 'C:\Users\Administrator\Documents\WindowsPowerShell\Modules'
VERBOSE: Retrieving directories in the path 'C:\Users\Administrator\Documents\WindowsPowerShell\Scripts'
DEBUG: In GetHelper::GetPackagesFromPath()
DEBUG: In GetHelper::FilterPkgPathsByName()
DEBUG: In GetHelper::FilterPkgPathsByVersion()
DEBUG: In InstallPSResource::ProcessInstallHelper()
DEBUG: In InstallHelper::BeginInstallPackages()
DEBUG: Parameters passed in >>> Name: 'Microsoft.PowerShell.SecretManagement'; VersionRange: ''; NuGetVersion: ''; VersionType: 'NoVersion'; Version: ''; Prerelease: 'False'; Repository: 'PSGallery-Proxy'; AcceptLicense: 'False'; Quiet: 'False'; Reinstall:
'False'; TrustRepository: 'True'; NoClobber: 'False'; AsNupkg: 'False'; IncludeXml 'True'; SavePackage 'False'; TemporaryPath ''; SkipDependencyCheck: 'False'; AuthenticodeCheck: 'False'; PathsToInstallPkg:
'C:\Users\Administrator\Documents\WindowsPowerShell\Modules,C:\Users\Administrator\Documents\WindowsPowerShell\Scripts'; Scope 'CurrentUser'
DEBUG: In InstallHelper::ProcessRepositories()
VERBOSE: Attempting to search for packages in 'PSGallery-Proxy'
DEBUG: In InstallHelper::InstallPackages()
DEBUG: In InstallHelper::InstallPackage()
DEBUG: In V2ServerAPICalls::FindName()
DEBUG: In V2ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://nexus.domain/repository/psgallery-proxy/FindPackagesById()?id='Microsoft.PowerShell.SecretManagement'&$inlinecount=allpages&$filter=IsLatestVersion and Id eq 'Microsoft.PowerShell.SecretManagement''
VERBOSE: Attempting to delete 'C:\Users\Administrator\AppData\Local\Temp\2\af43e635-c4cb-4910-beff-ede455034cb2'
VERBOSE: Successfully deleted 'C:\Users\Administrator\AppData\Local\Temp\2\af43e635-c4cb-4910-beff-ede455034cb2'
Install-PSResource : Object reference not set to an instance of an object.
At line:1 char:1
+ Install-PSResource Microsoft.PowerShell.SecretManagement -Repository ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-PSResource], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
When I call the URL from the debug information, I get the following response:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<feed xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom" xml:base="https://nexus.domain/repository/psgallery-proxy/">
<title type="text">FindPackagesById</title>
<id>https://nexus.domain/repository/psgallery-proxy/FindPackagesById</id>
<updated>2023-11-20T08:55:28.149Z</updated>
<link rel="self" title="FindPackagesById" href="FindPackagesById"/>
<m:count>1</m:count>
<entry>
<id>https://nexus.domain/repository/psgallery-proxy/Packages(Id='Microsoft.PowerShell.SecretManagement',Version='1.1.2')</id>
<title type="text">Microsoft.PowerShell.SecretManagement</title>
<summary type="text" m:null="true"/>
<updated>2023-11-20T09:46:58.487Z</updated>
<author>
<name>Microsoft Corporation</name>
</author>
<link rel="edit-media" title="V2FeedPackage" href="Packages(Id='Microsoft.PowerShell.SecretManagement',Version='1.1.2')/$value"/>
<link rel="edit" title="V2FeedPackage" href="Packages(Id='Microsoft.PowerShell.SecretManagement',Version='1.1.2')"/>
<category term="NuGetGallery.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
<content type="application/zip" src="https://nexus.domain/repository/psgallery-proxy/Microsoft.PowerShell.SecretManagement/1.1.2"/>
<m:properties>
<d:Version>1.1.2</d:Version>
<d:Copyright>(c) Microsoft Corporation. All rights reserved.</d:Copyright>
<d:Created m:type="Edm.DateTime">2022-01-27T18:16:33.530Z</d:Created>
<d:Dependencies/>
<d:Description> This module provides a convenient way for a user to store and retrieve secrets. The secrets are stored in registered extension vaults. An extension vault can store secrets locally or remotely. SecretManagement coordinates access to the secrets through the registered vaults. Go to GitHub for more information about the module and to submit issues: https://github.com/powershell/SecretManagement </d:Description>
<d:DownloadCount m:type="Edm.Int32">568807</d:DownloadCount>
<d:GalleryDetailsUrl>https://www.powershellgallery.com/packages/Microsoft.PowerShell.SecretManagement/1.1.2</d:GalleryDetailsUrl>
<d:IconUrl m:null="true"/>
<d:IsLatestVersion m:type="Edm.Boolean">true</d:IsLatestVersion>
<d:IsAbsoluteLatestVersion m:type="Edm.Boolean">true</d:IsAbsoluteLatestVersion>
<d:IsPrerelease m:type="Edm.Boolean">false</d:IsPrerelease>
<d:Published m:type="Edm.DateTime">2022-01-27T18:16:33.530Z</d:Published>
<d:Language m:null="true"/>
<d:LicenseUrl>https://github.com/PowerShell/SecretManagement/blob/master/LICENSE</d:LicenseUrl>
<d:PackageHash>Y1BTgdI/Y48pYLwZdJFmfzPoySGbURC3LD6UgJEMd/S3ShjeY0ukrH4BaidHkuoDqXiz7gWuro84tkatAF6jYQ==</d:PackageHash>
<d:PackageHashAlgorithm>SHA512</d:PackageHashAlgorithm>
<d:PackageSize m:type="Edm.Int64">84356</d:PackageSize>
<d:ProjectUrl>https://github.com/powershell/secretmanagement</d:ProjectUrl>
<d:ReportAbuseUrl>https://www.powershellgallery.com/packages/Microsoft.PowerShell.SecretManagement/1.1.2/ReportAbuse</d:ReportAbuseUrl>
<d:ReleaseNotes m:null="true"/>
<d:RequireLicenseAcceptance m:type="Edm.Boolean">false</d:RequireLicenseAcceptance>
<d:Tags>PSModule PSEdition_Core PSCmdlet_Register-SecretVault PSCommand_Register-SecretVault PSCmdlet_Unregister-SecretVault PSCommand_Unregister-SecretVault PSCmdlet_Get-SecretVault PSCommand_Get-SecretVault PSCmdlet_Set-SecretVaultDefault PSCommand_Set-SecretVaultDefault PSCmdlet_Test-SecretVault PSCommand_Test-SecretVault PSCmdlet_Set-Secret PSCommand_Set-Secret PSCmdlet_Set-SecretInfo PSCommand_Set-SecretInfo PSCmdlet_Get-Secret PSCommand_Get-Secret PSCmdlet_Get-SecretInfo PSCommand_Get-SecretInfo PSCmdlet_Remove-Secret PSCommand_Remove-Secret PSCmdlet_Unlock-SecretVault PSCommand_Unlock-SecretVault PSIncludes_Cmdlet</d:Tags>
<d:Title m:null="true"/>
<d:VersionDownloadCount m:type="Edm.Int32">477864</d:VersionDownloadCount>
</m:properties>
</entry>
</feed>
Adding this comment here to help with adding CI tests for this scenario: https://github.com/PowerShell/PSResourceGet/issues/1536#issuecomment-1907957488
I can confirm that this still doesn't work, using PSResourceGet 1.0.5 and nexus repository PRO 3.68.1-02
.
PSResourceGet ends up making a request such as https://nexus-repository.domain.com/repository/powershell/FindPackagesById()?$filter=Id+eq+%27MyPackage%27+and+NormalizedVersion+eq+%271.0.50%27&$inlinecount=allpages&id=%27MyPackage%27
for MyPackage version 1.0.50
The repository server seems to not support that query syntax, and instead it returns metadata xml for a bunch of unrelated packages. PowerShellGet on the other hand just requests /FindPackagesById()?id=%27MyPackage%27
which works fine.
I haven't tried it with the latest preview-2
release, but I tried a different approach.
Simple install NexusIQ with choco install nexus-repository
. When it is finished up, set the admin password. You can add the source when you have the dotnet.exe
by running: dotnet nuget add source http://localhost:8081/repository/nuget-hosted --name NexusIQ --username --password
.
With the new Compress-PSResource
, the .nupkg
file is generated. You can push this with dotnet nuget push
.
It's not natively PSResourceGet, but a combination of both. There is a PowerShell module (NexuShell) where you can interact with NexusIQ. Would love to see the support for NexusIQ in the future.
Prerequisites
Steps to reproduce
We are trying Sonatype Nexus as a Nuget feed provider and with PowerShellGetV2 we were already able to reach the repository. With PSResourceGet 1.0.0 it is unfortunately no longer possible to use the same repository.
Register the Repository
Repository type will not be detected by default and set to unknown
Set ApiVersion to v2
Try to find the Module again
Expected behavior
Actual behavior
Error details
Environment data
Visuals
No response