You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if it's a right place, problem can be caused by GitHub cache API. my Github workflow sometimes in Haskell doesn't use cache key. not even more general restore keys.
as you can see there are multiple builds with same kay.
where pipeline each time could not find the cache and saves it again.
in my case i already have 5 duplicate caches with same key, which evoke my curiosity.
how it is possible? and what can be a reason?
Hi @nalchevanidze, this is because cache with same key can be restored from the parent branch or main branch and not across the branch. But if the cache with key is not present in parent/main branch, then individual branches which will create their own caches. For more details check this doc
thanks @anuragc617. Is there anything I can do to change this behavior? since I don't really care about the branches and I would like to have one cache per key regardless of the branches?
If you want one cache per key, then you need to ensure that cache is created against main branch and the other branches can restore the cache.
But if a branch changes the cache key then it will create a cache with new key and this can only be restored by that branch and children of that branch.
Reacted by Jack Lloyd, Stanislas Nanchen and Joe McKie
Is there anything preventing this action from supporting caches that are not scoped to a particular branch?
I've been using this action for a couple of years now, since v1, and honestly never noticed this behaviour. That is to say, I found this quite unintuitive.
We run with strict branch protection rules, never allowing anyone to push to main, requiring all changes to come through a pull request. However, now we must run useless tests on push to main (after a PR gets merged), just so we get a cache built, wasting precious minutes.
Reacted by David Nalchevanidze, Dude29, Alex Bjørlig, Vivek, Martin Miglio, Stanislas Nanchen and Ted
@sidekick-eimantas the cross-branch caches protection is necessary because the cache created for a branch may have vulnerabilities and if that cache is used for building the main branch/ parent branch, then the build artifacts generated for main branch will also have those vulnerabilities. It poses a security threat for your production environment.
Having the same issue on the same branch with the exact same cache key.
The workflow ignores it completely, claiming that cache hit did not occur and uploading cache with the exact same key, creating more and more duplicates. However, when I re-run the workflow, it picks it up.
Another note: using cache inside a composite action.
Unfortunately... I only ended up converting it into a reusable workflow, for reusable workflows it works, but usage looks uglier (yet similar) to composite actions.
I don't know if it's a right place, problem can be caused by GitHub cache API. my Github workflow sometimes in Haskell doesn't use cache key. not even more general restore keys.
as you can see there are multiple builds with same kay.
where pipeline each time could not find the cache and saves it again.
in my case i already have 5 duplicate caches with same key, which evoke my curiosity.
how it is possible? and what can be a reason?
They are not duplicates, I just learned that there might be different versions of the same hash. So your package.json/pom whatnot hash did not change, but there is a hidden version also present which is another hash of the locations. In effect more or less an OS filter... Just this is nowhere visible and only reported on debug level.
The entire point of cache is that it doesn't need to do any extra work but to do a quickiest possible lookup by unique cache key and return; there shouldn't be even a possibility that one key can have several 'versions', the only exception to that is how it works with different branches.
I cannot agree more. Cache plugin try to solve an additional problem which is not entirely under his control and it operates with hidden variables which makes it confusing to many.
What if I would like to use only one cache key for the whole project? What if the stuff in the cache is platform neutral? Why should cache plugin bother? If it does not fit it will fail, then I’ll fix it with a different key, or whatever.
Reacted by Avasam, Arseny Garelyshev, jun(심준형), Stefan Martin, Herman S., Iurii Orlov and Ted
Activity
nalchevanidze commentedon Oct 24, 2022
my action description is following:
anuragc617 commentedon Oct 25, 2022
Hi @nalchevanidze, this is because cache with same key can be restored from the parent branch or main branch and not across the branch. But if the cache with key is not present in parent/main branch, then individual branches which will create their own caches. For more details check this doc
nalchevanidze commentedon Oct 25, 2022
thanks @anuragc617. Is there anything I can do to change this behavior? since I don't really care about the branches and I would like to have one cache per key regardless of the branches?
anuragc617 commentedon Oct 25, 2022
If you want one cache per key, then you need to ensure that cache is created against main branch and the other branches can restore the cache.
But if a branch changes the cache key then it will create a cache with new key and this can only be restored by that branch and children of that branch.
sidekick-eimantas commentedon Oct 31, 2022
Is there anything preventing this action from supporting caches that are not scoped to a particular branch?
I've been using this action for a couple of years now, since v1, and honestly never noticed this behaviour. That is to say, I found this quite unintuitive.
We run with strict branch protection rules, never allowing anyone to push to main, requiring all changes to come through a pull request. However, now we must run useless tests on push to main (after a PR gets merged), just so we get a cache built, wasting precious minutes.
anuragc617 commentedon Nov 11, 2022
@sidekick-eimantas the cross-branch caches protection is necessary because the cache created for a branch may have vulnerabilities and if that cache is used for building the main branch/ parent branch, then the build artifacts generated for main branch will also have those vulnerabilities. It poses a security threat for your production environment.
Avasam commentedon Nov 24, 2022
But what if it comes from the same PR/Branch? Here I have 5 duplicates:

https://github.com/Avasam/Auto-Split/actions/caches
Details
dreamscached commentedon Nov 26, 2022
Having the same issue on the same branch with the exact same cache key.

The workflow ignores it completely, claiming that cache hit did not occur and uploading cache with the exact same key, creating more and more duplicates. However, when I re-run the workflow, it picks it up.
Another note: using cache inside a composite action.
bishal-pdMSFT commentedon Dec 1, 2022
Please see the doc to know how cache matching is done and why cache may not match in your case.
axionos commentedon Dec 1, 2022
@dreamscached any luck on this? i have a similar issue #1011
dreamscached commentedon Dec 2, 2022
Unfortunately... I only ended up converting it into a reusable workflow, for reusable workflows it works, but usage looks uglier (yet similar) to composite actions.
cklim483 commentedon Dec 21, 2022
dreamscached commentedon Dec 21, 2022
@cklim483 these are on different branches
smil2k commentedon Feb 21, 2023
They are not duplicates, I just learned that there might be different versions of the same hash. So your package.json/pom whatnot hash did not change, but there is a hidden version also present which is another hash of the locations. In effect more or less an OS filter... Just this is nowhere visible and only reported on debug level.
dreamscached commentedon Feb 21, 2023
The entire point of cache is that it doesn't need to do any extra work but to do a quickiest possible lookup by unique cache key and return; there shouldn't be even a possibility that one key can have several 'versions', the only exception to that is how it works with different branches.
smil2k commentedon Feb 21, 2023
I cannot agree more. Cache plugin try to solve an additional problem which is not entirely under his control and it operates with hidden variables which makes it confusing to many.
What if I would like to use only one cache key for the whole project? What if the stuff in the cache is platform neutral? Why should cache plugin bother? If it does not fit it will fail, then I’ll fix it with a different key, or whatever.
ste00martin commentedon May 23, 2023
@smil2k I created a more direct feature ask for this here if you'd like to upvote it: #1175
github-actions commentedon Dec 10, 2023
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 commentedon Dec 15, 2023
This issue was closed because it has been inactive for 5 days since being marked as stale.