Skip to content

Configure Dependabot to update NuGet dependencies not automated by Maestro - #68012

Merged
wtgodbe merged 4 commits into
dotnet:mainfrom
wtgodbe:wtgodbe/dependabot-nuget
Jul 27, 2026
Merged

wtgodbe merged 4 commits into
dotnet:mainfrom
wtgodbe:wtgodbe/dependabot-nuget

Conversation

@wtgodbe

@wtgodbe wtgodbe commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

Fleshes out the previously-disabled nuget entry in .github/dependabot.yml for main, modeled on efcore's dependabot.yml. Previously open-pull-requests-limit: 0 disabled version-update PRs entirely.

  • open-pull-requests-limit: 10
  • Weekly schedule (Monday), minor+patch updates only
  • cooldown: default-days: 7 (ref)
  • Registers dotnet-public feed (matches NuGet.config)
  • Ignores every <Dependency> in eng/Version.Details.xml (already handled by Maestro/VMR codeflow) plus the 4 IdentityModel packages pinned via $(IdentityModelVersion)
  • Groups updates by package-name prefix (Grpc.*, System.*, Microsoft.Extensions.*, etc., 20 groups total) so related packages land in one PR instead of many; anything unmatched still gets its own PR

release/10.0, release/9.0, release/8.0 entries were removed - see follow-up below. github-actions/gitsubmodule entries are unchanged.

Discovery project (main only, for now)

Most projects declare external packages via <Reference Include="X" /> rather than <PackageReference> (see docs/ReferenceResolution.md), an indirection Dependabot's MSBuild-based NuGet discovery can't see through - so ~90 real dependencies were still invisible to it even with the config above. Adds eng/tools/DependabotDiscovery/DependabotDiscovery.csproj, which restates those packages as ordinary <PackageReference> items using the same eng/Versions.props properties, so Dependabot can find and bump them without changing how any real project resolves its dependencies. It's never built, packed, or signed - see the file header and its README.md for the full exclusion rules and rationale.

