feature: bring back action runners#14240
Conversation
147f9a4 to
570c0f7
Compare
aabe781 to
3f29e77
Compare
040eb08 to
d67f1e5
Compare
e48454a to
2dd926d
Compare
| | Some active when active.run_id = run_id && active.count > 1 -> | ||
| active.count <- active.count - 1; | ||
| Fiber.return () | ||
| | Some active when active.run_id = run_id && active.count = 1 -> |
There was a problem hiding this comment.
| | Some active when active.run_id = run_id && active.count > 1 -> | |
| active.count <- active.count - 1; | |
| Fiber.return () | |
| | Some active when active.run_id = run_id && active.count = 1 -> | |
| | Some active when Run_id.equal active.run_id run_id && active.count > 1 -> | |
| active.count <- active.count - 1; | |
| Fiber.return () | |
| | Some active when Run_id.equal active.run_id run_id && active.count = 1 -> |
| ; path : Path.t | ||
| ; path : Path.t option | ||
| ; mutable alloc : Alloc.t option | ||
| ; terminate_process_on_error : bool |
There was a problem hiding this comment.
What's the reason for storing this separately? Isn't it just Option.is_none path?
| Option.iter alloc_summary ~f:(Out.emit out); | ||
| Out.emit out (Event.exit ()); | ||
| Out.close out; | ||
| (match Env.(get initial Dune_action_trace.Private.trace_dir_env_var), out.path with |
There was a problem hiding this comment.
Wondering if out.path and Owened / Borrowed should just be tied together.
Something like Owned of Path.t | Borrowed for both?
|
I've noticed that quite a few sets of rules don't pass |
| , Terminal { output_on_success = Print; _ } ) | ||
| | ( Terminal { output_on_success = Swallow; _ } | ||
| , Terminal { output_on_success = Swallow; _ } ) -> | ||
| (* We don't merge when both are [Must_be_empty]. If we did and an |
There was a problem hiding this comment.
Why remove this comment? Is it stale?
|
Could you add a test demonstrating that |
FYI this isn't currently done. |
Alizter
left a comment
There was a problem hiding this comment.
I've had an initial look through the implementation, paying special attention to the changes to build_system and the trace and things look good. I've made some comments as I was passing through.
Needs a changes entry.
I'll do another pass tomorrow.
The goal is to sandbox all unsafe actions. For now, that includes preprocessors and user defined actions. I do not plan to use action runners for ocamldep, ocamlopt or anything else that is performance sensitive or is white listed. |
Could you document this intent in somewhere like |
Add an opt-in action runner for executing eligible build processes in a separate Dune worker process. - Add --action-runner and the internal action-runner worker command. - Add --sandbox-actions, which runs eligible actions through a bubblewrap-wrapped worker and protects the shared cache from worker writes. - Extend process execution with a path-based runner hook, runner-safe metadata, output/capture handling, and parent-owned trace events. - Add action eligibility plumbing (Allow_action_runner, can_run_in_action_runner, runs_process) for user actions, cram tests, pp/ppx, inline tests, and selected action extensions. - Add RPC protocol/server support for runner ready/exec/cancel requests, per-generation lifecycle tracking, disconnect handling, and build-cancellation propagation. - Add trace events and inherited trace-fd support for worker lifecycle and process events. - Account for sandbox-actions in rule digests only for actions that spawn processes. - Add black-box coverage for runner execution, failures, disconnects, cancellation, watch shutdown, tracing, and sandboxed actions. Signed-off-by: Rudi Grinberg <me@rgrinberg.com> refactor: pass run ids to action runner requests Signed-off-by: Rudi Grinberg <me@rgrinberg.com> refactor(action): store runner eligibility on Action.Full Signed-off-by: Rudi Grinberg <me@rgrinberg.com> fix(cache): avoid unnecessary rule digest churn Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
2dd926d to
31ba228
Compare
Bring back action runners and use them in conjunction with bubble wrap to make it impossible to modify the shared cache.
I'm going to enable this through the makefile for folks on the dev team to get some beta testing. If all goes well, it should be available for 3.24.
@anmonteiro I've been told that sandbox-exec offers comparable functionality on macos. It would be good to have this as an alternative to bwrap.
Work Included
worker and protects the shared cache from worker writes.
output/capture handling, and parent-owned trace events.
runs_process) for user actions, cram tests, pp/ppx, inline tests, and selected
action extensions.
per-generation lifecycle tracking, disconnect handling, and build-cancellation
propagation.
process events.
processes.
cancellation, watch shutdown, tracing, and sandboxed actions.