Closed sean-r-williams closed 2 months ago
The problem appears to lie within V2ServerAPICalls::FindVersionGlobbing()
, specifically the part that builds filter queries here.
Around line 1145, the filter query builder switches from conditionally prepending andOperator
(based on whether the filter parameter appears to be null) to always adding it. In the specific case of Artifactory, we skip adding the package ID on line 1143 so adding an and
isn't appropriate. Line 1153 appears to be the specific area of issue, but L1145 looks like it'd hit another edge-case.
(FWIW, troubleshooting this was significantly impeded by vagueness in the error returned from Install-PSResource. There's no .InnerException
, and only the outer package name is shown.)
I could file a PR to further conditionalize prepending andOperator
in L1145 and L1153, but holistically speaking V2ServerAPICalls
and NuGetServerAPICalls
spend a lot of effort trying to build filters (and the URLs containing them) using the repeated-concatenation approach we see currently.
HDWF about adjusting V2ServerAPICalls
and NuGetServerAPICalls
to offload this to String.Join()
with a List<String>
of criteria? Moving to something like HttpValueCollection
would also reduce the effort to aggregate filter/pagination and other query parameters. (example here)
@SydneyhSmith Can some engineering resources from your team weigh in here? I'm happy to submit PRs for either option, but I want to make effective use of your team's (and my) time on this.
Continually patching fencepost-type problems in the NuGet v2 query builders (both in V2Server
and NugetServer
) is going to spend a lot of time. Our team can't move to NuGet v3 until PSGallery supports it (as Artifactory doesn't translate v2/v3 when making proxied calls through a remote feed) so we need NuGet v2 to work as-expected in scenarios like this.
We're encountering internal scenarios where we need proper dependency support on module/script install, so this is of particular importance to us right now.
@sean-r-williams thanks for creating this issue and providing such a detailed report, it was helpful for us to see what is happening. We think a few things will be helpful:
@anamnavi Thanks for the insight. I'll submit two PRs in this case:
V2ServerAPICalls
and NugetServerAPICalls
to use a new class for constructing NuGet v2 API queries in an object-oriented manner. (I filed #1643 to track the work needed here)@anamnavi Both PRs have been filed. If your team would like more time to review #1645, can you prioritize merging #1644 into the next patch release? #1644 is a smaller band-aid that should be easier to integrate in the short term.
Again, this completely breaks PSResourceGet on module/script packages that declare dependencies with Artifactory. We're just starting to migrate packages with nontrivial dependencies - engineers not being able to pull said packages back out of Artifactory is impacting their work.
Prerequisites
Steps to reproduce
Microsoft.Graph.Teams
, which depends onMicrosoft.Graph.Authentication
)Expected behavior
Actual behavior
Error details
Environment data
Visuals
Running the command with
$DebugPreference="Continue"
yields the following:The request URL is the problem here. The string
and NormalizedVersion ge '2.17.0' and NormalizedVersion le '2.17.9'
is not a valid OData filter.