Repository navigation
Support retrying partial NuGet publishes - #458
savannahostrowski wants to merge 1 commit into
Conversation
|
So despite the docs saying that the If we can just enable that option, I'd just do that unconditionally. It keeps things simpler, and if we happen to re-run an existing build, it's going to successfully overwrite other places where it's been published anyway which is messy enough that we are dealing with a mess regardless. Whether or not the build fails silently or loudly doesn't matter much at that point. |
|
Hm, so I think you’re right that In the case I ran into, NuGet returned |
Probably not. Here's an alternative to consider - this uses the Nuget API directly to check what versions are already published: # Get the API root for the Nuget API
$api = ((irm https://api.nuget.org/v3/index.json).resources | ?{ $_.'@type' -eq 'PackageBaseAddress/3.0.0' }).'@id'
# Assume running in directory with files to publish
$to_upload = dir *.nupkg | ?{ $_.BaseName -match '([^.]+)\.(.+)$' } | %{ @{ file=$_; name=$Matches[1]; version=$Matches[2] } }
# Check which ones are already published
$already_present = ($to_upload | ?{ (irm "$api/$($_.name)/index.json").versions -contains $_.version }).file
# Remove them
del $already_present -Verbose
# Upload whatever is left(I'm mostly fluent in the shortest Powershell shortcuts and didn't expand them, but |
During the 3.16.0a1 release, publishing to NuGet timed out after one package had already been uploaded. Retrying the publish failed with a 409 Conflict on that package before reaching the remaining packages, which meant I had to generate a NuGet API key and publish them through the CLI with
--skip-duplicate.This PR adds a NuGet packages to skip on retry field when republishing artifacts from an existing build. It accepts semicolon-separated filenames or wildcard patterns, allowing recovery runs to exclude packages confirmed as already uploaded. The field defaults to (none), so unexpected conflicts still fail normal publishes. The recovery step removes matching packages from the temporary downloaded artifact directory before the existing NuGet task publishes the remaining .nupkg files; the original build artifacts are unchanged.
It also increases the NuGet publish timeout from its default of 300 seconds to 600 seconds and documents the recovery workflow in the README.
Feedback on the PowerShell filtering is welcome! :)