Skip to content

Add opt-in CI MSBuild node reuse via DotNetBuildNodeReuse property - #7211

Merged
JanProvaznik merged 4 commits into
mainfrom
experiment/nodereuse-optin-property
Jun 15, 2026
Merged

JanProvaznik merged 4 commits into
mainfrom
experiment/nodereuse-optin-property

Conversation

@JanProvaznik

@JanProvaznik JanProvaznik commented Jun 12, 2026 •

Copy link
Copy Markdown
Member

Makes MSBuild node reuse opt-in on CI via a property, instead of unconditionally removing the nodeReuse=false opt-outs (the original experiment in #6838). Follows the design of the existing -mt / DotNetBuildMT mechanism.

What it does

  • repo-projects/Directory.Build.props - when /p:DotNetBuildNodeReuse=true is passed (and a repo hasn't set UseNodeReuse=false), export MSBUILD_NODEREUSE_ENABLED=1 to the inner repo build.
  • src/arcade/eng/common build / msbuild / tools scripts - only force nodeReuse=false on CI when MSBUILD_NODEREUSE_ENABLED != 1, and gate the "Node reuse must be disabled in CI build" guard the same way.

Default CI behavior is unchanged (node reuse stays disabled) unless the property is passed:

./build.sh --ci ... /p:DotNetBuildNodeReuse=true

Scope

Per review feedback on #6838, only the outgoing Arcade source is edited:

  • src/arcade/eng/common/** is copied into the inner repo builds by the UpdateEngCommonFiles target (for every repo except the bootstrap-arcade ones), so the source-build product repos pick up the gating at build time.
  • The root /eng/common copy is a tooling file (it must flow from dotnet/arcade; the VMR ChangeValidation step rejects manual edits to it), so it is intentionally not edited here. It will pick up the change once it flows from Arcade.
  • No per-repo src/*/eng/common mirrors are touched (they are regenerated during the build).

Note: because src/arcade is a mirrored mapping, these eng/common edits will back-flow to dotnet/arcade on merge.

Validation

  • The opt-in was exercised on the source-build CI leg (via extraPropertiesStage2: /p:DotNetBuildNodeReuse=true) in an earlier revision of this PR; the SB_* source-build stage-1 and stage-2 legs passed with node reuse enabled. That experiment commit was reverted to keep this PR focused/mergeable.
  • bash -n passes on all modified .sh scripts; the PowerShell parser passes on all modified .ps1 scripts.

@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team June 12, 2026 10:51
By default VMR CI forces MSBuild nodeReuse=false. This adds an opt-in so a
build can keep worker MSBuild nodes alive between invocations, mirroring
the existing -mt / DotNetBuildMT mechanism:

- repo-projects/Directory.Build.props: when /p:DotNetBuildNodeReuse=true is
  passed (and a repo hasn't set UseNodeReuse=false), export
  MSBUILD_NODEREUSE_ENABLED=1 to the inner repo build.
- src/arcade/eng/common build/msbuild/tools scripts: only force
  nodeReuse=false on CI when MSBUILD_NODEREUSE_ENABLED != 1, and gate the
  "Node reuse must be disabled in CI build" guard the same way.

Only src/arcade/eng/common is edited - this is the outgoing Arcade source
that is copied into the inner repo builds by UpdateEngCommonFiles, so the
source-build product repos pick up the gating. The root eng/common copy is
a tooling file that must flow from dotnet/arcade, so it is intentionally
not edited here. Default CI behavior is unchanged unless the property is
passed.

Co-authored-by: Copilot <[email protected]>
@JanProvaznik
JanProvaznik force-pushed the experiment/nodereuse-optin-property branch from 3dca36a to 47cb6ce Compare June 15, 2026 12:54
@JanProvaznik JanProvaznik changed the title [EXPERIMENT] Make CI node reuse opt-in via DotNetBuildNodeReuse + enable on source-build leg Add opt-in CI MSBuild node reuse via DotNetBuildNodeReuse property Jun 15, 2026
@JanProvaznik
JanProvaznik marked this pull request as ready for review June 15, 2026 12:54
Copilot AI review requested due to automatic review settings June 15, 2026 12:54
@JanProvaznik
JanProvaznik requested review from a team as code owners June 15, 2026 12:54
@JanProvaznik

Copy link
Copy Markdown
Member Author

This will be used in MSBuild VMR validation pipeline.

@JanProvaznik
JanProvaznik requested a review from ViktorHofer June 15, 2026 12:58

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment thread src/arcade/eng/common/build.ps1 Resolved
Per review feedback, note in each eng/common build/msbuild/tools script that
MSBUILD_NODEREUSE_ENABLED is internal-testing-only and will be replaced by a
switch (dotnet/arcade#17013), so callers don't depend on it.

Co-authored-by: Copilot <[email protected]>
@JanProvaznik
JanProvaznik enabled auto-merge (squash) June 15, 2026 14:24
@JanProvaznik
JanProvaznik requested a review from ViktorHofer June 15, 2026 14:28
@JanProvaznik
JanProvaznik merged commit d8e2cec into main Jun 15, 2026
11 checks passed
@JanProvaznik
JanProvaznik deleted the experiment/nodereuse-optin-property branch June 15, 2026 19:15
JanProvaznik added a commit to JanProvaznik/dotnet that referenced this pull request Jul 9, 2026
The ChangeValidation ToolingFilesValidation step forbids modifying root eng/common
(^eng/common/.*). The main repos already receive the node-reuse opt-in from
src/arcade/eng/common (merged dotnet#7211/dotnet#7273) via the build-time UpdateEngCommonFiles copy,
so root eng/common edits are unnecessary for server engagement in the important repos.

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