Tolerate decommissioned package sources during restore#17099
Conversation
Set RestoreIgnoreFailedSources=true by default so servicing builds don't fail when a transport feed referenced in NuGet.config has been disabled after a release (e.g. dotnet/runtime#129694, the darc-pub-dotnet-emsdk feed). - Default the property in the Arcade SDK's ProjectDefaults.props so it flows to every project's NuGet restore. It is conditional, so repos and command lines can still override it explicitly. - Also pass it on the toolset restore.proj invocation in tools.ps1/tools.sh, where the Arcade SDK props imports are suppressed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR changes the Arcade SDK defaults and toolset initialization restore behavior to tolerate decommissioned/unavailable NuGet package sources during restore, allowing restore to continue using remaining configured sources (addressing scenarios like disabled AzDO transport feeds in older tags).
Changes:
- Default
RestoreIgnoreFailedSourcestotruein Arcade SDKProjectDefaults.props(overrideable when explicitly set). - Pass
RestoreIgnoreFailedSources=trueduring toolset initialization restore ineng/common/tools.shandeng/common/tools.ps1so toolset acquisition also tolerates dead feeds.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Microsoft.DotNet.Arcade.Sdk/tools/ProjectDefaults.props | Sets a default MSBuild/NuGet restore property to ignore failed sources so restore can fall back to other feeds. |
| eng/common/tools.sh | Adds RestoreIgnoreFailedSources=true to the toolset restore MSBuild invocation. |
| eng/common/tools.ps1 | Adds RestoreIgnoreFailedSources=true to the toolset restore MSBuild invocation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/backport to release/10.0 |
|
/backport to main |
|
Started backporting to |
|
Started backporting to |
|
@akoeplinger backporting to git am output$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Tolerate decommissioned package sources during restore (release/9.0)
Using index info to reconstruct a base tree...
M eng/common/tools.ps1
M eng/common/tools.sh
M src/Microsoft.DotNet.Arcade.Sdk/tools/ProjectDefaults.props
Falling back to patching base and 3-way merge...
Auto-merging eng/common/tools.ps1
CONFLICT (content): Merge conflict in eng/common/tools.ps1
Auto-merging eng/common/tools.sh
CONFLICT (content): Merge conflict in eng/common/tools.sh
Auto-merging src/Microsoft.DotNet.Arcade.Sdk/tools/ProjectDefaults.props
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Tolerate decommissioned package sources during restore (release/9.0)
Error: The process '/usr/bin/git' failed with exit code 128 |
Problem
Servicing builds of
dotnet/runtime(and other Arcade-based repos) can fail during NuGet restore when a transport feed referenced inNuGet.confighas been disabled/decommissioned after a release. For example, buildingdotnet/runtimeat tagv9.0.11from a clean cache fails with:because the
darc-pub-dotnet-emsdktransport feed has been disabled. The packages it once contained are all available from other configured sources, so restore could succeed if it simply skipped the dead feed.See dotnet/runtime#129694.
Fix
Default
RestoreIgnoreFailedSources=trueso restore tolerates an unavailable source and falls back to the remaining sources instead of failing outright:ProjectDefaults.props— sets the default for every project's NuGet restore. It's conditional, so repos and command lines can still override it explicitly (e.g./p:RestoreIgnoreFailedSources=false).eng/common/tools.ps1/eng/common/tools.sh— also passes the flag on the toolsetrestore.projinvocation, because that generated project sets_SuppressSdkImports=trueand therefore never imports the Arcade SDK props.Verification
Reproduced the failure and validated the fix using the exact
v9.0.11toolchain (SDK9.0.111, Arcade SDK9.0.0-beta.25515.2) against a disabled AzDO feed:NU1301: Unable to load the service index— restore failsRestoreIgnoreFailedSources=true(fromProjectDefaults.props)NU1801warning — restore succeeds via the working sourcesThe property was confirmed to evaluate to
truefromProjectDefaults.propsduring theRestoretarget, and the disabled-feed error is downgraded from an error to a warning.Note
This PR was generated with the assistance of GitHub Copilot.