Skip to content

Commit 7bb0446

Browse files
agockeCopilot
andauthored
Enable sccache for linux-musl-x64 coreclr builds (#128050)
> [!NOTE] > This PR was generated with the assistance of GitHub Copilot. ## Summary Extends sccache caching from linux-x64 to also cover linux-musl-x64 coreclr build legs. Based on the linux-x64 results (~9 min/leg gross savings, 97.59% hit rate at steady state), this should provide similar speedups for the musl legs. ## Changes - **setup-sccache.yml**: Widen condition to include `osSubgroup == '_musl'`; add `osSubgroup` to cache key to keep musl/glibc caches separate - **sccache-stats.yml**: Widen condition to match ## Why this works - The sccache NuGet package (v0.15.0) is a **statically-linked** binary — verified with `file` showing `static-pie linked`. Works on both glibc and musl. - The sccache package is already downloaded by `runtime-prereqs.proj` on all Linux CI builds (line 13-14, condition: `IsOsPlatform(Linux)`). - Cache keys include `osSubgroup` so musl builds get `sccache|linux_musl|x64|...` vs `sccache|linux|x64|...` for glibc — no cross-contamination. - For non-musl builds, `osSubgroup` is empty, so the key is **unchanged** — existing caches remain valid. ## Also included `SCCACHE_CACHE_SIZE=3.5G` limit (from #128048) to prevent unbounded cache growth. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ea0cf22 commit 7bb0446

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

eng/pipelines/coreclr/templates/sccache-stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ parameters:
1212
osSubgroup: ''
1313

1414
steps:
15-
- ${{ if and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubgroup, ''), eq(parameters.archType, 'x64')) }}:
15+
- ${{ if and(eq(parameters.osGroup, 'linux'), or(eq(parameters.osSubgroup, ''), eq(parameters.osSubgroup, '_musl')), eq(parameters.archType, 'x64')) }}:
1616
- script: sccache --show-stats || true
1717
displayName: Sccache stats
1818
condition: always()

eng/pipelines/coreclr/templates/setup-sccache.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ parameters:
1515
sccacheVersion: '0.15.0'
1616

1717
steps:
18-
- ${{ if and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubgroup, ''), eq(parameters.archType, 'x64')) }}:
18+
- ${{ if and(eq(parameters.osGroup, 'linux'), or(eq(parameters.osSubgroup, ''), eq(parameters.osSubgroup, '_musl')), eq(parameters.archType, 'x64')) }}:
1919
# Set up the Azure Pipeline Cache for sccache's local cache directory.
2020
# Use a rolling key so each build can update the cache; restoreKeys
2121
# falls back to the most recent saved entry.
@@ -30,10 +30,10 @@ steps:
3030
displayName: Sccache cache
3131
continueOnError: true
3232
inputs:
33-
key: sccache | ${{ parameters.osGroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }} | "$(Build.BuildId)"
33+
key: sccache | ${{ parameters.osGroup }}${{ parameters.osSubgroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }} | "$(Build.BuildId)"
3434
path: $(Pipeline.Workspace)/.sccache
3535
restoreKeys: |
36-
sccache | ${{ parameters.osGroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }}
36+
sccache | ${{ parameters.osGroup }}${{ parameters.osSubgroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }}
3737
3838
# Configure sccache environment and add binary to PATH.
3939
# The sccache package is restored by runtime-prereqs.proj during the build.

0 commit comments

Comments
 (0)