cache icon indicating copy to clipboard operation
cache copied to clipboard

Potential for cache key conflicts with reusable workflows

Open omus opened this issue 11 months ago • 3 comments

The julia-actions/cache action attempts to generate a unique cache key name for each workflow job. The current default key uses a combination of the workflow name, job key, matrix keys, run ID, and run attempt to achieve this.

If a user makes use of a reusable GHA workflow it is possible that the triggering workflow and the reusable workflow could both use julia-actions/cache and the same job key resulting in a cache key conflict (as demonstrated here: https://github.com/julia-actions/cache/pull/160#issuecomment-2610836773).

omus avatar Jan 24 '25 15:01 omus

The obvious solution would be to add the reusable workflow name and possibly the inputs to the key to ensure things are distinct. However, accessing the workflow name from within the reusable workflow returns the triggered workflow and not the reusable one.

omus avatar Jan 24 '25 15:01 omus

Yes, I'm also having the same problem

giordano avatar Mar 17 '25 11:03 giordano

For the record, manually setting the cache-name to include all the relevant disambiguation values helps.

giordano avatar Mar 17 '25 14:03 giordano