OneGet / oneget

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

Register-packagesource for Artifactory throws not valid for this provider #285

Closed leovic0101 closed 7 years ago

leovic0101 commented 7 years ago

Hi All,

I setup a Nuget repository for chocolatey in Artifactory. My goal is to use Artifactory as proxy to chocolatey. However. registering the package source throws a validation error. If I register the repository as a Nuget provider it is able to download the packages with no problem but does not install it the way chocolatey does.

I would greatly appreciate your assistance.

Below are the steps I have taken and the versions I am using:

PS C:\windows\system32> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.14409.1005
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14409.1005
CLRVersion                     4.0.30319.34014
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PS C:\windows\system32> get-packageprovider

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.208        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

PS C:\windows\system32> get-packagesource

Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
PSGallery                        PowerShellGet    True       https://www.powershellgallery.com/api/v2/

PS C:\windows\system32> install-packageprovider -name chocolatey

Name                           Version          Source           Summary
----                           -------          ------           -------
chocolatey                     2.8.5.130        https://onege... ChocolateyPrototype provider for the OneGet meta-pa...

PS C:\windows\system32> get-packagesource

Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
PSGallery                        PowerShellGet    True       https://www.powershellgallery.com/api/v2/
chocolatey                       Chocolatey       False      http://chocolatey.org/api/v2/

PS C:\windows\system32> $cred = get-credential

PS C:\windows\system32> register-packagesource -providername chocolatey -name LocalChoco -Location "http://vmw12r2artrep
.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget" -force -ForceBootstrap -Trusted -Credential $cred -verbose

VERBOSE: Performing the operation "Register Package Source." on target "Package Source 'LocalChoco'
(http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget) in provider 'chocolatey'.".
register-packagesource : Source location
'http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget' is not valid for this provider.
At line:1 char:1
+ register-packagesource -providername chocolatey -name LocalChoco -Loc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (LocalChoco:String) [Register-PackageSource], Exception
    + FullyQualifiedErrorId : SourceLocationNotValid_Location,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterP
   ackageSource

Also, I ran debug mode and below is the trace:


PS C:\windows\system32> **register-packagesource -providername chocolatey -name LocalChoco -Location "http://vmw12r2artrep
.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget" -force -ForceBootstrap -Trusted -Credential $cred -verbose -debug**
DEBUG: 00:00:00.0000003 Calling 'Chocolatey::GetDynamicOptions' 'Provider'

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): y
DEBUG: 00:00:00.0046091 Calling 'Chocolatey::GetDynamicOptions' 'Source'

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): y
DEBUG: 00:00:02.3899311 Calling 'Chocolatey::ResolvePackageSources'

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): y
DEBUG: 00:00:02.3903063 Yielding packge source for chocolatey at location http://chocolatey.org/api/v2/

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): y

Confirm
Are you sure you want to perform this action?
Performing the operation "Register Package Source." on target "Package Source 'LocalChoco'
(http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget) in provider 'chocolatey'.".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
DEBUG: 00:00:04.6194281 Calling 'Chocolatey::AddPackageSource'
'LocalChoco','http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget','True'

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): y

Confirm
Source location 'http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget' is not valid for this
provider.
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): y
register-packagesource : Source location
'http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget' is not valid for this provider.
At line:1 char:1
+ register-packagesource -providername chocolatey -name LocalChoco -Loc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (LocalChoco:String) [Register-PackageSource], Exception
    + FullyQualifiedErrorId : SourceLocationNotValid_Location,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterP
   ackageSource

If I register it as a Nuget provider, then it is able to work. But, executing the install-package only downloads and unpacks the package but it does not actually install like what chocolatey does.


PS C:\windows\system32> register-packagesource -providername NuGet -name LocalNuget -Location "http://vmw12r2artrep.lab.
pilgrimquality.com:8081/artifactory/api/nuget/nuget" -force -ForceBootstrap -Trusted -Credential $cred -verbose

VERBOSE: Performing the operation "Register Package Source." on target "Package Source 'LocalNuget'
(http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget) in provider 'NuGet'.".
VERBOSE: Source 'LocalNuget' is validated.
VERBOSE: Saving a config with a file path 'C:\Users\Administrator\AppData\Roaming\NuGet\nuget.config'.

Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
LocalNuget                       NuGet            True       http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifa...

PS C:\windows\system32> get-packagesource

Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
LocalNuget                       NuGet            True       http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifa...
PSGallery                        PowerShellGet    True       https://www.powershellgallery.com/api/v2/
chocolatey                       Chocolatey       False      http://chocolatey.org/api/v2/

PS C:\windows\system32> find-package FireFox -Credential $cred -ProviderName Nuget

Name                           Version          Source           Summary
----                           -------          ------           -------
Firefox                        53.0.3           LocalNuget       Bringing together all kinds of awesomeness to make ...

PS C:\windows\system32> find-package FireFox -Credential $cred -ProviderName Nuget | Install-package -verbose -credentia
l $cred

VERBOSE: Performing the operation "Install Package" on target "Package 'Firefox' version '53.0.3' from 'LocalNuget'.".
VERBOSE: Searching repository
'http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget/FindPackagesById()?id='Firefox'' for ''.
VERBOSE: Searching repository
'http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget/FindPackagesById()?id='chocolatey-core.ex
tension'' for ''.
VERBOSE: InstallPackage' - name='chocolatey-core.extension', version='1.3.0',destination='C:\Program
Files\PackageManagement\NuGet\Packages'
VERBOSE: DownloadPackage' - name='chocolatey-core.extension', version='1.3.0',destination='C:\Program
Files\PackageManagement\NuGet\Packages\chocolatey-core.extension.1.3.0\chocolatey-core.extension.1.3.0.nupkg',
uri='http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget/Download/chocolatey-core.extension/1.
3.0'
VERBOSE: Downloading
'http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget/Download/chocolatey-core.extension/1.3.0'
.
VERBOSE: Completed downloading
'http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget/Download/chocolatey-core.extension/1.3.0'
.
VERBOSE: Completed downloading 'chocolatey-core.extension'.
VERBOSE: Hash for package 'chocolatey-core.extension' does not match hash provided from the server.
VERBOSE: InstallPackageLocal' - name='chocolatey-core.extension', version='1.3.0',destination='C:\Program
Files\PackageManagement\NuGet\Packages'
VERBOSE: InstallPackage' - name='Firefox', version='53.0.3',destination='C:\Program
Files\PackageManagement\NuGet\Packages'
VERBOSE: DownloadPackage' - name='Firefox', version='53.0.3',destination='C:\Program
Files\PackageManagement\NuGet\Packages\Firefox.53.0.3\Firefox.53.0.3.nupkg',
uri='http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget/Download/Firefox/53.0.3'
VERBOSE: Downloading
'http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget/Download/Firefox/53.0.3'.
VERBOSE: Completed downloading
'http://vmw12r2artrep.lab.pilgrimquality.com:8081/artifactory/api/nuget/nuget/Download/Firefox/53.0.3'.
VERBOSE: Completed downloading 'Firefox'.
VERBOSE: Hash for package 'Firefox' does not match hash provided from the server.
VERBOSE: InstallPackageLocal' - name='Firefox', version='53.0.3',destination='C:\Program
Files\PackageManagement\NuGet\Packages'

Name                           Version          Source           Summary
----                           -------          ------           -------
chocolatey-core.extension      1.3.0            LocalNuget       This package provides helper functions installed as...
Firefox                        53.0.3           LocalNuget       Bringing together all kinds of awesomeness to make ...

Thank you.

Leo Barcenas

jianyunt commented 7 years ago

Chocolatey provider is a prototype provider created by OneGet team and is on path for deprecation. Please work with Chocolatey owners to get official support.