gpr icon indicating copy to clipboard operation
gpr copied to clipboard

Option for skip duplicate

Open jasonycw opened this issue 4 years ago • 5 comments

Currently with dotnet nuget push and nuget push there is an option to skip duplicate

image image

With gpr push, if duplicate package is found, there will be an error with non-zero exit code.

[ThePackage.1.5.14.nupkg]: Repository url: https://github.com/OWNER/ThePackage. Version: 1.5.14. Size: 39625 bytes.
[ThePackage.1.5.14.nupkg]: Uploading package.
[ThePackage.1.5.14.nupkg]: Error: Version 1.5.14 of "ThePackage" has already been pushed.

This cause docker to fail and exit.

It would be nice if there is an option like dotnet and nuget CLI to skip duplicate or make this as warning instead of an error with non-zero exit code e.g.

gpr push --api-key $GITHUB_ACCESS_TOKEN "ThePackage.1.5.14.nupkg" --skip-duplicate

jasonycw avatar Aug 31 '20 10:08 jasonycw

Workaround in ubuntu:

gpr push --api-key $GITHUB_ACCESS_TOKEN "ThePackage.1.5.14.nupkg" || true

phnx47 avatar Sep 09 '20 17:09 phnx47

Would this workaround work if multiple packages are being pushed? Ex: gpr push -k ${{secrets.GITHUB_TOKEN}} ./output/*.nupkg || true

MoazAlkharfan avatar Sep 18 '20 07:09 MoazAlkharfan

This would also be handy when <IncludeSymbols>true</IncludeSymbols> is defined in packed projects as the default symbols.nupkg results in duplicate package errors on gpr push (whereas dotnet nuget push can skip dup). Changing to <SymbolPackageFormat>snupkg</SymbolPackageFormat> also works around.

ghost avatar Sep 25 '20 19:09 ghost

That workaround is not a good idea, if your push fails you don't get to see that. It's the most crucial step of any package deployment, and you're throwing away the information on whether it succeeded or not. If your connection goes down and the package never makes it to the server, you won't know. Implementing a ignore-duplicate mechanism like is done in dotnet and nuget is the preferable solution, IMO.

bbourdrez avatar Apr 08 '22 09:04 bbourdrez

https://github.com/jcansdale/gpr/pull/115

This works on my end, will try to roll it into some of our pipelines to stress-test it.

bbourdrez avatar Apr 08 '22 11:04 bbourdrez