cache icon indicating copy to clipboard operation
cache copied to clipboard

Wrong post caching output when storing multiple cache

Open metaclips opened this issue 2 years ago • 4 comments

When saving multiple cache, post cache run indicates it caches using the same cache key even when different cache keys were used. I have been able to recreate the bug in a test repo which runs a script file.sh (only if cache doesn't restore) that creates a file and is uploaded to cache. Running the first action with an unique key logs that the cache stores the key twice which shouldn't be as the first key is indicated as value808119-./folder1/file_mod and the second value808119-./folder2/file_mod. Running the second action which uses the unique keys specified above indicates that the two keys were correctly uploaded.

metaclips avatar Jan 18 '22 22:01 metaclips

@metaclips,

I'm guessing that the cache action uses the id to restore its state during the Post Run. Since the code uses the same id for both caches, I think it just uses the last one.

    - id: cache_hit

Link to code

Jason3S avatar Jan 22 '22 06:01 Jason3S

@metaclips Will it be possible for you to rerun this scenario? I'll take a look. The logs you mentioned have expired.

vsvipul avatar May 10 '22 09:05 vsvipul

I did get to check this by cloning the repo above. Looks like we store the key in the environment during the restore step which is reused in the save step. Thus, causing this bug. Marking as bug for now. Will see what we can do to fix this. Contribution are welcome as this will mostly require changes in actions/toolkit and actions/cache.

We save the key here and use it here.

vsvipul avatar May 16 '22 18:05 vsvipul

Possibly related to - https://github.com/actions/runner/issues/1899

aparna-ravindra avatar Jun 29 '22 04:06 aparna-ravindra

This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.

github-actions[bot] avatar Jan 15 '23 08:01 github-actions[bot]

Looks like this is fixed by https://github.com/actions/runner/pull/1794 . Closing for now. Feel free to reopen.

vsvipul avatar Jan 18 '23 08:01 vsvipul