Update-PSResource: Include local-copy prerelease string when deciding update applicability#1954
Conversation
…cope determination
|
@sean-r-williams re this
I'd just write a test against the available PSResourceGet versions as opposed to creating other test modules for this as PSResourceGet does have pre-release and non-prerelease versions as I can't see the team delisting a version unless really needed |
anamnavi
left a comment
There was a problem hiding this comment.
thanks for this bugfix @sean-r-williams and my apologies for the delay in getting to it! I've linked the upstream branch/PR here where I'm running tests, but you'll notice I've published the module version as you mentioned and added a test. You'll want to rebase your branch and add that test, thanks!
PR Summary
This PR updates
Microsoft.PowerShell.PSResourceGet.Cmdlets.UpdatePSResourceto consider a locally-installed resource's prerelease string when comparing against the repository's available versions.Fixes #1953.
PR Context
Currently,
Update-PSResourceonly considers the locally-installed resource's version component from thePSResourceInfo.Versionfield, of typeSystem.Version. This struct doesn't include prerelease strings -PSResourceInfo.Prereleasecontains those.This means that if I have:
1.0.1-pre1.0.1...then
Update-PSResourcewill mistakenly mark the locally-installed version as "up to date".JiraPS, which recently released
2.15.0(having previously released2.15.0-alpha1in 2024), falls into this bucket.This behavior needs a test. Publishing a test module to Gallery with a prerelease, then normal-release version (i.e.
1.0.1-preand1.0.1) would be enough to test this behavior.If someone from the Gallery team can publish a test module, I'm happy to contribute a test to
test\UpdatePSResourceTests\UpdatePSResourceV2.Tests.ps1as part of this PR.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.