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
buildkit caching is not additive, e.g., it can only import/export cache off a single dagger do.
In our own CI, it means that each PR is overwriting the cache with that PR's content. Which in turn means each PR is invaliding each other's cache. Example:
PR 1 has some go changes. Cache is built using that source code and exported
PR 2 has different go changes. Cache is re-built using that source code, overwriting PR 1 cache
PR 1 has an update. It will load cache from PR 2, resulting in loss of caching from the previous run
I've no idea what a plausible workaround for this might be.
In an ideal world, buildkit would have additive caching and we'd have layers for both PR 1 and PR 2.
In the meantime, I don't know if we could play around with multiple cache-from targets, e.g.
After research, it's possible to import multiple cache but not export multiple.
dagger do build --cache-to type=local,mode=max,dest=storage/main --cache-from type=local,src=storage/main --cache-from type=local,src=storage/build
This example works if we separately export storage/main and storage/build.
If we follow your idea, that it's possible.
On the other side, we can't export to multiple destination, it's not handle by the solver but we could work on it to fix it.
It's already handle by buildctl, just not by the solver itself.
Activity
TomChv commentedon Apr 7, 2022
That maybe explain why
Dagger CI / Buildis never cache, there is a lot of change in go codebase!Since
ImportCacheandExportCacheare both arrays, I think it's possible!I'll try with local test and we will see where it goes!
TomChv commentedon Apr 11, 2022
After research, it's possible to import multiple cache but not export multiple.
This example works if we separately export
storage/mainandstorage/build.If we follow your idea, that it's possible.
On the other side, we can't export to multiple destination, it's not handle by the solver but we could work on it to fix it.
It's already handle by buildctl, just not by the solver itself.
[-]dagger cache scoping[/-][+]Scope cache by PR[/+]ci: scope cache to enhance speed