Skip to content

Test sccache with temp copy#124074

Draft
agocke wants to merge 34 commits intodotnet:mainfrom
agocke:test-sccache
Draft

Test sccache with temp copy#124074
agocke wants to merge 34 commits intodotnet:mainfrom
agocke:test-sccache

Conversation

@agocke
Copy link
Member

@agocke agocke commented Feb 6, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 6, 2026 08:02
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Feb 6, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds experimental sccache (compiler caching tool) support for linux-x64 builds in the dotnet/runtime repository. The implementation checks for a sccache binary in the repository root and enables it for CoreCLR native builds by setting appropriate environment variables including Azure blob storage configuration.

Changes:

  • Adds sccache enablement logic in eng/build.sh for linux-x64 builds
  • Configures Azure blob storage as the cache backend (container: runtime-cache)
  • Sets environment variables consumed by src/coreclr/build-runtime.sh to use sccache as a CMake compiler launcher


# Enable sccache for linux-x64 builds if the binary is present in the repo root.
if [[ "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prepending the repo root to PATH creates a security risk where any executable in the repo root can shadow system binaries during the build. Since sccache is checked to exist at a specific location, consider using the absolute path to invoke sccache instead. For example, you could set SCCACHE_PATH environment variable with the full path, and have the build scripts use that, or modify src/coreclr/build-runtime.sh to check for the sccache binary path directly rather than relying on PATH lookup.

Suggested change
export PATH="$scriptroot/..:$PATH"
export SCCACHE_PATH="$scriptroot/../sccache"
export PATH="$PATH:$scriptroot/.."

Copilot uses AI. Check for mistakes.
Comment on lines 587 to 594
# Enable sccache for linux-x64 builds if the binary is present in the repo root.
if [[ "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
export USE_SCCACHE=true
export SCCACHE_AZURE_BLOB_CONTAINER=runtime-cache
# SCCACHE_AZURE_CONNECTION_STRING must be set as a CI secret/environment variable.
echo "sccache enabled for linux-x64 build"
fi
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sccache integration only affects CoreCLR builds because only src/coreclr/build-runtime.sh checks the USE_SCCACHE environment variable. Other native components (Mono, native libs, host/corehost) do not currently respect this setting and will not use sccache even when enabled. Consider documenting this limitation in the comment, or adding USE_SCCACHE support to other native build scripts if caching is desired for those components as well.

Copilot uses AI. Check for mistakes.
Comment on lines 587 to 589
# Enable sccache for linux-x64 builds if the binary is present in the repo root.
if [[ "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A 15.71 MB sccache binary appears to be checked into the repository root. Since the PR title mentions "temp copy", this seems intended as a temporary test. However, checking large binaries into git history can bloat the repository permanently. Consider using a different approach for testing, such as downloading sccache in CI, or documenting that this binary should not be committed and adding it to .gitignore.

Suggested change
# Enable sccache for linux-x64 builds if the binary is present in the repo root.
if [[ "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
# Enable sccache for linux-x64 builds if it is available on PATH.
if [[ "$os" == "linux" && "$arch" == "x64" ]] && command -v sccache >/dev/null 2>&1; then

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 6, 2026 08:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings February 6, 2026 23:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

Comment on lines 597 to 598
fi
sccache -s
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the script runs with set -e, invoking sccache -s unconditionally inside this block can abort the entire build if sccache is not on PATH (it’s only added in the connection-string branch) or if the repo-root sccache file isn’t executable. Consider either (1) calling it via the absolute path and only after verifying it’s executable, or (2) guarding the stats call behind the same enablement check / making it non-fatal.

Suggested change
fi
sccache -s
if [[ -x "$scriptroot/../sccache" ]]; then
"$scriptroot/../sccache" -s || echo "Warning: failed to collect sccache stats"
else
echo "Warning: sccache binary at '$scriptroot/../sccache' is not executable; skipping sccache stats"
fi
fi

Copilot uses AI. Check for mistakes.
eng/build.sh Outdated
Comment on lines 588 to 598
if [[ "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
if [[ -z "${SCCACHE_AZURE_CONNECTION_STRING:-}" ]]; then
echo "Warning: SCCACHE_AZURE_CONNECTION_STRING not set; sccache will not be enabled for linux-x64 build"
else
export PATH="$scriptroot/..:$PATH"
export USE_SCCACHE=true
export SCCACHE_AZURE_BLOB_CONTAINER=runtime-cache
# SCCACHE_AZURE_CONNECTION_STRING must be set as a CI secret/environment variable.
echo "sccache enabled for linux-x64 build"
fi
sccache -s
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition only checks -f "$scriptroot/../sccache", but the code later executes sccache as a command name. If the file exists but isn’t executable (or isn’t found via PATH), this will fail. Prefer checking -x and executing "$scriptroot/../sccache" (or ensuring PATH is updated before any invocation).

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 7, 2026 00:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

export SCCACHE_AZURE_CONNECTION_STRING="BlobEndpoint=https://runsccache.blob.core.windows.net"
export SCCACHE_AZURE_NO_CREDENTIALS=true
echo "sccache enabled for linux-x64 build"
sccache -s
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because eng/build.sh runs with set -e, a failure from sccache -s (e.g., server startup failure, unsupported backend, transient network issue) will abort the entire build even though this is just a diagnostic step. Consider making the stats call best-effort (or gating it behind an explicit opt-in) so cache issues don't fail the build.

Suggested change
sccache -s
sccache -s || echo "sccache stats are unavailable; continuing without cache stats"

Copilot uses AI. Check for mistakes.
Comment on lines 587 to 595
# Enable sccache for linux-x64 builds if the binary is present in the repo root.
if [[ "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
export USE_SCCACHE=true
export SCCACHE_AZURE_BLOB_CONTAINER=runtime-cache
export SCCACHE_AZURE_CONNECTION_STRING="BlobEndpoint=https://runsccache.blob.core.windows.net"
export SCCACHE_AZURE_NO_CREDENTIALS=true
echo "sccache enabled for linux-x64 build"
sccache -s
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guard only checks -f "$scriptroot/../sccache", but with set -e the build will still fail later if that file isn't executable or can't be invoked. It should check that the binary is executable (and ideally invoke it via its full path) before enabling USE_SCCACHE/modifying PATH.

Suggested change
# Enable sccache for linux-x64 builds if the binary is present in the repo root.
if [[ "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
export USE_SCCACHE=true
export SCCACHE_AZURE_BLOB_CONTAINER=runtime-cache
export SCCACHE_AZURE_CONNECTION_STRING="BlobEndpoint=https://runsccache.blob.core.windows.net"
export SCCACHE_AZURE_NO_CREDENTIALS=true
echo "sccache enabled for linux-x64 build"
sccache -s
# Enable sccache for linux-x64 builds if the binary is present and executable in the repo root.
if [[ "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" && -x "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
export USE_SCCACHE=true
export SCCACHE_AZURE_BLOB_CONTAINER=runtime-cache
export SCCACHE_AZURE_CONNECTION_STRING="BlobEndpoint=https://runsccache.blob.core.windows.net"
export SCCACHE_AZURE_NO_CREDENTIALS=true
echo "sccache enabled for linux-x64 build"
"$scriptroot/../sccache" -s

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 7, 2026 02:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.

eng/build.sh Outdated
Comment on lines 588 to 589
if [[ "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enablement check uses -f "$scriptroot/../sccache", but that doesn't guarantee the file is executable. If the file exists without execute permissions, the later sccache -s/compiler launcher will fail and stop the build. Prefer checking -x (and/or verifying command -v sccache after updating PATH) before enabling.

Copilot uses AI. Check for mistakes.

# Enable sccache for linux-x64 builds if the binary is present in the repo root.
if [[ "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prepending the repo root to PATH can unintentionally shadow system tools if a same-named executable exists in the repo (now or in the future), making builds harder to reason about. A safer pattern is to invoke sccache via an explicit absolute path and/or add only a dedicated tools directory to PATH.

Suggested change
export PATH="$scriptroot/..:$PATH"
export PATH="$PATH:$scriptroot/.."

Copilot uses AI. Check for mistakes.
Comment on lines +636 to +638
if [[ "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
sccache -s
fi
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same linux/x64 + sccache-present condition is duplicated here and above. Consider factoring it into a single helper/variable to avoid future drift (e.g., if the condition or path changes in one place but not the other).

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 10, 2026 03:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Comment on lines 190 to 195
<WriteLinesToFile
Condition="'$(NativeVersionFile)' != '' and '$(NativeVersionFile.EndsWith(`.h`))' == 'true'"
File="$(NativeVersionFile)"
Lines="$(_FixedNativeVersionH)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MSBuild Condition uses backticks in $(NativeVersionFile.EndsWith(.h)), which isn't valid syntax for a string literal and will likely fail evaluation. Use standard quoting (e.g., EndsWith('.h')) and consider using the $([System.String]::...) pattern used elsewhere in eng/*.props for consistency.

Copilot uses AI. Check for mistakes.
Comment on lines 205 to 218
#define RuntimeAssemblyMajorVersion 42
#define RuntimeAssemblyMinorVersion 42

#define RuntimeFileMajorVersion $(FileVersion.Split('.')[0])
#define RuntimeFileMinorVersion $(FileVersion.Split('.')[1])
#define RuntimeFileBuildVersion $(FileVersion.Split('.')[2])
#define RuntimeFileRevisionVersion $(FileVersion.Split('.')[3])
#define RuntimeFileMajorVersion 42
#define RuntimeFileMinorVersion 42
#define RuntimeFileBuildVersion 42
#define RuntimeFileRevisionVersion 42424

#define RuntimeProductMajorVersion $(Version.Split(".-")[0])
#define RuntimeProductMinorVersion $(Version.Split(".-")[1])
#define RuntimeProductPatchVersion $(Version.Split(".-")[2])
#define RuntimeProductMajorVersion 42
#define RuntimeProductMinorVersion 42
#define RuntimeProductPatchVersion 42

#define RuntimeProductVersion $(Version)
#define RuntimeProductVersion 42.42.42
]]>
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding the contents of runtime_version.h to constant values (42/42424) will change the runtime/product version information for all builds that import this target, not just CI sccache experiments. This should be gated behind an explicit property/flag (or limited to a dedicated CI pipeline) so official and developer builds continue to emit the real version numbers.

Copilot uses AI. Check for mistakes.
Comment on lines 148 to 156
<!--
Override the Arcade-generated native version files to use a fixed version string.
This prevents cache invalidation in CI when OfficialBuildId changes between builds.
-->
<Target Name="HardcodeNativeVersionFile"
AfterTargets="GenerateNativeVersionFile">
<PropertyGroup>
<_FixedNativeVersionH>
<![CDATA[
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new target overwrites the generated native version header with a fixed version (42.42.42.42424). As written it will run whenever GenerateNativeVersionFile runs, which risks stamping incorrect version resources into native binaries outside the intended sccache test scenario. Please make this conditional (e.g., only when a dedicated CI property is set) or move it to a test-only build path.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 10, 2026 06:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

Comment on lines 190 to 195
<WriteLinesToFile
Condition="'$(NativeVersionFile)' != '' and '$(NativeVersionFile.EndsWith(`.h`))' == 'true'"
File="$(NativeVersionFile)"
Lines="$(_FixedNativeVersionH)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Condition="'$(NativeVersionFile)' != '' and '$(NativeVersionFile.EndsWith(.h))' == 'true'" uses an EndsWith call with backticks, which doesn't match the MSBuild string-method patterns used elsewhere in the repo (typically $([System.String]::Copy(...).EndsWith('.h'))). This is likely to evaluate incorrectly (or fail to parse), causing the version file to not be written.

Copilot uses AI. Check for mistakes.
#undef VER_FILEVERSION
#define VER_FILEVERSION 42,42,42,42424
#undef VER_FILEVERSION_STR
#define VER_FILEVERSION_STR "42,42,42,42424"
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The injected VER_FILEVERSION_STR value uses commas ("42,42,42,42424") while VER_PRODUCTVERSION_STR uses dots. Windows version resource string fields are typically dot-separated, and this mismatch can produce incorrect file version metadata. Use a consistent dot-separated string for VER_FILEVERSION_STR (and keep it aligned with VER_FILEVERSION).

Suggested change
#define VER_FILEVERSION_STR "42,42,42,42424"
#define VER_FILEVERSION_STR "42.42.42.42424"

Copilot uses AI. Check for mistakes.
Comment on lines 148 to 186
<!--
Override the Arcade-generated native version files to use a fixed version string.
This prevents cache invalidation in CI when OfficialBuildId changes between builds.
-->
<Target Name="HardcodeNativeVersionFile"
AfterTargets="GenerateNativeVersionFile">
<PropertyGroup>
<_FixedNativeVersionH>
<![CDATA[
#ifndef VER_COMPANYNAME_STR
#define VER_COMPANYNAME_STR "Microsoft Corporation"
#endif
#ifndef VER_FILEDESCRIPTION_STR
#define VER_FILEDESCRIPTION_STR "$(AssemblyName)"
#endif
#ifndef VER_INTERNALNAME_STR
#define VER_INTERNALNAME_STR VER_FILEDESCRIPTION_STR
#endif
#ifndef VER_ORIGINALFILENAME_STR
#define VER_ORIGINALFILENAME_STR VER_FILEDESCRIPTION_STR
#endif
#ifndef VER_PRODUCTNAME_STR
#define VER_PRODUCTNAME_STR ".NET"
#endif
#undef VER_PRODUCTVERSION
#define VER_PRODUCTVERSION 42,42,42,42424
#undef VER_PRODUCTVERSION_STR
#define VER_PRODUCTVERSION_STR "42.42.42.42424"
#undef VER_FILEVERSION
#define VER_FILEVERSION 42,42,42,42424
#undef VER_FILEVERSION_STR
#define VER_FILEVERSION_STR "42,42,42,42424"
#ifndef VER_LEGALCOPYRIGHT_STR
#define VER_LEGALCOPYRIGHT_STR "\xa9 Microsoft Corporation. All rights reserved."
#endif
#ifndef VER_DEBUG
#define VER_DEBUG 0
#endif
]]>
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding the native version resource to the constant 42.42.42.42424 (and similar) will stamp produced binaries with an incorrect product/file version and can break consumers/tests that validate runtime versioning. If this is only intended to stabilize sccache keys in CI, it should be gated behind an explicit opt-in property/variable (and/or excluded from official builds) rather than applied unconditionally after GenerateNativeVersionFile.

Copilot uses AI. Check for mistakes.
check_prereqs

if [[ "$USE_SCCACHE" == "true" ]]; then
__CMakeArgs="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache $__CMakeArgs"
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When USE_SCCACHE is set, this unconditionally adds sccache as the C/CXX compiler launcher. If sccache isn't available on PATH, the CMake configure/build will fail with a fairly indirect error. Consider validating sccache is discoverable (e.g., via command -v sccache) and emitting a clear message, or wiring the launcher path explicitly.

Suggested change
__CMakeArgs="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache $__CMakeArgs"
if command -v sccache >/dev/null 2>&1; then
__CMakeArgs="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache $__CMakeArgs"
else
echo "ERROR: USE_SCCACHE is set but 'sccache' was not found in PATH. Please install sccache or unset USE_SCCACHE." 1>&2
exit 1
fi

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 10, 2026 08:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

Comment on lines +592 to +616
# Enable sccache for linux-x64 builds if the binary is present in the repo root.
if [[ "${USE_SCCACHE:-}" != "true" && "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
export USE_SCCACHE=true
export SCCACHE_AZURE_BLOB_CONTAINER=runtime-cache
export SCCACHE_AZURE_CONNECTION_STRING="BlobEndpoint=https://runsccache.blob.core.windows.net"
export SCCACHE_AZURE_NO_CREDENTIALS=true

sccache --stop-server || true

# Disable idle timeout so the server stays alive across long managed-build
# phases that separate native-compilation steps (e.g. clr then libs).
export SCCACHE_IDLE_TIMEOUT=0

# Write sccache logs to the AzDO artifact staging directory so they get published.
# Fall back to the local artifacts/log directory if not running in CI.
if [[ -n "${BUILD_ARTIFACTSTAGINGDIRECTORY:-}" ]]; then
__sccacheLogDir="$BUILD_ARTIFACTSTAGINGDIRECTORY/artifacts/log"
else
__sccacheLogDir="$scriptroot/../artifacts/log"
fi
mkdir -p "$__sccacheLogDir"
SCCACHE_ERROR_LOG="$__sccacheLogDir/sccache_debug.log" SCCACHE_LOG=debug sccache --start-server
echo "sccache enabled for linux-x64 build"
sccache -s
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check for enabling sccache uses -f "$scriptroot/../sccache", which doesn't guarantee the file is executable. If the file exists but isn't marked executable (or is the wrong binary), later calls to sccache/CMake launcher will fail. Consider using -x (and possibly validating sccache --version) before exporting USE_SCCACHE=true.

Suggested change
# Enable sccache for linux-x64 builds if the binary is present in the repo root.
if [[ "${USE_SCCACHE:-}" != "true" && "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
export USE_SCCACHE=true
export SCCACHE_AZURE_BLOB_CONTAINER=runtime-cache
export SCCACHE_AZURE_CONNECTION_STRING="BlobEndpoint=https://runsccache.blob.core.windows.net"
export SCCACHE_AZURE_NO_CREDENTIALS=true
sccache --stop-server || true
# Disable idle timeout so the server stays alive across long managed-build
# phases that separate native-compilation steps (e.g. clr then libs).
export SCCACHE_IDLE_TIMEOUT=0
# Write sccache logs to the AzDO artifact staging directory so they get published.
# Fall back to the local artifacts/log directory if not running in CI.
if [[ -n "${BUILD_ARTIFACTSTAGINGDIRECTORY:-}" ]]; then
__sccacheLogDir="$BUILD_ARTIFACTSTAGINGDIRECTORY/artifacts/log"
else
__sccacheLogDir="$scriptroot/../artifacts/log"
fi
mkdir -p "$__sccacheLogDir"
SCCACHE_ERROR_LOG="$__sccacheLogDir/sccache_debug.log" SCCACHE_LOG=debug sccache --start-server
echo "sccache enabled for linux-x64 build"
sccache -s
# Enable sccache for linux-x64 builds if a working sccache binary is present in the repo root.
if [[ "${USE_SCCACHE:-}" != "true" && "$os" == "linux" && "$arch" == "x64" && -x "$scriptroot/../sccache" ]]; then
if "$scriptroot/../sccache" --version >/dev/null 2>&1; then
export PATH="$scriptroot/..:$PATH"
export USE_SCCACHE=true
export SCCACHE_AZURE_BLOB_CONTAINER=runtime-cache
export SCCACHE_AZURE_CONNECTION_STRING="BlobEndpoint=https://runsccache.blob.core.windows.net"
export SCCACHE_AZURE_NO_CREDENTIALS=true
sccache --stop-server || true
# Disable idle timeout so the server stays alive across long managed-build
# phases that separate native-compilation steps (e.g. clr then libs).
export SCCACHE_IDLE_TIMEOUT=0
# Write sccache logs to the AzDO artifact staging directory so they get published.
# Fall back to the local artifacts/log directory if not running in CI.
if [[ -n "${BUILD_ARTIFACTSTAGINGDIRECTORY:-}" ]]; then
__sccacheLogDir="$BUILD_ARTIFACTSTAGINGDIRECTORY/artifacts/log"
else
__sccacheLogDir="$scriptroot/../artifacts/log"
fi
mkdir -p "$__sccacheLogDir"
SCCACHE_ERROR_LOG="$__sccacheLogDir/sccache_debug.log" SCCACHE_LOG=debug sccache --start-server
echo "sccache enabled for linux-x64 build"
sccache -s
fi

Copilot uses AI. Check for mistakes.
Comment on lines 92 to 99
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/artifacts/helix
includeRootFolder: false
archiveType: $(archiveType)
archiveExtension: $(archiveExtension)
tarCompression: $(tarCompression)
artifactName: CoreCLR_Libraries_TestArtifacts_$(osGroup)$(osSubgroup)_$(archType)_$(_BuildConfig)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job now runs buildArgs: -s clr+libs ... /p:ArchiveTests=true (no libs.tests), but still archives and publishes $(Build.SourcesDirectory)/artifacts/helix. If the build doesn't generate helix payloads without the libs.tests subset, the ArchiveFiles@2 step will fail because the folder doesn't exist. Consider either restoring libs.tests in buildArgs, gating the helix artifact upload on the directory existing, or removing the helix upload from this job.

Copilot uses AI. Check for mistakes.
@agocke agocke closed this Feb 10, 2026
@agocke agocke reopened this Feb 10, 2026
@agocke agocke closed this Feb 11, 2026
@agocke agocke reopened this Feb 11, 2026
Copilot AI review requested due to automatic review settings February 11, 2026 02:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

@agocke agocke closed this Feb 11, 2026
@agocke agocke reopened this Feb 11, 2026
Copilot AI review requested due to automatic review settings February 11, 2026 19:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Comment on lines +592 to +617
# Enable sccache for linux-x64 builds if the binary is present in the repo root.
if [[ "${USE_SCCACHE:-}" != "true" && "$os" == "linux" && "$arch" == "x64" && -f "$scriptroot/../sccache" ]]; then
export PATH="$scriptroot/..:$PATH"
export USE_SCCACHE=true
export SCCACHE_AZURE_BLOB_CONTAINER=runtime-cache
export SCCACHE_AZURE_CONNECTION_STRING="BlobEndpoint=https://runsccache.blob.core.windows.net"
export SCCACHE_AZURE_NO_CREDENTIALS=true

sccache --stop-server || true

# Disable idle timeout so the server stays alive across long managed-build
# phases that separate native-compilation steps (e.g. clr then libs).
export SCCACHE_IDLE_TIMEOUT=0

# Write sccache logs to the AzDO artifact staging directory so they get published.
# Fall back to the local artifacts/log directory if not running in CI.
if [[ -n "${BUILD_ARTIFACTSTAGINGDIRECTORY:-}" ]]; then
__sccacheLogDir="$BUILD_ARTIFACTSTAGINGDIRECTORY/artifacts/log"
else
__sccacheLogDir="$scriptroot/../artifacts/log"
fi
mkdir -p "$__sccacheLogDir"
SCCACHE_ERROR_LOG="$__sccacheLogDir/sccache_debug.log" SCCACHE_LOG=debug sccache --start-server
echo "sccache enabled for linux-x64 build"
sccache -s
fi
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block auto-enables sccache for any linux-x64 build whenever a sccache file exists in the repo root, which changes default build behavior and introduces an external cache endpoint dependency for local developer builds as well as CI. It would be safer to make this explicitly opt-in (e.g., require USE_SCCACHE=true) or at least gate it to CI-only via a well-known environment variable (e.g., TF_BUILD/CI).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants