Skip to content

Commit

Permalink
Retry unmount on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
mtelvers committed Oct 1, 2024
1 parent fc345f5 commit 9fbc1bb
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ module Make (Raw_store : S.STORE) (Sandbox : S.SANDBOX) (Fetch : S.FETCHER) = st
(resolved_secret :: result) ) (Ok []) secrets

let rec run_steps t ~(context:Context.t) ~base = function
| [] -> Sandbox.finished () >>= fun () -> Lwt_result.return base
| [] -> Sandbox.finished t.sandbox >>= fun () -> Lwt_result.return base
| op :: ops ->
context.log `Heading Fmt.(str "%a" (pp_op ~context) op);
let k = run_steps t ops in
Expand Down
2 changes: 1 addition & 1 deletion lib/docker_sandbox.ml
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ let create (c : config) =
let+ () = if Result.is_error volume_exists then create_tar_volume t else Lwt.return_unit in
t

let finished () =
let finished _ =
Lwt.return ()

open Cmdliner
Expand Down
2 changes: 1 addition & 1 deletion lib/s.ml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module type SANDBOX = sig
@param log Used for child's stdout and stderr.
*)

val finished : unit -> unit Lwt.t
val finished : t -> unit Lwt.t
end

module type BUILDER = sig
Expand Down
2 changes: 1 addition & 1 deletion lib/sandbox.jail.ml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ let create ~state_dir:_ _c =
jail_name_prefix = "obuilder_" ^ (Int.to_string (Unix.getpid ()));
}

let finished () =
let finished _ =
Lwt.return ()

open Cmdliner
Expand Down
4 changes: 2 additions & 2 deletions lib/sandbox.macos.ml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ let create ~state_dir:_ c =
lock = Lwt_mutex.create ();
}

let finished () =
Os.sudo [ "zfs"; "unmount"; "obuilder/result" ] >>= fun () ->
let finished (t : t) =
Macos.sudo_fallback [ "zfs"; "unmount"; "obuilder/result" ] [ "zfs"; "unmount"; "-f"; "obuilder/result" ] ~uid:t.uid >>= fun () ->
Os.sudo [ "zfs"; "mount"; "obuilder/result" ] >>= fun () ->
Lwt.return ()

Expand Down
2 changes: 1 addition & 1 deletion lib/sandbox.mli
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ val create : state_dir:string -> config -> t Lwt.t
(** [create ~state_dir config] is a sandboxing system that keeps state in [state_dir]
and is configured using [config]. *)

val finished : unit -> unit Lwt.t
val finished : t -> unit Lwt.t
(** [finished] is a call back to the sandbox which is triggered when the current job
is finished. The sandbox may choose do nothing. *)
2 changes: 1 addition & 1 deletion lib/sandbox.runc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ let create ~state_dir (c : config) =
clean_runc state_dir >|= fun () ->
{ runc_state_dir = state_dir; fast_sync = c.fast_sync; arches }

let finished () =
let finished _ =
Lwt.return ()

open Cmdliner
Expand Down
2 changes: 1 addition & 1 deletion test/mock_sandbox.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ let run ~cancelled ?stdin ~log t (config:Obuilder.Config.t) dir =

let create () = { expect = Queue.create () }

let finished () = Lwt.return ()
let finished _ = Lwt.return ()
2 changes: 1 addition & 1 deletion test/mock_sandbox.mli
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ val expect :
string ->
(unit, [`Msg of string | `Cancelled]) Lwt_result.t) ->
unit
val finished : unit -> unit Lwt.t
val finished : t -> unit Lwt.t

0 comments on commit 9fbc1bb

Please sign in to comment.