gpr
gpr copied to clipboard
Option for skip duplicate
Currently with dotnet nuget push
and nuget push
there is an option to skip duplicate
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
Workaround in ubuntu:
gpr push --api-key $GITHUB_ACCESS_TOKEN "ThePackage.1.5.14.nupkg" || true
Would this workaround work if multiple packages are being pushed?
Ex:
gpr push -k ${{secrets.GITHUB_TOKEN}} ./output/*.nupkg || true
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.
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.
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.