PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

Request for `Find-PSResource *` on GitHub packages

Open youngturk2 opened this issue 2 years ago • 1 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest released version
  • [X] Search the existing issues.

Steps to reproduce

So, I would say that this is very similar in nature to issue #520. but it appears that the behavior of psresourceget has changed since this issue was posted 2 years ago, so I figured I would submit this issue with the updated problems. I am using github packages to host several powershell modules, and I have noticed that find-psresource behaves in a very inconsistent manner. When you attempt to run the below powershell command:

Find-psresource -Name * -Credential $CRED -Repository github

You see the below error message:

image

However, if the wildcard is part of a string, then psresourceget has no problem searching for and returning multiple modules that match that more specific string. So, for example, when I run the below command:

find-psresource -Name *oseries* -Credential $CRED -Repository github

This is the return:

image

There is absolutely no reason why the first command should fail if the second runs just fine.

Expected behavior

Find-psresource -Name * -Credential $CRED -Repository github

## List all modules/scripts published to the specified repository

Actual behavior

find-psresource -Name * -Credential $CRED -Repository github
Find-PSResource: Find all is not supported for the V3 repository Github

Error details

Get-error

Exception             :
    Type    : System.InvalidOperationException
    Message : Find all is not supported for the V3 repository Github
    HResult : -2146233079
TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.FindHelper
CategoryInfo          : InvalidOperation: (Microsoft.PowerShel….Cmdlets.FindHelper:FindHelper) [Find-PSResource],
InvalidOperationException
FullyQualifiedErrorId : FindAllFail,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource
InvocationInfo        :
    MyCommand        : Find-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 5
    Line             : find-psresource -Name * -Credential $CRED -Repository github
    PositionMessage  : At line:1 char:1
                       + find-psresource -Name * -Credential $CRED -Repository github
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : find-psresource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

PS> Get-Module microsoft.powershell.PSResourceGet; $PSVersionTable | format-table

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     0.5.22     beta22     Microsoft.PowerShell.PSResourceGet  {Find-PSResource, Get-InstalledPSResource, Get-PSReso…


Name                           Value
----                           -----
PSVersion                      7.3.4
PSEdition                      Core
GitCommitId                    7.3.4
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

youngturk2 avatar Jun 26 '23 19:06 youngturk2

Thanks for opening this issue @youngturk2

We initially made this decision because of limitations that make this type of search "find all" not possible for nuget gallery and azure dev ops, due to factors like it being an expensive call, api support, and potential calls to upstream sources...however we already special case GitHub packages in these calls so we could enable find all for GH packages

SydneyhSmith avatar Jun 29 '23 18:06 SydneyhSmith