Skip to content

Tolerate decommissioned package sources during restore#17119

Merged
akoeplinger merged 1 commit into
dotnet:mainfrom
akoeplinger:tolerate-decommissioned-sources
Jul 15, 2026
Merged

Tolerate decommissioned package sources during restore#17119
akoeplinger merged 1 commit into
dotnet:mainfrom
akoeplinger:tolerate-decommissioned-sources

Conversation

@akoeplinger

@akoeplinger akoeplinger commented Jul 14, 2026

Copy link
Copy Markdown
Member

Ports the mitigation from #17099 / #17118 to main.

Problem

Servicing builds can fail when a transport feed referenced in NuGet.config has been decommissioned after a release (e.g. dotnet/runtime#129694, the darc-pub-dotnet-emsdk feed). NuGet aborts the whole restore when any configured source is unavailable.

Changes

  • ProjectDefaults.props: default RestoreIgnoreFailedSources=true (conditional, overridable) so every project's MSBuild-based restore falls back to the remaining sources instead of failing. This is the same change as [release/10.0] Tolerate decommissioned package sources during restore #17118.
  • tools.ps1 / tools.sh: on main, InitializeToolset was refactored to acquire the Arcade SDK via dotnet package download instead of an MSBuild restore: Use dotnet package download for toolset initialization dotnet#5909. That command does not honor RestoreIgnoreFailedSources and hard-fails on a dead source, so [release/10.0] Tolerate decommissioned package sources during restore #17118's /p:RestoreIgnoreFailedSources=true argument has no equivalent here. Instead, when the config-driven download fails, retry once against the public dotnet-eng feed directly (via --source, which ignores the other sources) — the Arcade SDK is always published there for public builds. Implemented through a new ignore-failure parameter on the DotNet helper so the primary attempt can fall back instead of terminating the script.

Notes / limitations

  • Internal official builds whose Arcade SDK isn't on the public feed would still fail if their internal feed is the one that's down — unchanged from today (no regression), since a public fallback can't serve an internal-only package.
  • Verified: with runtime's real v9.0.11 NuGet.config (no source mapping, dead transport feed listed first), the config-driven download fails and the dotnet-eng fallback successfully downloads the Arcade SDK.

Servicing builds can 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). This ports the mitigation from dotnet#17118 to main.

- Default RestoreIgnoreFailedSources=true 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.

- The toolset acquisition in tools.ps1/tools.sh no longer runs an MSBuild
  restore (it now uses 'dotnet package download'), which does not honor
  RestoreIgnoreFailedSources and hard-fails when any configured source is
  unavailable. Since the Arcade SDK is always published to the public
  dotnet-eng feed, retry the download against that feed directly (which
  ignores the other sources) when the config-driven download fails. This is
  implemented via a new ignore-failure parameter on the DotNet helper so the
  primary attempt can fall back instead of terminating the script.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9889e061-0a75-4752-9543-beada3bfc16c
Copilot AI review requested due to automatic review settings July 14, 2026 18:25
@akoeplinger akoeplinger requested a review from mmitche July 14, 2026 18:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR mitigates build/restore failures caused by decommissioned or unavailable NuGet sources by making restores tolerate failed sources by default and adding a fallback path for acquiring the Arcade SDK when dotnet package download fails due to a dead feed.

Changes:

  • Default RestoreIgnoreFailedSources=true (overridable) for MSBuild-based restores via Arcade SDK defaults.
  • Add retry logic in InitializeToolset to re-attempt Arcade SDK acquisition from the public dotnet-eng feed when config-driven download fails.
  • Extend the DotNet helper wrappers to optionally return failure to callers (to enable fallback logic) instead of terminating immediately.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Microsoft.DotNet.Arcade.Sdk/tools/ProjectDefaults.props Defaults restores to ignore failed sources so decommissioned feeds don’t hard-fail restore.
eng/common/tools.sh Adds fallback download from dotnet-eng when dotnet package download fails due to an unavailable configured source.
eng/common/tools.ps1 Adds the same fallback logic and introduces an ignore-failure mode in the DotNet wrapper (currently with blocking issues noted in PR comments).
Comments suppressed due to low confidence (1)

eng/common/tools.ps1:866

  • The new DotNet([switch]$ignoreFailure) signature makes the first positional argument bind to ignoreFailure, which will shift/lose the first dotnet argument (e.g. package) and can unintentionally flip the failure behavior. Make ignoreFailure a named-only switch by adding a positional dotnetArgs parameter that captures the remaining arguments, and iterate that parameter instead of $args.
function DotNet([switch]$ignoreFailure) {
  $dotnetRoot = InitializeDotNetCli -install:$restore
  $dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet')

  $cmdArgs = ""
  foreach ($arg in $args) {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread eng/common/tools.ps1
Comment thread eng/common/tools.ps1
# download fails, retry once against that feed directly (which ignores the other sources)
# before giving up, so a single dead source doesn't block the build.
$downloadExitCode = DotNet -ignoreFailure @downloadArgs
if ($downloadExitCode) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Create an issue in dotnet/sdk to support skipping unavailable sources when downloading a package.

@akoeplinger akoeplinger merged commit 3f0ec96 into dotnet:main Jul 15, 2026
10 checks passed
@akoeplinger akoeplinger deleted the tolerate-decommissioned-sources branch July 15, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants