Repository navigation
[CI] Prune Roslyn caches before saving snapshots - #135820
Merged
Merged
Conversation
Cleanup retains entries used or created during the complete job, including test builds. V3 snapshots do not restore oversized old generations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8cf51af-8686-4700-9b01-cb1db7806f25
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Linux/macOS agent execution and end-to-end snapshot saving remain unvalidated.
0 open findings
What changed in this PR
Prunes Roslyn compilation caches before CI snapshot saving to reduce retained cache history and archive disk pressure.
Changes:
- Adds platform-specific pruning with size, disk-space, and error reporting.
- Runs pruning after post-build steps for successful, cache-enabled jobs.
- Starts isolated
roslyn | v3snapshots without restoring older generations.
| File | Description |
|---|---|
| eng/pipelines/coreclr/templates/setup-build-caches.yml | Moves cache keys and restoration to generation v3. |
| eng/pipelines/coreclr/templates/prune-roslyn-cache.yml | Adds Bash and PowerShell pruning steps and diagnostics. |
| eng/pipelines/common/global-build-job.yml | Invokes pruning at the end of the job. |
🧠 Review effort: Balanced
agocke
marked this pull request as draft
October 14, 2026 23:28
agocke
marked this pull request as ready for review
October 14, 2026 23:29
This was referenced Oct 15, 2026
Closed
sbomer
approved these changes
Oct 15, 2026
jjonescz
reviewed
Oct 16, 2026
Removed comment about starting a new cache generation to avoid restoring unpruned snapshots.
This was referenced Oct 17, 2026
Member
Author
|
/ba-g unrelated diagnostics failures |
agocke
enabled auto-merge (squash)
October 17, 2026 02:38
jjonescz
approved these changes
Oct 19, 2026
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.
Summary
Prune Roslyn's compilation cache after all product and test-build steps, before Azure Pipelines saves the cache snapshot.
VBCSCompiler -purgecache:<job-start-time>to discard entries not used during this job, retaining reused and newly created entries.roslyn | v3snapshot generation without fallback to unprunedv1/v2snapshots. Preserve the existing platform, leg, and Debug/Release separation.The final-job hook is conditional on a successful, cache-enabled job. It runs after
postBuildSteps, rather than alongside the existing statistics step, because some legs still compile CoreCLR tests after those statistics are collected. Sccache behavior is unchanged.Motivation
Recent Linux Debug cache saves fail while creating the archive with
No space left on device, preventing fresh snapshots from being published.One sampled Linux Release cache contained 11,430 untouched entries, compared with 288 reused entries and 881 newly stored entries. These are entry counts, not byte measurements or an end-to-end speedup claim, but they show substantial retained history.
This change retains the completed job's working set; it does not impose a hard byte limit. The snapshot-generation change incurs an initial cold Roslyn build for each leg instead of restoring the oversized old snapshots.
Validation
11.0.100-rc.1.26420.103, using disposable cache fixtures.Note
This PR description and code changes were prepared with GitHub Copilot.