Gradle distributed execution history

Hello there!

I have a question regarding the execution history, it exists per Gradle version and is located in .gradle/8.2/executionHistory.

Given that it’s mandatory for the Gradle build cache to have the history stored or Gradle doesn’t use cache with the message like:

Caching disabled for task ':compileKotlin' because:
  Gradle does not know how file 'build/kotlin/compileKotlin/cacheable/last-build.bin' was created (output property 'taskBuildCacheableOutputDirectory$kotlin_gradle_plugin_common'). Task output caching requires exclusive access to output paths to guarantee correctness (i.e. multiple tasks are not allowed to produce output in the same location).

(ignore last-bin here, it can occur with any output file)

Imagine, we have N parallel pipeline jobs each of them runs compileTestKotlin. Assume, we can store the cache only in a remote location (Gitlab cache in my case). In this case, the cache will be overridden by the last finished job. Then Gradle might not know how an output file was created and will rerun the task next time.

My conclusions here that:

The execution history must be preserved with the corresponding task cache or we can have issues

If I’m right then I have a question, how can I set up a proper cache storage in case of distributed runs?

If I google I get only the “distributed tests” feature in Gradle enterprise but it’s not so relevant, I care in general about any task execution