Also:

  • CodeCheck.ps1 fails if eng/Dependencies.props changes without a matching update to this file.
  • Directory.Build.props/.targets skip importing the build-time-generated artifacts/bin/GenerateFiles/Directory.Build.{props,targets} when DEPENDABOT_NATIVE_HELPERS_PATH is set (set in Dependabot's own job containers) - those files never exist under Dependabot's un-built clone, which otherwise breaks MSBuild evaluation repo-wide under Dependabot. No effect on normal builds/CI.

Verified end-to-end against dependabot-core's real DiscoveryWorker built from source: all 93 packages are discovered as top-level, updatable dependencies with correctly-resolved versions.

Follow-up: release-branch nuget entries were removed for now - like main before the discovery project, they'd only scan directory: "/", which can't see most real dependencies (declared via <Reference>, not <PackageReference>). Re-add them once eng/tools/DependabotDiscovery is ported to those branches.

Co-authored-by: Copilot [email protected]

Copilot AI review requested due to automatic review settings July 24, 2026 20:13
@wtgodbe
wtgodbe requested a review from a team as a code owner July 24, 2026 20:13

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

Updates this repo’s Dependabot configuration to re-enable and scope NuGet dependency update PRs (for dependencies not already handled by Maestro/VMR flow), across main and supported release branches.

Changes:

  • Adds a dotnet-public NuGet registry entry and wires it into NuGet update checks.
  • Replaces the previously-disabled NuGet updater with 4 branch-targeted NuGet update entries (weekly, staggered days; main minor/patch only, release branches patch only).
  • Adds extensive ignore lists to prevent Dependabot from proposing updates for Maestro-managed dependencies and IdentityModel packages pinned via eng/Versions.props.
Comments suppressed due to low confidence (2)

.github/dependabot.yml:286

  • The commit-message prefix for this release branch is missing the trailing space that other entries in this file use. Without it, the generated commit subject typically ends up as "[release/9.0]Bump …".
  commit-message:
    prefix: "[release/9.0]"

.github/dependabot.yml:414

  • The commit-message prefix for this release branch is missing the trailing space that other entries in this file use. Without it, the generated commit subject typically ends up as "[release/8.0]Bump …".
  commit-message:
    prefix: "[release/8.0]"

Comment thread .github/dependabot.yml Resolved
@wtgodbe
wtgodbe force-pushed the wtgodbe/dependabot-nuget branch from 64960cc to 376cfec Compare July 24, 2026 20:17
…estro

Fleshes out the previously-disabled nuget entry in .github/dependabot.yml
into four fully-configured entries (main, release/10.0, release/9.0,
release/8.0), modeled on dotnet/efcore's dependabot.yml, so Dependabot
keeps NuGet packages that aren't already flowed in by darc/Maestro
up to date and free of known vulnerabilities.

- Weekly schedule (staggered by branch), no cap on open PRs
  (open-pull-requests-limit: 999 - Dependabot has no literal "unlimited"
  setting), and a 7-day cooldown on all updates before Dependabot will
  open a PR for a new version.
- main allows minor and patch updates; release branches are limited to
  patch-only, consistent with each branch's stability expectations.
- Registers the dotnet-public NuGet feed (matching NuGet.config) so
  Dependabot resolves packages the same way our build does.
- Ignores every package name that appears as a <Dependency> in that
  branch's eng/Version.Details.xml, since those are already kept current
  by Maestro dependency flow / VMR codeflow and would otherwise conflict
  with darc-managed PRs.
- Also ignores the four Microsoft.IdentityModel.*/System.IdentityModel.*
  packages whose version is pinned centrally via the shared
  $(IdentityModelVersion) property in eng/Versions.props.

Co-authored-by: Copilot <[email protected]>
@wtgodbe
wtgodbe force-pushed the wtgodbe/dependabot-nuget branch from 376cfec to 975e74f Compare July 24, 2026 20:18
@wtgodbe
wtgodbe marked this pull request as draft July 24, 2026 20:31
Will Godbe and others added 3 commits July 24, 2026 16:10
…ckages

Most projects declare external packages via <Reference Include="X" />
(see docs/ReferenceResolution.md), an indirection Dependabot's MSBuild-based
NuGet discovery can't see through, so ~90 real dependencies were invisible
to it. eng/tools/DependabotDiscovery/DependabotDiscovery.csproj restates
those packages as ordinary <PackageReference> items using the same
eng/Versions.props properties, so Dependabot can find and bump them without
changing how any real project resolves its dependencies.

- Never built/packed/signed: not in AspNetCore.slnx, nothing globs
  eng/tools/** into the real build.
- Excludes Maestro-managed and IdentityModel-pinned packages (handled by
  other automation), in-repo ProjectReferenceProvider mappings, vestigial
  eng/Dependencies.props entries with no resolvable version, and two
  packages dependabot-core itself can never treat as updatable regardless
  of how they're declared (NETStandard.Library, PublicApiAnalyzers).
- CodeCheck.ps1 now fails if eng/Dependencies.props changes without a
  matching update to this file.
- .github/dependabot.yml gets a second nuget directory entry for this
  project.
- docs/ReferenceResolution.md documents the new step for adding packages.
- Directory.Build.props/targets: skip importing the build-time-generated
  artifacts/bin/GenerateFiles/Directory.Build.{props,targets} when
  DEPENDABOT_NATIVE_HELPERS_PATH is set (set in Dependabot's own NuGet job
  containers. Those files never exist under Dependabot's un-built clone,
  which otherwise breaks MSBuild evaluation repo-wide under Dependabot;
  this has no effect on normal builds/CI.

Verified end-to-end against dependabot-core's real DiscoveryWorker built
from source: all 93 packages are discovered as top-level, updatable
dependencies with correctly-resolved versions.

Co-authored-by: Copilot <[email protected]>
EOF
)
The release/10.0, 9.0, 8.0 nuget entries only scan directory: "/", which
(like main before DependabotDiscovery.csproj) can't see most real
dependencies since they're referenced via <Reference>, not
<PackageReference>. Remove them for now; re-add once the discovery
project is ported to release branches.

Group main's nuget updates by package-name prefix so related packages
(e.g. all Grpc.*, all System.*) are proposed in a single PR instead of
one per package. Anything not matched by a group still gets its own PR.

Co-authored-by: Copilot <[email protected]>
…ackage in README

Move detailed rationale out of the csproj header into README.md, and
add an 'Adding a package' section covering the restore-then-fix-TFM
workflow (NU1202 -> TFM-conditioned ItemGroup, NU1101 -> feed mirroring).

Co-authored-by: Copilot <[email protected]>
@wtgodbe
wtgodbe marked this pull request as ready for review July 24, 2026 23:22
@wtgodbe
wtgodbe merged commit 07e3015 into dotnet:main Jul 27, 2026
26 of 27 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 28, 2026
wtgodbe added a commit that referenced this pull request Jul 30, 2026
…nges (#68097)

* Only require DependabotDiscovery.csproj update for non-Maestro dependency changes

The CodeCheck added in #68012 flagged any add/remove in eng/Dependencies.props
as requiring a matching update to eng/tools/DependabotDiscovery/DependabotDiscovery.csproj.
This incorrectly fires when a Maestro-managed package is renamed (as in #68014),
since that shows up as one add + one remove even though DependabotDiscovery.csproj
never referenced it (Maestro-managed packages are excluded, see the project's README).

Now the check compares the set of <LatestPackageReference Include="..." /> names
before/after and only requires a DependabotDiscovery.csproj update when an added or
removed package has no matching version property in eng/Version.Details.props
(i.e. isn't managed by Maestro).

Co-authored-by: Copilot <[email protected]>

* Address PR review feedback: fix regex, avoid fragile array-return pattern, cover all DependabotDiscovery exclusion categories

Copilot's automated review on #68097 caught two real bugs:
- The Include="..." regex only matched self-closing tags with no other
  attributes, silently missing entries like
  <LatestPackageReference Include="xunit.v3" Version="$(XunitV3Version)" />.
  Fixed with a regex that tolerates any attributes/tag layout, and now joins
  file content into one string so a tag split across lines is still matched.
- 'return , $x' combined with inconsistent @(...) wrapping at call sites
  caused double array-wrapping in some paths, silently shrinking the
  Maestro-managed-properties set from ~440 entries to 1-2. Removed the
  comma-trick entirely; every call site now consistently wraps in @(...).

Additionally, two independent review agents pointed out that
eng/tools/DependabotDiscovery/README.md documents more exclusion categories
than just Maestro: packages pinned via the shared $(IdentityModelVersion)
property, packages mapped to an in-repo project via ProjectReferenceProvider
(eng/ProjectReferences.props), and two hard-coded packages
(NETStandard.Library, Microsoft.CodeAnalysis.PublicApiAnalyzers). The check
now recognizes all of these, matching the original error message's intent
('isn't managed by Maestro or the shared $(IdentityModelVersion) property').

Verified end-to-end in isolated worktrees against the real repo history:
- PR #68014's actual rename (Maestro-managed) - passes
- A synthetic new, non-excluded package addition - still fails as expected
- A full IdentityModel-managed rename (Dependencies.props + Versions.props) - passes
- A ProjectReferenceProvider-mapped name - passes
- The hard-coded NETStandard.Library exclusion - passes

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Will Godbe <[email protected]>
Co-authored-by: Copilot <[email protected]>
wtgodbe added a commit that referenced this pull request Aug 3, 2026
)

The dynamic Dependabot nuget-updater job (dynamic/dependabot/dependabot-updates)
has been timing out/getting cancelled on every run since #68012 merged
(e.g. https://github.com/dotnet/aspnetcore/actions/runs/30814186376), hitting
an internal ~55 minute job cap enforced by GitHub's Dependabot service.

The job performs an individual "single restore" per discovered .csproj file
under the scanned directories (~11.8s/project observed). The repo has 600+
.csproj files, but only 26 of them have any explicit PackageReference
Version="..." attribute - the rest resolve versions indirectly via
Directory.Build.props/Dependencies.props (LatestPackageReference) or
reference in-repo shared-framework assemblies, so scanning them adds restore
time without adding anything Dependabot can act on.

Exclude test/sample/benchmark/perf trees, which account for the bulk of the
low-value scans, bringing the scanned project count from 618 down to ~219
(~43 min estimated restore time, comfortably under the cap). The excluded
csproj files that do have explicit package versions
(e.g. src/Mvc/perf/benchmarkapps/BasicApi, IIS.NewHandler.FunctionalTests,
InProcessNewShimWebSite) are intentionally pinned to old versions for
legacy/back-compat testing and shouldn't be bumped by Dependabot anyway.

Co-authored-by: Will Godbe <[email protected]>
Co-authored-by: Copilot <[email protected]>
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