Open OCram85 opened 5 years ago
Right now we have the same issue
@loic-sharma: We really need this to be fixed π
Is there any way to help? - Maybe we could provide additional analysis data of specific test scenarios?
BUMP.
@loic-sharma: Any updates about this?
Hi, I apologize for the very long response. This requires supporting the legacy NuGet V2 APIs, which is tracked by https://github.com/loic-sharma/BaGet/issues/43. @Mizipzor and @jgagnaire made good progress on this (see https://github.com/loic-sharma/BaGet/pull/294 and https://github.com/loic-sharma/BaGet/pull/178).
I'll admit that I've been dragging my feet here as I feel torn on adding "legacy" APIs to BaGet. However, I believe that supporting Powershell modules and fully replacing NuGet.Server's feature set feels valuable enough. I will tackle this as part of BaGet V1 soon.
It's worth pointing out that PowerShellGet v3 is already in progres and doesn't intend to remain fully backward compatible @loic-sharma -- perhaps (assuming it uses the new v3 APIs, since they're commiting to using NuGet.Client) PowerShell is not a good enough reason to re-implement old APIs ...
Especially when powershell core is out and fully incompatible ;) new name: pwsh ! Includes SSH client !!!
@softlion except that PowerShell Core is backward compatible, and still ships the same old (v2) NuGet-based PowerShellGet dependency manager, so it doesn't change anything in this regard...
So If I get this right, the problem could be fixed when:
I have tried to install PowerShellGet v3 (Beta 4) and my results were not that encouraging π’
PS> Get-PSResourceRepository
Name Url Trusted Priority
---- --- ------- --------
MyRepository https://[REDACTED]/v3/index.json true 50
PSGallery https://www.powershellgallery.com/api/v2 false 50
PS> Get-PSResourceRepository MyRepository | fl
Name : MyRepository
Url : https://[REDACTED]/v3/index.json
Trusted : true
Priority : 50
PS> Find-PSResource -Repository MyRepository
No cursor found. Defaulting to 01/01/0001 00:00:00.
Find-PSResource: An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set.
PS> Set-PSResourceRepository MyRepository -URL https://[REDACTED]/api/v2/package
PS> Find-PSResource -Repository MyRepository
Find-PSResource: 'doctype' is an unexpected token. The expected token is 'DOCTYPE'. Line 1, position 3.
PS> Set-PSResourceRepository MyRepository -URL https://[REDACTED]/api/v2
PS> Find-PSResource -Repository MyRepository
Find-PSResource: 'doctype' is an unexpected token. The expected token is 'DOCTYPE'. Line 1, position 3.
PS> Set-PSResourceRepository MyRepository -URL https://[REDACTED]/api/v3
PS> Find-PSResource -Repository MyRepository
Find-PSResource: 'doctype' is an unexpected token. The expected token is 'DOCTYPE'. Line 1, position 3.
PS> Set-PSResourceRepository MyRepository -URL https://[REDACTED]/api/v3/package
PS> Find-PSResource -Repository MyRepository
Find-PSResource: 'doctype' is an unexpected token. The expected token is 'DOCTYPE'. Line 1, position 3.
PS> Set-PSResourceRepository MyRepository -URL https://[REDACTED]/api/
PS> Find-PSResource -Repository MyRepository
Find-PSResource: 'doctype' is an unexpected token. The expected token is 'DOCTYPE'. Line 1, position 3.
PS>
I've tried several different URL's, none of them really work. Am I missing something? (The first attempt did give a different message compared to the rest...)
Hello everyone π I work on the PowerShell team and wanted to say a couple things:
Publish-Module
working which is really exciting πFind
and Install
do not workIt would be awesome to see the addition of the last couple of v2 APIs to get Find/Install working π
I got it to install the module using PowershellGet v3.0.0-beta10 Published the module through v2, have not tried to publish through v3
~ β― Find-PSResource -Name NetworkingDsc -Repository Baget
Name Version Repository Description
---- ------- ---------- -----------
NetworkingDsc 8.1.0.0 Baget DSC resources for configuring settings related to networking.
~ β― Install-PSResource -Name NetworkingDsc -Repository Baget -Verbose -Debug
DEBUG: Parameters passed in >>> Name: 'NetworkingDsc'; Version: ''; Prerelease: 'False'; Repository: 'Baget'; Scope: ''; AcceptLicense: 'False'; Quiet: 'False'; Reinstall: 'False'; TrustRepository: 'False'; NoClobber: 'False';
DEBUG: Entering InstallHelper::ProcessInstallParams
DEBUG: Console is elevated: 'True'
DEBUG: Console is Windows PowerShell: 'False'
DEBUG: Current user scope installation path: 'C:\Users\username\Documents\PowerShell'
DEBUG: All users scope installation path: 'C:\Program Files\PowerShell'
VERBOSE: Scope is: CurrentUser
DEBUG: Checking to see if paths exist
DEBUG: Path: 'C:\Users\username\Documents\PowerShell\Modules' >>> exists? 'True'
DEBUG: Path: 'C:\Users\username\Documents\PowerShell\Scripts' >>> exists? 'True'
DEBUG: Path: 'C:\Users\username\Documents\PowerShell\Scripts\InstalledScriptInfos' >>> exists? 'True'
DEBUG: Attempting to search for packages in 'Baget'
DEBUG: Untrusted repository accepted as trusted source.
VERBOSE: Begin installing package: 'NetworkingDsc'
DEBUG: Successfully able to download package from source to: 'C:\Users\username\AppData\Local\Temp\bc139dfc-f5c4-4057-96ea-fd22bd918bbe'
DEBUG: Deleting 'C:\Users\username\AppData\Local\Temp\bc139dfc-f5c4-4057-96ea-fd22bd918bbe\networkingdsc\8.1.0\networkingdsc.8.1.0.nupkg.sha512'
DEBUG: Deleting 'C:\Users\username\AppData\Local\Temp\bc139dfc-f5c4-4057-96ea-fd22bd918bbe\networkingdsc\8.1.0\networkingdsc.nuspec'
DEBUG: Deleting 'C:\Users\username\AppData\Local\Temp\bc139dfc-f5c4-4057-96ea-fd22bd918bbe\networkingdsc\8.1.0\networkingdsc.8.1.0.nupkg'
DEBUG: Installation path is: 'C:\Users\username\Documents\PowerShell\Modules\NetworkingDsc'
VERBOSE: Full installation path is: 'C:\Users\username\AppData\Local\Temp\bc139dfc-f5c4-4057-96ea-fd22bd918bbe\networkingdsc'
DEBUG: Attempting to move 'C:\Users\username\AppData\Local\Temp\bc139dfc-f5c4-4057-96ea-fd22bd918bbe\networkingdsc' to 'C:\Users\username\Documents\PowerShell\Modules\NetworkingDsc
VERBOSE: Successfully installed package NetworkingDsc
DEBUG: Attempting to delete 'C:\Users\username\AppData\Local\Temp\bc139dfc-f5c4-4057-96ea-fd22bd918bbe'
~ β― Get-DscResource -Module NetworkingDsc -Name NetIPInterface
ResourceType : DSC_NetIPInterface
Name : NetIPInterface
FriendlyName : NetIPInterface
Module : NetworkingDsc
ModuleName : NetworkingDsc
Version : 8.1.0
Path : C:\Users\username\Documents\PowerShell\Modules\NetworkingDsc\8.1.0\DscResources\DSC_NetIPInterface\DSC_NetIPInterface.psm1
ParentPath : C:\Users\username\Documents\PowerShell\Modules\NetworkingDsc\8.1.0\DscResources\DSC_NetIPInterface
ImplementedAs : PowerShell
CompanyName : DSC Community
Properties : {AddressFamily, InterfaceAlias, AdvertiseDefaultRoute, Advertisingβ¦}
@brajjan, I see you got it to work with PowerShell Core using DSC. Did it also work for Install-Module
or Find-Module
? What about PowerShell Desktop (5.1
)?
I tried BaGet and LiGet. Was getting the issues on both, but I didn't make the issues over here, yet:
~I'll try to make time today to make similar detailed output for BaGet.~ We're using sunside/simple-nuget-server instead. I'd prefer BaGet because it's beautiful, as @TylerLeonhardt said. However, we need it functional now. I'll keep an eye on this thread. I hope things get resolved here and we can swap to BaGet in the future.
@VertigoRay there's no frontend for that one is there?
@TylerLeonhardt, you are correct. The meta and downloads are available though. I imagine something could be made relatively easy.
$module = 'ActiveDiretory'
$url = "https://simple-nuget-server.contoso.com/FindPackagesById()?id=%27${module}%27&$skip=0&$top=40
(Invoke-RestMethod $url)[0].properties.DownloadCount.'#text'
I would prefer to not fork that project. I would rather put time into this one. I just need to have time to do that. π
PowershellGet v3.0.0-beta10 seems to be working fine.
# Install latest prelease version of PowershellGet
Install-Module -Name PowerShellGet -AllowPrerelease -Force
# Register BaGet repository
Register-PSResourceRepository -Name 'BaGet' -Url 'http://127.0.0.1:5555/v3/index.json' -Trusted
# Publish resource
Publish-PSResource -Path E:\PowerShell\PSCalendar -Repository BaGet
# Find module
Find-PSResource PSCalendar -Repository BaGet
# Install module
Install-PSResource PSCalendar -Repository BaGet
# Run module function
Show-Calendar
Hello, I have tried PowershellGet v3.0.0-beta10. It works in HTTP but not using TLS. Each time the client is trying to communicate without TLS, even if the repo is set with a HTTPS uri... Any idea . Perhaps Xeevis, did you try to expose your repo using a TLS configuration ?
@MS-LUF I've ran a couple of tests and I can confirm that using TLS this is not working on Beta 10 atm. (We have BaGet deployed on a linux kubernetes cluster with an NGINX front-end proxy.)
Once a new version of PowerShellGet
is released I'll try again.
Might be worth getting an issue going on PowerShellGet?
Might be worth getting an issue going on PowerShellGet?
Already done :) https://github.com/PowerShell/PowerShellGet/issues/314
It's a shame that in 2020 a web component does not support TLS ! Moreover, TLS is supported for default repository (PSGallery). I don't understand why they have splitted the behavior in their code...
Hosting a private NuGet service for Powershell is was a hell in 2021. The problem here isn't the server part at all.
Every time I had to connect a new client to the NuGet based service it scared the shit out of me because:
@OCram85 The issues you describe are very distinct.
Hope this clarifies a few things.
You're absolutely right. My comment wasn't really clear and much more impulsive than it was intended.
Just wanted to describe the situation I'm facing in a heterogen environment with:
I've invested weeks in the last years to get these systems hooked up with a private NutGet Server like PowershellGallery (BaGet, Nexus Repository....). In some cases it works instant and others you end up reading PowerShellGet and PackageManagement issues / workarounds.
So to sum up I just want to tell my personal opinion about this situation:
I really like working and developing modules for pwsh. But If you need to deploy your modules internally you're really faced with some additional challenges. It seems to me like the PowerShellGet based package management is the only valid way to publish and consume pwsh modules. Unfortunately I don't see much progress in solving the existing issues in PowerShellGet v2, or even a clear roadmap when to expect the PowerShellGet v3.
π
The following worked for me. It can be a workaround/ solution depending on your requirements:
Download the Nuget client from the following URL. Nuget client is a .exe file. It does not need any installation, not does it need admin rights to execute.
https://learn.microsoft.com/en-us/nuget/install-nuget-client-tools?tabs=windows#install-nugetexe
Then, open a PS window with the folder where nuget.exe was downloaded. Run the following command to add BaGet as a source for NuGet client (nuget.exe).
.\nuget sources Add -Name "BaGet" -Source "http://localhost:5000/v3/index.json"
If the source BaGet has already been added, then run the following command to configure it's settings. (Optional)
.\nuget sources Update -Name "BaGet" -Source "http://localhost:5000/v3/index.json"
Use the following commands to push packages to Baget. These packages are downloaded in the form of .nupkg file from the PowerShell Gallery. The -ApiKey parameter is the value set in appsettings.json for the ApiKey.
.\nuget push -Source BaGet -ApiKey SuperSecret packagemanagement.1.4.8.1.nupkg
.\nuget push -Source BaGet -ApiKey SuperSecret powerstig.4.20.0.nupkg
.\nuget push -Source BaGet -ApiKey SuperSecret get-windowsautopilotinfo.3.9.0.nupkg
Run the following command to install the package on local machine (where you access the BaGet webpage from). This works on Windows. It can possibly work on Linux as well with the equivalent of NuGet.exe for the linux world.
.\nuget install < < name of the package > > -Source BaGet
.\nuget install get-windowsautopilotinfo -Source BaGet
Then, navigate to the directory where the package (PS module) was installed. If you are installing it for -Scope CurrentUser, the directory would be: "C:\users\< < username > >\documents\windowspowershell\modules\ < < name of the PS Module > > ".
Now the .psm1 file needs to be imported. Run the following command to do so. You may also browse to the module location with Windows Explorer and look for the name of .psm1 file. Usually, it is the same as the module name. In some cases, you many need to import .psd1 file as well, for the PS module to work.
import-module < <Path to the .psm1 file> >
import-module .\powerstig.4.20.0.psm1 import-module .\get-windowsautopilotinfo.3.9.0.psm1
Run the following command to see the newly added PS cmdlets from the installed module(s). Get-Command -Module < < Name of the installed module > >
The following is a link to Nuget CLI documentation. https://learn.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-sources
For what it's worth...
After all these years, the new version (named PSResourceGet) has finally released with support for the v3 feed format. It might be worth testing with that (and opening an issue on the new repo if it doesn't work) π
Also, about the compatibility thing... Although backward compatibility is obviously never trivial, writing PowerShell modules that work across multiple versions back to Windows PowerShell (5.1) and on Windows, Linux and OSX is not that hard -- and PSResourceGet for instance, should work across them all.
β Question
Did anyone managed to run BaGet as PowerShell module repository sucessfully?
π Details
It seems like there are several discussions about the usage of BaGet and PowerShell in general.
Especially finding and installing packages via PowerShell (PackageManagement & PowerShellGet) seems to be unstable.
BaGet would be the first PackageRespository type using NuGet v3 API. Could the issues relate to this?
π£ Testing Details
2.0.4
1.2.4
πΌ Screenshots
π Refs
199