OneGet / oneget

PackageManagement (aka OneGet) is a package manager for Windows
MIT License
2.38k stars 190 forks source link

Find-Module -AllVersions returns no results when run against internal/private repositories #343

Open bmanikm opened 6 years ago

bmanikm commented 6 years ago

From @dheise on February 13, 2018 15:37

In version 1.1.7 of PowerShellGet, running "find-module <_module_name_> -AllVersions" returns no results when run against private /internal repositories. It does return all versions when run against the powershell gallery.

Version 1.0.0.1 of PowerShellGet that ships with Powershell 5.1 doesn't have this problem. It returns all versions of a module regardless of which repository it is run against.

Expected Behavior

Running find-module <_module_name_> -AllVersions should return all non-prerelease versions of a module from a repository

Current Behavior

find-module <_module_name_> -AllVersions returns nothing, not even the current version. However, runing find-module <_module_name_> without the "-AllVersions" does return the current version, regardless of the type of repository.

Possible Solution

Steps to Reproduce (for bugs)

  1. Create a file share on local or remote computer.
  2. Register the repository
  3. Create a module and publish it to the repository.
  4. Increment build number an publish to the repository
  5. Run find-module -Repository <_my_repository_> will show the current version
  6. Run find-module -Repository <_my_repository_> -AllVersions returns no results.

Context

We rely on being able to find and install previous versions of modules on occasion if we need to test a previous version of code. With this bug, people who have the latest build of PowerShellGet can't use some of our source code tools.

Your Environment


> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.16299.98
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.98
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

> Get-Module
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.0.0    CimCmdlets                          {Export-BinaryMiLog, Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance...}
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script     1.1.7.0    PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-PackageProvider...}
Script     1.6.0      PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability...}
Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PSReadlineKeyHandler, Set-PSReadlineKe...

> Get-Module -ListAvailable PowerShellGet,PackageManagement
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.1.7.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSo
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSo
Script     1.6.0      PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}

> Get-PackageProvider
Name                     Version          DynamicOptions
----                     -------          --------------
Chocolatey               2.8.5.130        SkipDependencies, ContinueOnFailure, ExcludeVersion, ForceX86, PackageSaveMode, FilterOnTag, Contains, AllowPr...
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.210        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions,...
PowerShellGet            1.6.0.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPr...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions
----                     -------          --------------
Chocolatey               2.8.5.130        SkipDependencies, ContinueOnFailure, ExcludeVersion, ForceX86, PackageSaveMode, FilterOnTag, Contains, AllowPr...
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
nuget                    2.8.5.208
NuGet                    2.8.5.210        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions,...
PowerShellGet            1.6.0.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPr...
PowerShellGet            1.0.0.1
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

Copied from original issue: PowerShell/PowerShellGet#230

bmanikm commented 6 years ago

After investigation, I found that this is a regression in 1.1.7.0 version of PackageManagement. PowerShellGet provider returns the results but PackageManagement core in 1.1.7.0 version doesn't return these results.