Skip to content

jenkins,win: move clcache cache out of user profile - #4472

Open
P4suta wants to merge 1 commit into
nodejs:mainfrom
P4suta:win-clcache-dir
Open

P4suta wants to merge 1 commit into
nodejs:mainfrom
P4suta:win-clcache-dir

Conversation

@P4suta

@P4suta P4suta commented Sep 16, 2026

Copy link
Copy Markdown

Fixes #4471

compile.cmd sets CLCACHE_BASEDIR but not CLCACHE_DIR, so clcache stores its cache in %USERPROFILE%\clcache. That is the configuration reported in frerich/clcache#342 to fail with:

Error: [WinError 5] Access is denied: '...\clcache\stats.txt.new' -> '...\clcache\stats.txt'

and setting CLCACHE_DIR to a path outside the profile is the workaround confirmed by several people in that thread. Upstream is archived, so this has to be handled on our side.

Notes:

  • The path is arbitrary — anything outside the user profile should do. C:\clcache_dir just matches the value used upstream. Happy to rename it; it is a little close to C:\clcache, which holds the installation.
  • clcache creates the directory itself, but if the Jenkins account can't create it at the drive root, the ansible role could pre-create it instead.
  • This abandons the existing cache, so the first builds on each machine will be cold. I think that's an acceptable trade against the current failure rate, but say the word if you'd rather migrate the directory.
  • Untested — I have no access to the Windows workers or to CI console logs. Please treat CI as the source of truth.
  • Assisted by Claude Code for the investigation; I checked the diff and the upstream issue myself.

clcache defaults its cache directory to %USERPROFILE%\clcache, which
triggers a long-standing upstream bug where the atomic rename of
stats.txt fails with "[WinError 5] Access is denied".

Set CLCACHE_DIR to a path outside the profile, which is the workaround
confirmed in the upstream issue.

Refs: nodejs#4471
Refs: frerich/clcache#342
Assisted-by: Claude Code
Signed-off-by: Yasunobu <42543015+P4suta@users.noreply.github.com>

@StefanStojanovic StefanStojanovic 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.

Approving this so it can be landed and tested in the CI. If it fails, we'll set DISABLE_CLCACHE to disable clcache completely.

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.

Windows CI: clcache fails with "[WinError 5] Access is denied" on stats.txt

2 participants