Closed johlju closed 1 year ago
@gaelcolas There were a lot of issue running the pipeline script in Windows PowerShell on a newly installed Windows 11. This change solves all the issues I found. I will also update the guide at dscommunity.org.
Merging #419 (36b3470) into main (91f40fe) will increase coverage by
0%
. The diff coverage is100%
.
@@ Coverage Diff @@
## main #419 +/- ##
===================================
Coverage 81% 81%
===================================
Files 44 44
Lines 2317 2319 +2
===================================
+ Hits 1897 1899 +2
Misses 420 420
Impacted Files | Coverage Δ | |
---|---|---|
Sampler/suffix.ps1 | 100% <100%> (ø) |
Although, there is one issue I cannot solve in Windows PowerShell, I will document it instead.
After PowerShellGet 2.2.5 and new PackageManagement is saved it is not possible to resolve pre-release dependencies other than starting a fresh session. Even after removing the PowerShellGet and PackageMangement module (and I verified none was imported in session) and importing the latest version of both module PowerShellGet still uses the old PackageManagement module. It results in the error
Find-Module : A parameter cannot be found that matches parameter name 'AllowPrereleaseVersions'
because PowerShellGet calls Find-Package
in the old version. After restarting the session the build script works like it should again. Very annoying. I can't figure out what keeps the old version lingering around when it is not loaded into the session. Only conclusion is that it is an assembly that is loaded that does not get removed (becuase it can't remove assemblies) when removing the module PackageManagement.
This is only an issue for repos that has pre-releases specified in RequiredModules.ps1.
Added PR https://github.com/dsccommunity/dsccommunity.org/pull/209 to change the docs.
Fixed thd comments, ready for review again. 🙂
.... but build is failing, probably due to new ModuleBuilder
... 😞
Added a fix for the aliases since the module creates aliases dynamically during import and should not define them in module manifest.
Even after removing the PowerShellGet and PackageMangement module and importing the latest version of both module PowerShellGet still uses the old PackageManagement module.
Yep, just looked at that and I can't find a way either. Wonder if we should make the checks/bootstrap on another runspace so that when we're done we can directly import the correct version. I don't know how practical that would be though.
Maybe it is possible to do this as the first step and do it in a Start-Job
so that the install module stuff runs in other session 🤔 I could give it a try. Not sure how runspaces works so will need to investigate. Would be great to find a solution, because its a bit annoying to have that "bug". 🙂
@gaelcolas I started looking at it, but then I saw that the new preview of PowerShellGet v3 remove the dependence on NuGet. So I'm thinking we merge tis as-is, then instead work on implementing support for PSGet v3 preview instead.
Good point. Will also talk to you later about this.
Pull Request
Pull Request (PR) description
Changed
AllowOldPowerShellGetModule
(still not recommended to use this parameter).output/RequiredModules
(same logic as for module PSDepend) to not make permanent changes to the contributors machine. If parameterPSDependTarget
is either set toCurrentUser
orAllUsers
the modules are installed.Fixed
Get-PackageProvider
no longer throws an exception when NuGet provider is missing (in Windows PowerShell in a clean Windows install).Install-PackageProvider
now defaults to installing in the current user scope to avoid requiring an elevated prompt. This is the only change that is permanent on the contributors machine. It is not possible to avoid this as long at the module PowerShellGet requires the NuGet package provider.AllowPrerelease
when installing package provider.Install-PackageProvider
to run.AllowOldPowerShellGetModule
when loading PowerShellGet module version.Write-Progress
statement.Task list
build.ps1 -ResolveDependency
).This change is