Closed lightninglu10 closed 1 week ago
You can use multiple cache-from
in this case:
cache-from: |
type=registry,ref=${{ env.REGISTRY }}:branch.${{ github.ref_name }}
type=registry,ref=${{ env.REGISTRY }}:main
Oh nice, didn't know that was possible. Thank you @crazy-max
Description
Hey guys, we have a cache branching strategy where we tag images by the github branch. We set our cache-from like this:
ref=${{ env.REGISTRY }}:branch.${{ github.ref_name }}
For the first push of any branch, the image won't exist, but the main branch image will exist (which we typically branch from). So there will always be a cache miss even though the cache technically exists, just under a different branch name.
Is there anyway to have some kind of backup cache-from if it fails to exist, by setting a different value so it'll pull from main instead?
We used to have this behavior manually coded out in Travis, but swapped to Github Actions because it's better than Travis, but we're just missing this feature.