Hi, are there any good practices to get the taskName by a cacheKey?
any API I can use?
Hi, are there any good practices to get the taskName by a cacheKey?
any API I can use?
There’s no way to do this, for two main reasons:
Thanks for the quick reply.
I know that it’s no way to infer the inputs from the hash. What I’d like to do is collecting cache keys to figure out which tasks are easily cache-miss in our project through different engineer’s environment. Right now, I can only receive the cache keys from my own cache server without any taskName information.
It’s totally fine for me to collect this information in the runtime environment.
Right, because cache requests don’t include the task name. When Gradle asks the build cache for a task’s output the request is simply the key itself, no information about the task is in the GET
request.
That said, the cached task outputs do contain a metadata file with origin task information, but this won’t help you in the case of cache misses, because in that scenario there is no cache artifact on the server, hence the miss.
It’s totally fine for me to collect this information in the runtime environment.
Build scans already collect this information so you might look into using Gradle Enterprise for this purpose.