Repository navigation
feat: Use client: filesystem path as a default - #2385
Conversation
|
@aluzzardi can you review the locking part? Not sure how to test it. I tested manually with a loop. Thought about writing a big enough file in parallel and doing a checksum after. |
|
@aluzzardi How about moving The reason is that with dynamic paths, you don't know the path at load time. EDIT: I see that it doesn't work, what can we do here? |
Unfortunately, we can't. Buildkit requires the list of localdirs before starting the Build session. That's the only reason we have a /cc @sipsma, maybe there's a workaround but I'm not aware of that |
Yeah you can't dynamically add more local dirs to the session after it has started. I guess this could in theory be added to BuildKit but we'd need to think about the security implications, how to make sure we aren't creating a footgun where a client can easily be tricked into providing arbitrary paths based on the output of possibly untrusted code, etc. I don't have any good suggestions for immediate solutions other than what @aluzzardi suggested on Discord. I will throw out an idea that only requires moderate upstream changes though: even though we can't add brand new dirs to a session, we can dynamically choose which paths we want to use under the local dirs after the session starts. The idea here is that we could have clients just put the list of dirs they are okay with exposing to the build as their local dirs (i.e. The main thing stopping that from being a good experience today is that BuildKit local refs aren't lazy. They will just load the whole dir into the daemon rather than only loading files in as needed (i.e. you allow all of I do like this idea in that it retains a fair bit of client control over what they want to allow access too while still keeping the convenience of dynamic paths. |
|
Context from Discord:
Originally posted by @aluzzardi |
|
Hopefully some of the issues we're having will be fixed by newer versions of CUE (v0.4.4 or v0.5.X), and we could potentially use |
client: filesystem path in actionclient: filesystem path
|
Tested the lock manually with a loop. Not sure how to test the race condition without wasting resources. |
client: filesystem pathclient: filesystem path as a default
Signed-off-by: Helder Correia <[email protected]>
Resolves #2196
Why
The ability to write multiple times to the same path has come up a few times. Reading as well. We ourselves have resorted to the hack of reading from
.and./in the same plan (in CI), to allow differentinclude/excludepatterns. Usingcore.#Copyto filter down a biggerdagger.#FSfrom the host isn't always appropriate because you'll load more than you need, depending on your target action.Also, the fact that you can't use a dynamic path in
client: filesystemhas come up a lot too. Users want to use paths from environment variables for better portability and reusability.What
Allow overriding
client: filesystempath in the action's field, using the CUE path as a default.How
Simply using the CUE path as a default, allowing to override explicitly. This is backwards compatible.
Added a file lock to avoid race conditions to allow multiple actions to the same path, which gives more protection than previous behavior (e.g.,
.vs./).For dynamic paths, reading directories aren't supported but everything else is. It also improves the error message if a user attempts this.
Reading multiple times from the same dir
Writing multiple times to the same dir
Reading a file from a dynamic path (output of an action)
Related
client: networkaddress as a default #2349Signed-off-by: Helder Correia