PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
485 stars 92 forks source link

Github Packages no longer working in Release 3.0.21 #1149

Closed adrian-andersson closed 1 year ago

adrian-andersson commented 1 year ago

Prerequisites

Steps to reproduce

Using a private Github Packages repository with existing modules, and the latest version of PowerShellGet, downloading and saving a module errors with an invalid API Version

Save-PSResource:
Line |
 125 |  …             Save-PSResource -Repository $repositoryName -Name $module …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Repository PowerShelf has unknown API Version.

This was working fine in version 3.0.19

Expected behavior

Save-PSResource does not result in an unknown API Version when using GH Packages

Actual behavior

As per Description

Error details

No response

Environment data

Tested on Windows Server 2016 and 2022:

S C:\> Get-Module PowerShellGet; $PSVersionTable

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     3.0.21     beta21     PowerShellGet                       {Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository, Get-PSScriptFileInfo…}

Key   : PSVersion
Value : 7.3.2
Name  : PSVersion

Key   : PSEdition
Value : Core
Name  : PSEdition

Key   : GitCommitId
Value : 7.3.2
Name  : GitCommitId

Key   : OS
Value : Microsoft Windows 10.0.20348
Name  : OS

Key   : Platform
Value : Win32NT
Name  : Platform

Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions

Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion

Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion

Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion


### Visuals

_No response_
SydneyhSmith commented 1 year ago

Thanks @adrian-andersson we investigated the issue and realized it was likely due to some special casing we introduced for performance for nugget gallery, should be fixed in future releases, we may get out a release quick to ship in PowerShell 7.4 preview timeline so we may not get the PR out in time for that release, but if not it should be out in the next few weeks for the following beta

adrian-andersson commented 1 year ago

Hi @SydneyhSmith thanks for the prompt response, love your work as always. Will pin module 3.0.19 in place until fix is available.

If there are any other ways I can help make GH Packages a first-class citizen here please let me know, happy to test, provide feedback etc,

For example, one of the bigger pain points is actually publishing to GH Packages because of the required Repository URI, my workaround is to publish to a temporary local disk repository, uncompress the nuspec, directly inject the URI via importing the XML and using XPATH, saving it, then using dotnet nuget to push the recompressed Nuget package up to github. This works, but is far from ideal

SydneyhSmith commented 1 year ago

@adrian-andersson thanks for the feedback on publishing as well, I will open an issue to track that we need to improve that experience, and test better against it

alerickson commented 1 year ago

This will be resolved with PR #1167