Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pushing with nuget.exe with versions higher than 2.x fails #52

Open
darksidemilk opened this issue Aug 30, 2018 · 1 comment
Open

Pushing with nuget.exe with versions higher than 2.x fails #52

darksidemilk opened this issue Aug 30, 2018 · 1 comment

Comments

@darksidemilk
Copy link

Background

I recently discovered I could use the built-in powershell modules powershellget and packagemanagement to push/publish powershell modules and scripts to my chocolatey simple server using publish-module and publish-script. Then those modules and scripts can be used on computers in my enviornment by installing them with install-module and install-script if I add my chocolatey server to a computer with register-psrepository. I even figured out that if I simply add a tools folder and a templated chocolateyinstall.ps1 (that runs install-module on the package) file in any module, I can also install it with choco commands and it will end up where it needs to be.
After this discovery I found that there were newer versions of powershellget (1.6.7) and packagemanagement (1.1.7.2). So I went and started updating to the newer versions and all the install commands continued to work. Then I tried to publish something...

The Problem

In the PSGallery version of PowershellGet it attempts to add C:\ProgramData\Microsoft\Windows\Powershell\PowershellGet to the path and downloads nuget.exe to that path and attempts to sync the registered package sources with nuget.exe sources (side note, the adding to path and syncing nuget sources only seems to work when run from powershell core/powershell 6, but the functionality of it works if the steps are done manually). In version 1.6.0 and below it downloads nuget 2.8.x which works correctly. However in the versions after 1.6.0 such as the latest 1.6.7 it attempts to download the latest version of nuget, nuget 4.x. When this gets downloaded and a publish is attempted I get a 500 error that says something to effect of 'server did not indicate success'
It looks like this

Publish-PSArtifactUtility : Failed to publish script 'Save-ChocoCommunityPackages': 'Response status code does not
indicate success: 500 (Internal Server Error).
'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.6.7\PSModule.psm1:11192 char:17
+ ...             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : FailedToPublishTheScript,Publish-PSArtifactUtility

I found nothing in the IIS logs or event viewer concerning the error. Was hoping there was so something would say something more. However, since downgrading to psget 1.6.0 and giving it nuget.exe 2.8.x allows it to work, I am lead to believe the issue is that chocolatey.server uses a version of nuget.server that isn't compatible with the newer nuget.exe

The acutal request of this issue

Make it so chocoatey simple server can accept pushes from nuget 4.x specifically when pushed through the publish-module command of powershellget 1.6.7

other notes

  • I have found various other posts where people have issues with psget 1.6.7 and basic authentication especially for visual studio team services package feeds. I did attempt to turn basic auth on in my simple server and added it as a nuget source with the default choco user to no avail.
  • If it isn't possible to make chocolatey.server simple server work with the newer version of nuget.exe for pushing packages, would it be possible to have some of the powershellget functions built into chocolatey as an alternative, so that powershell modules and scripts could be installed in the native manner but hosted within chocolatey.
  • When attempting to stay at version 1.6.0 somehow it still gets updated to 1.6.7, this may be just a update-module, install-module, or import-module command I missed adding -maximumversion to in my internal scripting, but at any rate it's tedious to need to always specify that
@ferventcoder
Copy link
Contributor

Perhaps set this as an enhancement to support 4.x at some point?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants