Improve NuGet Push Step to Prevent 403 Quota Limit Failures#25246
Merged
Improve NuGet Push Step to Prevent 403 Quota Limit Failures#25246
Conversation
…h retry logic. Added configurable retry count and delays for improved resilience during package pushes.
…sponses. Changed warning message to reflect the new error condition and ensure clarity during retries.
…ations for failed package pushes. Added error tracking for failed packages and improved error handling during push attempts.
…ipts. Simplified error handling by exiting with a status code on failures without sending notifications.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the NuGet package push PowerShell scripts to push packages one-by-one with retry logic and clearer failure handling, aiming to make nightly/MyGet and NuGet.org publishing more resilient.
Changes:
- Push
.nupkgfiles individually (sorted) instead of using a single wildcard push. - Add retry-with-backoff behavior around
dotnet nuget pushfailures. - Track failed pushes and return a non-zero exit code when any push fails.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
nupkg/push-nightly-packages-myget.ps1 |
Adds per-package push loop with retry/backoff and fails the script if any package cannot be pushed. |
nupkg/push_packages.ps1 |
Adds retry/backoff around NuGet.org push attempts and exits with failure when errors occur. |
Comment on lines
+41
to
+49
| $clientError = ($pushOutput | Out-String) -match "Response status code does not indicate success:\s*4\d\d" | ||
| $canRetry = $clientError -and $attempt -le $maxRetryCount | ||
| if (-not $canRetry) | ||
| { | ||
| break | ||
| } | ||
|
|
||
| $retryDelay = $retryDelaysInSeconds[$attempt - 1] | ||
| Write-Warning "NuGet push returned a 4xx response for $packageName. Retrying in $retryDelay seconds (retry $attempt/$maxRetryCount)..." |
| if ($failedPackages.Count -gt 0) | ||
| { | ||
| $errorCount = $failedPackages.Count | ||
| Write-Host ("******* $errorCount error(s) occured *******") -ForegroundColor red |
Comment on lines
10
to
13
| $i = 0 | ||
| $errorCount = 0 | ||
| $failedPackages = @() | ||
| $totalProjectsCount = $projects.length |
Comment on lines
+44
to
+50
| $clientError = ($pushOutput | Out-String) -match "Response status code does not indicate success:\s*4\d\d" | ||
| $canRetry = $clientError -and $attempt -le $maxQuotaRetryCount | ||
|
|
||
| if (-not $canRetry) | ||
| { | ||
| break | ||
| } |
| @@ -41,4 +76,5 @@ foreach($project in $projects) { | |||
| if ($errorCount > 0) | |||
| { | |||
| Write-Host ("******* $errorCount error(s) occured *******") -ForegroundColor red | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related https://github.com/volosoft/vs-internal/issues/8419