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

nuget push *.nupkg fails when snupkg does not exist #8148

Closed
karann-msft opened this issue May 21, 2019 · 23 comments · Fixed by NuGet/NuGet.Client#3140
Closed

nuget push *.nupkg fails when snupkg does not exist #8148

karann-msft opened this issue May 21, 2019 · 23 comments · Fixed by NuGet/NuGet.Client#3140
Assignees
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Category:Quality Week Issues that should be considered for quality week Functionality:Push Product:NuGet.exe NuGet.exe Type:Bug

Comments

@karann-msft
Copy link
Contributor

karann-msft commented May 21, 2019

I am trying to push a bunch of nupkg which do not have snupkg, using nuget.exe 5.1.0,

C:\Users\karann\Downloads\skipduplicate_test>nuget push *.nupkg -source nuget.org -SkipDuplicate
Pushing calchelper.1.0.1.nupkg to 'https://dev.nugettest.org/api/v2/package'...
  PUT https://dev.nugettest.org/api/v2/package/
  Conflict https://dev.nugettest.org/api/v2/package/ 698ms
Package 'C:\Users\karann\Downloads\skipduplicate_test\calchelper.1.0.1.nupkg' already exists at feed 'https://dev.nugettest.org/api/v2/package'.
Pushing CalcHelper.Foo.1.0.1.nupkg to 'https://dev.nugettest.org/api/v2/package'...
  PUT https://dev.nugettest.org/api/v2/package/
  Conflict https://dev.nugettest.org/api/v2/package/ 258ms
Package 'C:\Users\karann\Downloads\skipduplicate_test\CalcHelper.Foo.1.0.1.nupkg' already exists at feed 'https://dev.nugettest.org/api/v2/package'.
WARNING: Found symbols package '*.snupkg', but no API key was specified for the symbol server. To save an API Key, run 'NuGet.exe setApiKey [your API key from http://www.NuGet.org]'.
WARNING: No API Key was provided and no API Key could be found for 'https://dev.nugettest.org/api/v2/symbolpackage'. To save an API Key for a source use the 'setApiKey' command.
File does not exist (*.snupkg).

Expected: no warnings or errors related to snupkg should show up if no snupkgs are found in the path.

Update: @donnie-msft added more info and tasks in this comment

@karann-msft karann-msft added Functionality:Push Product:NuGet.exe NuGet.exe Area:ErrorHandling warnings and errors/log messages & related error codes. labels May 21, 2019
@rrelyea
Copy link
Contributor

rrelyea commented May 21, 2019

@donnie-msft - can you confirm if this is a new break in 5.1, please?

@donnie-msft
Copy link
Contributor

Confirmed as not a new break, but the Warnings about snupkgs do not make sense and should be fixed.

The Warning regarding symbols is due to a recognition that the Source can accept symbols, and it then incorrectly assumes there are snupkgs being pushed when there aren't (like in this case).
The API key was specified in a nuget.config,

SkipDuplicate is not coming into play, as it is only allowing the code to continue until it hits the warnings above.

@donnie-msft donnie-msft added this to the Backlog milestone May 23, 2019
@rrelyea rrelyea modified the milestones: Backlog, 5.3 Aug 12, 2019
@rrelyea rrelyea modified the milestones: 5.3, 5.4 Aug 21, 2019
@Tychus
Copy link

Tychus commented Aug 26, 2019

Having this issue building and publishing packages, packages are published to our private repository but the Jenkins jobs fail because of the "*.snupkg" issue. when can we expect a fix ?

@donnie-msft
Copy link
Contributor

Having this issue building and publishing packages, packages are published to our private repository but the Jenkins jobs fail because of the "*.snupkg" issue. when can we expect a fix ?

@Tychus,
What command are you executing to get this behavior, and do you have snupkgs in the directory to push, or no? Also, is your private repo a file system repo, or a private server? Logs would be helpful as well.

This issue is only about a Warning, which doesn't sound like it should fail something like Jenkins, AFAIK. Not sure it's relevant, but curious if somewhere you have a setting like "Treat Warnings as Errors" enabled?

@Tychus
Copy link

Tychus commented Aug 27, 2019

new to nuget packages, we use nuget cli on a windows slave. executing nuget.exe push ... with a key returns exit code 1 making the job fail.

Your package was pushed. File does not exist (C:\Users\Jenkins\Documents\JenkinsWork\workspace\Common\XXXXX.snupkg). C:\Users\Jenkins\Documents\JenkinsWork\workspace\Common>exit 1

we fixed this by ignoring the return of the command since it always pushes the packages we need. Don't think we have fail on warnings as other build steps generate warnings but never broke builds.

@anangaur
Copy link
Member

I hit the same issue today. Details here: https://github.com/anangaur/entropy-packages/commit/c3a21773faa4d2d6f250e2906be91bb201627e2d/checks

@olsh
Copy link

olsh commented Sep 19, 2019

I have the same issue with dotnet nuget push
https://github.com/olsh/sentry-api-client/runs/229034352

@knocte
Copy link

knocte commented Sep 21, 2019

I was hit by this issue today. Even downloading older version of nuget (4.5.1) didn't fix the problem. But I've found a workaround: don't use wildcards (*.nupkg), just use the exact file name.

fvoncina added a commit to fvoncina/Serilog.Sinks.Loki.gRCP that referenced this issue Oct 21, 2019
fvoncina added a commit to fvoncina/Serilog.Sinks.Loki.gRCP that referenced this issue Oct 21, 2019
fvoncina added a commit to fvoncina/Serilog.Sinks.Loki.gRCP that referenced this issue Oct 21, 2019
@StefH
Copy link

StefH commented Oct 25, 2019

@knocte Any news, or is it still required to use the exact filename?

@StefH
Copy link

StefH commented Oct 25, 2019

Could this help? (https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-push)

-n|--no-symbols

Doesn't push symbols (even if present).

@aliostad
Copy link

Could this help? (https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-push)

@StefH no, I had tried it. No help despite it really should

@aliostad
Copy link

Having the same issue

@Aarklendoia
Copy link

In addition to this problem, if a symbol package is available, it is always pushed even if the SkipDuplicate option has been added. We have the following error on the nuget.org side because the package and symbols no longer match.

Symbols package publishing failed. The associated symbols package could not be published due to the following reason(s):
The uploaded symbols package contains one or more pdbs that are not portable.
Once you've fixed the issue with your symbols package, you can re-upload it.

Please note: The last successfully published symbols package is still available for debugging and download.

If both packages are pushed at the same time (e. g. due to a version change), the problem does not occur.

@donnie-msft donnie-msft modified the milestones: 5.5, Sprint 165 Jan 21, 2020
@donnie-msft donnie-msft added this to the Sprint 166 - 2020.02.10 milestone Feb 8, 2020
@aortiz-msft aortiz-msft added the Category:Quality Week Issues that should be considered for quality week label Feb 13, 2020
darenm added a commit to darenm/CustomMayd.Services.Serialization that referenced this issue Feb 20, 2020
Using a wildcard with the nuget push is causing an erroneous failure - issue is recorded at NuGet/Home#8148
IanKnighton added a commit to Knighton-Dev/SharpenUp that referenced this issue Feb 24, 2020
Per this [issue](NuGet/Home#8148) I added a flag to the push command. 

This is also a chance to see what happens if I push the same package to NuGet twice.
@donnie-msft
Copy link
Contributor

Merged and should go out in 5.6 Preview 2.

In addition to this problem, if a symbol package is available, it is always pushed even if the SkipDuplicate option has been added.

Quick clarification about this PR:
-SkipDuplicate was not applying to the automatic snupkg push (when pushing nupkgs) before this change. The option will be available now, and if you want to see the detailed output you provided (eg, validation in progress) , you can now specify -Verbosity detailed.

@Aarklendoia Your scenario sounds a bit different. I'm curious, how are you packing your nupkg/snupkg before you re-push them?

I think there's confusion in what SkipDuplicate does in this case. It does not actually prevent a snupkg from being uploaded to the Server. It will simply ignore any response code that indicates "Conflict".
However, nuget.org will always accept snupkgs and try to process them (I raised an issue to discuss this behavior NuGet/NuGetGallery#7681). That's why you're getting that error. SkipDuplicate does not proactively check a Server to see if there's a snupkgs.

Docs should be clarified, so please comment on this issue to provide your feedback: #9338

jcansdale added a commit to jcansdale/ghvs that referenced this issue May 2, 2020
Workaround for symbols issue with wildcards.
See NuGet/Home#8148
@obarlik
Copy link

obarlik commented May 5, 2020

Adding "-NoSymbols" to nuget push command fixed my issue.
https://docs.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-push

M0LTE pushed a commit to M0LTE/HamLibSharp that referenced this issue May 9, 2020
@rrelyea rrelyea changed the title nuget push *.nupkg fails with snupkg does not exist nuget push *.nupkg fails with snupkg does not exist May 19, 2020
@rrelyea rrelyea changed the title nuget push *.nupkg fails with snupkg does not exist nuget push *.nupkg fails when snupkg does not exist May 19, 2020
@donnie-msft
Copy link
Contributor

I believe dotnet.exe 3.1.3xx contains this change https://github.com/dotnet/cli/pull/13324/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Category:Quality Week Issues that should be considered for quality week Functionality:Push Product:NuGet.exe NuGet.exe Type:Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.