When using the Gradle Build Cache in my CI environment I keep seeing the above error message causing Cache misses.
The only difference between the CI environment and running the build from my local machine (where everything is cached fine), is that the CI environment checks out the source code of the build into an arbitrary directory (with a different name for each run).
What directives or options do I have to avoid the above error?
The above message is printed on the info log when the task is not up-to-date from the last run. It has not necessarily something to do with the build cache. Are you saying the task is always out of date on CI with this message?
Correct - the CI builds are continuously re-running the test tasks.
Is there a means of logging the cache key in the gradle server logs so as to identify what has changed between 2 runs of the same task?
Thanks.
The not-up-to-date reason also points to filter.commandLineIncludePatterns being different. Those patterns a set by using the --tests command line option. Are you maybe passing different values in there?
Like I said above, please follow the steps in the in the build cache guide to compare the input hashes between the local run/server run and between two server runs. Which builds are storing artifacts in the build cache (push = true)?