Repository navigation
[ci] Isolate Unix .NET CLI first-run state - #13397
Merged
Merged
Conversation
Moving DOTNET_ROOT does not move first-run sentinels, so a hosted agent with a non-writable ~/.dotnet still fails before build-server shutdown can run. Set a fresh DOTNET_CLI_HOME under Agent.TempDirectory for subsequent job steps. Preserve NuGet configuration, credential providers, and caches through links to the existing home, and keep both existing and job-local global tools discoverable without changing HOME or shared-directory permissions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the Unix CI change isolating .NET CLI first-run state.
No open issues 🎉
What changed in this PR
This PR isolates .NET CLI first-run state in the shared Unix CI setup, addressing macOS permission failures that moving DOTNET_ROOT alone does not resolve.
Changes:
- Creates a fresh
DOTNET_CLI_HOMEunderAgent.TempDirectoryand propagates it to subsequent steps. - Links existing NuGet and local-data directories to preserve configuration, credential discovery, and caches.
- Adds original and job-local global-tool directories to
PATH, without changingHOMEor Windows setup.
| File | Description |
|---|---|
build-tools/automation/yaml-templates/use-dot-net.yaml |
Isolates Unix CLI state while preserving access to existing NuGet data and global tools. |
Review effort: Balanced
Member
Author
|
@dalexsoto review |
simonrozsival
enabled auto-merge (squash)
November 4, 2026 16:41
dalexsoto
approved these changes
Nov 4, 2026
dalexsoto
left a comment
Member
There was a problem hiding this comment.
Static review found no blocking issues in this revision. The Unix CLI-home isolation preserves existing NuGet state and both global-tool locations across the setup/build/test consumers, while leaving HOME and Windows setup unchanged.
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: #13376
Context: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1663841
The macOS MSBuild test job fails in
dotnet build-server shutdown, before tests run:The bootstrap SDK update in #13376 moves
DOTNET_ROOTout of the potentially non-writable~/.dotnet, but first-run initialization still writes its version-specific sentinels there. Installing a new SDK can therefore expose the existing agent-home permissions problem. The subsequentdotnet --infocheck does not exercise this initialization: it succeeds even when shutdown cannot create its sentinel. This is not specific to .NET 11; the same failure reproduces with .NET 10.Give the shared Unix setup a fresh
DOTNET_CLI_HOMEunderAgent.TempDirectoryand propagate it to subsequent job steps. NuGet also honorsDOTNET_CLI_HOME, so link the existing.nugetand.localdirectories into the temporary home to preserve configuration, credential-provider discovery, and caches. Keep both original and job-local global tools discoverable throughPATH. LeaveHOME, Windows setup, and shared-home permissions unchanged, without suppressing failures.Validation:
python3 /Users/simon/.copilot/session-state/0b56633e-c42d-4d10-84b4-09137b9f923d/files/validate-cli-home.py --sdk-version 11.0.100-rc.2.26504.105— passed.python3 /Users/simon/.copilot/session-state/0b56633e-c42d-4d10-84b4-09137b9f923d/files/validate-cli-home.py --sdk-version 10.0.402— passed.bash -non both rendered installer variants — passed through the harness.git diff --check— passed.The local harness, retained as a session artifact rather than checked in, reproduces the original permission failure with real CLI commands and a synthetic read-only
.dotnet. It then executes the template's actual Bash body and confirms shutdown succeeds, sentinels stay isolated, and tool discovery, user NuGet configuration/plugins, caches, and explicit cache overrides remain intact. Both installer cleanup settings, repeated setup, and paths containing spaces pass. Only download/installation is stubbed to reuse installed SDKs; shared-home permissions remain unchanged.All 48 Azure pipeline YAML files also parsed successfully:
Live Azure execution/template expansion, authenticated NuGet feeds, Linux/Windows execution, and the exact RC3 SDK were not exercised. No product SDK build or device tests were run for this pipeline-only change.