Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to update PSResourceGet via Artifactory remote repo #1656

Open
3 tasks done
sean-r-williams opened this issue May 15, 2024 · 3 comments
Open
3 tasks done

Unable to update PSResourceGet via Artifactory remote repo #1656

sean-r-williams opened this issue May 15, 2024 · 3 comments

Comments

@sean-r-williams
Copy link
Contributor

sean-r-williams commented May 15, 2024

Prerequisites

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

Steps to reproduce

  • Configure Artifactory with a remote repository targeting PSGallery.
  • Connect PSResourceGet to this repository. (Because PSGallery is v2-only, the connection to Artifactory within PSResourceGet must also be v2).
  • Update PSResourceGet with Update-PSResource Microsoft.PowerShell.PSResourceGet.

Expected behavior

PS> Update-PSResource Microsoft.PowerShell.PSResourceGet
PS> # update completes without issues

Actual behavior

PS> update-psresource Microsoft.PowerShell.PSResourceGet -Repository Artifactory
update-psresource : Package does not exist on the server
At line:1 char:1
+ update-psresource Microsoft.PowerShell.PSResourceGet -Repository Arti ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...lets.FindHelper:FindHelper) [Update-PSResource], ResourceNotFoundException
    + FullyQualifiedErrorId : FindNameConvertToPSResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.UpdatePSResource

Error details

No response

Environment data

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.0.4.1               Microsoft.PowerShell.PSResourceGet  {Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository, Get-PSScriptFileInfo…}


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

Visuals

This seems to be the combination of two separate issues:

  • PSResourceGet changes behavior in calls like FindPackageById() if we detect the upstream repo is a JFrog repo. After discussing with JFrog support, they confirmed that NuGet calls like this are being passed unfettered to the upstream. This means that PSGallery is receiving subtly different API call parameters when it's being reflected through Artifactory.
  • PSGallery, if provided with the exact filter string IsLatestVersion, is returning unexpected results. I filed filter IsLatestVersion returns invalid response for package Microsoft.PowerShell.PSResourceGet PowerShellGallery#273 to track this.
@sean-r-williams
Copy link
Contributor Author

sean-r-williams commented May 15, 2024

I see three options here:

@sean-r-williams
Copy link
Contributor Author

sean-r-williams commented May 23, 2024

@alerickson @SydneyhSmith This bug isn't something I can directly contribute a fix for since we're running up against [unexpected] behavior in the Gallery.

Can someone from your team take a look here?

We originally engaged JFrog support for this and have some line of dialogue with their R&D. (JFrog folks, see ticket #296792) If we need to get adjustments made in JFrog to align its behavior with other servers (thus obviating the need for quirk flags in this space), now would be an excellent time to do so.

Alternatively, if your team is comfortable with munging the filter (i.e. convert from IsLatestVersion to IsLatestVersion eq true, add a space to the front of the string, etc.), I can cut a PR for that (with the understanding that it will decrease legibility of the codebase).

@anamnavi
Copy link
Member

As mentioned in this issue, we're going to look into the Gallery codebase to see what is happening and if we can't safely make the change there then we'll open a fix client side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants