chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.26k stars 900 forks source link

Using TFS PackageManagement not working with choco #1374

Open JanEggers opened 7 years ago

JanEggers commented 7 years ago

i tried to use TFS 2017 PackageManagement as an internal choco feed.

What You Are Seeing?

when i try to push with choco i get http error 405.

when i try to list or install packages are not found

i suppose it is related to nuget.core version:

https://stackoverflow.com/questions/37353175/getting-a-405-method-not-allowed-publishing-nuget-to-vsts

when i use nuget to push, it works fine.

What is Expected?

choco works with nuget server 3.5

is there a way to tell choco to use nuget 3.5 client side?

I found another issue #1158 that states that support for nuget 3.5 will be delayed to end 2017 begin 2018.

is a pull request welcome or do i have to wait for that long

JanEggers commented 7 years ago

i had a look at the code. Seems that the project uses a modified nuget.core.dll as there are missing fields when updating that are not in the official 2.8 build. i think that this is quite confusing and i dont understand why there is no IChocoPackage interface that contains the additional information. Anyway updating unofficial packages isnt that straight forward, so i think i will just wait for the next version....

ferventcoder commented 7 years ago

Hi @JanEggers - please remember that Chocolatey != NuGet. It does use NuGet.Core 2.11 and it should be completely compatible with NuGet servers that work with NuGet v2. It sounds like VSTS has some issue pushing packages that are built with NuGet v2.

Seems that the project uses a modified nuget.core.dll as there are missing fields when updating that are not in the official 2.8 build

We do not remove any fields. We're completely compatible with NuGet proper and have only added additional fields.

i think that this is quite confusing and i dont understand why there is no IChocoPackage interface that contains the additional information.

Please explain?

Anyway updating unofficial packages isnt that straight forward

Can you elaborate here as well?

JanEggers commented 7 years ago

src/chocolatey/chocolatey.csproj line 45 points to a custom nuget.core.dll.

i hit update packages for solution and updated that lib to the newest version. after that there are fields (that where added in the custom build) missing on IPackage so there must be a modified version of nuget.core somewhere and i cannot just update packages. that is all i wanted to point out. I just thought it would be an easy package update but turns out it isnt.

JanEggers commented 7 years ago

and as a sidenote can you please update https://chocolatey.org/docs/how-to-host-feed to reflect that a specific version of nuget server must be used

ferventcoder commented 7 years ago

i hit update packages for solution and updated that lib to the newest version. after that there are fields (that where added in the custom build) missing on IPackage so there must be a modified version of nuget.core somewhere and i cannot just update packages. that is all i wanted to point out. I just thought it would be an easy package update but turns out it isnt.

I'm confused - are you filing an issue for this code base or another one? IPackage is not an interface you would interact with when using Chocolatey (choco.exe). It feels like you may be referencing https://github.com/chocolatey/simple-server?

If you are mentioning this code base, I have recently updated the packages.config to remove that and updated other items. It's helpful to split conversations, I was under the impression that had something to do with an error you might have seen attempting to push packages to VSTS Team Services.

If you are attempting to update this code base to NuGet v3, note that already has a separate issue (#508) - it is a deep infrastructure change that will ripple through the code base, so it is not up for community contribution. I just noticed it did not have the "Core Team" label on it, so I added it to be explicit about that aspect. Apologies for the confusion.

ferventcoder commented 7 years ago

If you are mentioning this code base, I have recently updated the packages.config to remove that and updated other items.

I just need to push that back up to github.

ferventcoder commented 7 years ago

and as a sidenote can you please update https://chocolatey.org/docs/how-to-host-feed to reflect that a specific version of nuget server must be used

We are not aware of a specific version limitation yet - you have alluded to a possible incompatibility, but we are not aware of specific versions where NuGet.Server stopped working with v2 feeds.

If you know what that is, we would love for you to let us know and/or contribute it to the documentation! The page you linked is built from the markdown documentation found at https://github.com/chocolatey/choco-wiki/, specifically at https://github.com/chocolatey/choco-wiki/blob/master/How-To-Host-Feed.md.

ferventcoder commented 7 years ago

It would also be tremendously helpful for us to get a gist of the output when you attempt to push to that server with -dv (like the original bug template requested). Would you be able to pass that along? Thanks!

ferventcoder commented 7 years ago

@JanEggers if you can get that information over, it will be quite helpful for us to further triage this issue.

JanEggers commented 7 years ago

@ferventcoder sorry to keep you waiting so long, had other stuff to do...

i created a gist with the output of choco.exe, nuget 2.8 which is also failing to push and nuget 3.5 which works.

https://gist.github.com/JanEggers/299b2cc2f12ccbf8f5a37cb8cda21f40

it seems that with nuget 3.5 there is some kind of redirect implemented in the server. anyway index.json contains a v2publish url if i use that url for choco.exe publishing works

ferventcoder commented 7 years ago

Hi @JanEggers - is "http://:8080/tfs/Electronics/_packaging/Chocolatey/nuget/v3/index.json" the only push url you can use? Can you try "http://srhw8068:8080/tfs/Electronics/_packaging/Chocolatey/nuget/"? Do you know what version of NuGet.Server you built this from?

ferventcoder commented 7 years ago

FWIW, I do not expect pushing directly to a v3 feed to work ("/v3/index.json"). If there are other urls you can push to, that would move the package to the v2 handlers, that is where you may want to set up the source location for push.

On the other end of that, you should also install from a v2 operations url, not a v3. Is that available in the NuGet.Server still?

HTH

JanEggers commented 7 years ago

Do you know what version of NuGet.Server you built this from?

no i dont know the specific version. it is the TFS Packagemanagement extension of TFS 2017. https://www.visualstudio.com/en-us/docs/package/overview

is "http://srhw8068:8080/tfs/Electronics/_packaging/Chocolatey/nuget/v3/index.json" the only push url you can use?

i can push and install with this endpoint: http://srhw8068:8080/tfs/Electronics/_packaging/51d9d403-db0f-4ec5-a61c-c707a670f6ba/nuget/v2/

it is listed in '/v3/index.json' as v2 endpoint i dont know why the server generates the guid and not just uses '/v2/'

FluentGuru commented 7 years ago

I'm using VSTS package feed to host my chocolatey packages. I can push it properly using the v2 API url of the feed but when I try to install the package I get the error on the output below and when I go to the extracted files on chocolatey lib folder I see that the .nuspec file was downloaded empty. I do not push the packages with empty nuspec as I can open the .nupkg file and see that everything works properly. (See nuspec file attached) This only happens with packages installed from a TFS feed.

package.nuspec.txt

PS C:\WINDOWS\system32> choco install "microservice-package.template" -s "https://tfs.ercbpo.local/tfs/erc/_packaging/mi croservices-deployments/nuget/v2" --version 1.0.0.0 Chocolatey v0.10.8 Installing the following packages: microservice-package.template By installing you accept licenses for the packages. Progress: Downloading microservice-package.template 1.0.0.0... 100% microservice-package.template not installed. An error occurred during installation: Authors is required. microservice-package.template package files install completed. Performing other installation steps. The install of microservice-package.template was NOT successful. microservice-package.template not installed. An error occurred during installation: Authors is required.

Chocolatey installed 0/1 packages. 1 packages failed. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures

ferventcoder commented 6 years ago

@ExSF would you mind opening a new issue with that? We've seen that in a couple of places and I'd like to get to the bottom of the issue.

ferventcoder commented 6 years ago

@JanEggers We've added documentation at https://github.com/chocolatey/choco/wiki/how-to-host-feed#known-simple-server-options for v2 endpoint. Can you verify it looks good and then we can close this?

ferventcoder commented 6 years ago

We'll also get it pushed up to the website once verified to be appropriate.

JanEggers commented 6 years ago

i closed the issue because we switched to ProGet to host packages because TFS does not allow packages larger than 500 MB.

but the v2 endpoint was working fine for smaller packages.

JanEggers commented 6 years ago

i had a look at the wiki and from my point of view the information is not related to vsts but general. the nuget endpoint has to be api /v2/.

matohin commented 5 years ago

Same issue here MSFT has two requests on this topic on community forums, second is pretty recent (one, two).

.nuspec is empty in choco lib and thus choco can't install anything. Not a problem with nuget.exe client both v3 and v2 endpoints - it unpacks packages just fine, .nuspec is in tact.

Copy/paste from my code listing on MSFT forum:

choco source remove -n=chocolatey
choco source add -n=adv -s="https://pkgs.dev.azure.com/wpPackageManagement/_packaging/ChocoTest/nuget/v2" 
-u=randomString -p=MySecretPAT
choco install googlechrome -y -v -d
default: [NuGet] Added file 'chocolateyInstall.ps1' to folder 'GoogleChrome\tools'.
default: [NuGet] Added file 'helpers.ps1' to folder 'GoogleChrome\tools'.
default: googlechrome not installed. An error occurred during installation:
default:  Authors is required.
PS C:\Users\vagrant> ls C:\ProgramData\chocolatey\lib\GoogleChrome

Directory: C:\ProgramData\chocolatey\lib\GoogleChrome

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        4/11/2019   8:36 AM                tools
-a----        4/11/2019   8:36 AM              0 GoogleChrome.nuspec

I can provide my vagrant repository and access to test feed.

DiscoveringWorld commented 1 year ago

Any news on that to support v3 and not only v2 ? /nuget/v3/index.json

gep13 commented 1 year ago

@DiscoveringWorld rather than posting the same question in multiple places, let's keep the conversation in once place. The correct place to continue discussing this is in this issue: https://github.com/chocolatey/choco/issues/508