Repository navigation
Retry newly created feed publishing - #17289
Conversation
Wait for newly created Azure DevOps feeds to become readable before publishing and use exponential backoff for NuGet package uploads. Co-authored-by: Copilot <[email protected]> Copilot-Session: ace92a75-6eaa-4e5c-956c-464de70257e1
There was a problem hiding this comment.
Pull request overview
This PR improves resilience of Azure DevOps feed publishing in Arcade by (1) waiting for newly created feeds to become readable by the publishing identity and (2) standardizing NuGet package upload retries on the shared exponential retry mechanism, with new unit test coverage.
Changes:
- Switch NuGet package upload retry logic in
PushNugetPackageAsyncto use the existingExponentialRetryhandler. - Add a feed-readiness polling step after Azure DevOps feed creation, honoring
Retry-Afterwhen present. - Add/extend unit tests covering feed readiness retries and upload retry behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestBase.cs | Replaces manual retry loop for NuGet uploads with the shared exponential retry handler. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/CreateAzureDevOpsFeed.cs | Adds a retry-based “feed readiness” check after feed creation to avoid transient permission/readability issues. |
| src/Microsoft.DotNet.Build.Tasks.Feed.Tests/PublishArtifactsInManifestTests.cs | Updates existing tests to inject ExponentialRetry and adds a new test for failed-upload retry behavior. |
| src/Microsoft.DotNet.Build.Tasks.Feed.Tests/CreateAzureDevOpsFeedTests.cs | Adds tests validating feed readiness retry success and failure scenarios. |
Suppressed comments (1)
src/Microsoft.DotNet.Build.Tasks.Feed.Tests/PublishArtifactsInManifestTests.cs:482
- This test currently only asserts the number of delays, but not that the delays increase (or match expected values), so it doesn't actually validate the exponential backoff behavior. Add an assertion that the second delay is greater than the first (and/or assert the exact expected delays if using a deterministic retry configuration).
attempts.Should().Be(3);
retryDelays.Should().HaveCount(2);
buildEngine.BuildErrorEvents.Should().BeEmpty();
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| Log.LogMessage(MessageImportance.Normal, $"Pushing package {id}@{version} to target feed {feedConfig.TargetURL}"); | ||
| int attemptIndex = 0; | ||
| RetryHandler.MaxAttempts = MaxRetryCount; | ||
| int attemptsMade = 0; | ||
|
|
||
| do | ||
| await RetryHandler.RunAsync(async attempt => | ||
| { |
There was a problem hiding this comment.
Addressed in 65cab2c by using a local ExponentialRetry instance for package pushes instead of mutating the task-wide RetryHandler configuration.
Use a local exponential retry handler for package pushes so other publishing operations retain their configured retry behavior. Co-authored-by: Copilot <[email protected]> Copilot-Session: ace92a75-6eaa-4e5c-956c-464de70257e1
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestBase.cs:1649
packagePushRetryHandler.MaxAttemptsis set directly fromMaxRetryCount. In the previous do/while implementation,MaxRetryCount = 0still performed a single push attempt (because the counter was incremented before checking the loop condition). WithExponentialRetry,MaxAttempts = 0results in zero attempts, leavingpackageStatusasUnknownand logging a failure after 0 attempts. Consider clamping to at least 1 attempt to preserve prior behavior and avoid surprising misconfiguration.
var packagePushRetryHandler = new ExponentialRetry
{
MaxAttempts = MaxRetryCount,
DelayBase = RetryHandler.DelayBase,
DelayConstant = RetryHandler.DelayConstant,

Summary
Validation