openllb / hlb

A developer-first language to build and test any software efficiently
https://openllb.github.io/hlb/
Apache License 2.0
108 stars 12 forks source link

use ForceNoOutput for mounts that are not bound #347

Closed coryb closed 1 year ago

coryb commented 1 year ago

We dont care about mutations to mounts unless they are bound with as name syntax. However, buildkit does not know this so it assumes that mounts are mutable and will may be used elsewhere, so anytime we use a mount (including local) it will prevent buildkit from caching the vertex.

coryb commented 1 year ago

This was @hinshun's idea a long time ago, not sure why we didnt do it then. It makes a great improvement on cachability when using mounts (and now we dont need to use with readonly all the time to just get cached results)

hinshun commented 1 year ago

@coryb I think I didn’t fully understand the consequences of ForceNoOutput, but this makes sense. Two line diff!

coryb commented 1 year ago

Heh, well, maybe you understood this fully ... I am not sure this is working exactly as I thought, trying to debug now. I was able to get it working directly via llb, but still seeing poor caching with hlb, will keep looking.