Skip to content

Simplify CCACHE_DIR usage and fix misplacement of cache after builds

Description

Simplify CCACHE_DIR usage and fix misplacement of cache after builds

At the end of the build the ccache directory was placed inside the ccache directory as a new subdirectory as visible in log line:

$ test ! "${ENABLE_CCACHE}" != "0" || mv -v ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR}
renamed '/builds/games-team/godot/../.godot.ccache' -> '/builds/games-team/godot/.ccache/.godot.ccache'

This resulted in subsequent builds being unable to use any of the cache as it wasn't at the expected top-level location in .ccache, while at the same time the cache just kept growing larger and larger.

This was a regression from 0b4f2cba which was written in 2024, but actually merged only on Sept 12, 2025, as part of 140523c3.

This type of a bug was the result of overly complex cache dir management with CCACHE_WORK_DIR, CCACHE_TMP_DIR and CCACHE_DIR all defined separately and moved around. This complexity had no benefits in the current Salsa CI code and were remnants of previous pipeline code generations, so to properly fix the issue and ensure it does not repeat, simplify the whole structure to just one single CCACHE_DIR variable.

Also add additional debug output to show the size on the cache directory (which may be different from what ccache -svv reports).

Additionally clean away very old cleanup code left behind from !230 (merged) and replace it with new cleanup code to fix caches that got polluted by this bug and may have extra .ccache directories inside the .ccache directory.

Closes: #492

How to test

If you want to help test this, apply the commit otto/entr@b8764209 on a temporary branch in your project.

Edited by Otto Kekäläinen

Merge request reports

Loading