Skip to content

Commit dfe61a6

Browse files
authored
Add HCS backend support (#258)
* Add HCS backend support * Update obuilder
1 parent 821b11f commit dfe61a6

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

bin/worker.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,13 @@ module Obuilder_config = struct
185185
Term.(const Obuilder.Store_spec.to_store $ v)
186186

187187
let v =
188-
let make native_conf docker_conf qemu_conf = function
188+
let make native_conf docker_conf qemu_conf hcs_conf = function
189189
| `Native, store -> Some (Cluster_worker.Obuilder_config.v (`Native native_conf) store)
190190
| `Qemu, store -> Some (Cluster_worker.Obuilder_config.v (`Qemu qemu_conf) store)
191191
| `Docker, store -> Some (Cluster_worker.Obuilder_config.v (`Docker docker_conf) store)
192+
| `Hcs, store -> Some (Cluster_worker.Obuilder_config.v (`Hcs hcs_conf) store)
192193
in
193-
Term.(const make $ Obuilder.Native_sandbox.cmdliner $ Obuilder.Docker_sandbox.cmdliner $ Obuilder.Qemu_sandbox.cmdliner $ cmdliner)
194+
Term.(const make $ Obuilder.Native_sandbox.cmdliner $ Obuilder.Docker_sandbox.cmdliner $ Obuilder.Qemu_sandbox.cmdliner $ Obuilder.Hcs_sandbox.cmdliner $ cmdliner)
194195
end
195196

196197
let worker_opts_t =

worker/context.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ let build_context t ~log ~tmpdir descr =
197197
if include_git descr then (
198198
let cmd, is_success =
199199
if Sys.win32 then
200-
["robocopy"; clone / ".git"; tmpdir / ".git"; "/COPY:DATSO"; "/E"; "/R:0"; "/DCOPY:T"],
200+
["robocopy"; clone / ".git"; tmpdir / ".git"; "/COPY:DATSO"; "/E"; "/R:0"; "/DCOPY:T"; "/NFL"; "/NDL"; "/NJH"; "/NP"],
201201
fun s -> s = 1
202202
else
203203
["cp"; "-a"; clone / ".git"; tmpdir / ".git"],

worker/obuilder_build.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module Config = struct
77
store : Obuilder.Store_spec.store Lwt.t;
88
sandbox_config : [ `Native of Obuilder.Native_sandbox.config
99
| `Qemu of Obuilder.Qemu_sandbox.config
10-
| `Docker of Obuilder.Docker_sandbox.config ]
10+
| `Docker of Obuilder.Docker_sandbox.config
11+
| `Hcs of Obuilder.Hcs_sandbox.config ]
1112
}
1213

1314
let v sandbox_config store = { store; sandbox_config }
@@ -52,6 +53,11 @@ let create ?(prune_threshold = 30.0) ?(prune_limit = 100) config =
5253
Obuilder.Docker_sandbox.create conf >|= fun sandbox ->
5354
let builder = Builder.v ~store ~sandbox in
5455
Builder ((module Builder), builder)
56+
| `Hcs conf ->
57+
let module Builder = Obuilder.Builder (Store) (Obuilder.Hcs_sandbox) (Obuilder.Hcs_fetch) in
58+
Obuilder.Hcs_sandbox.create ~state_dir:(Store.state_dir store / "sandbox") conf >|= fun sandbox ->
59+
let builder = Builder.v ~store ~sandbox in
60+
Builder ((module Builder), builder)
5561
end
5662
>>= fun (Builder ((module Builder), builder)) ->
5763
Log.info (fun f -> f "Performing OBuilder self-test…");
@@ -92,7 +98,7 @@ let build t ~switch ~log ~spec ~src_dir ~secrets =
9298
let log = log_to log in
9399
let Builder ((module Builder), builder) = t.builder in
94100
let shell = Builder.shell builder in
95-
let context = Obuilder.Context.v ~switch ~log ~src_dir ?shell ~secrets () in
101+
let context = Obuilder.Context.v ~switch ~log ~src_dir ~shell ~secrets () in
96102
Builder.build builder context spec
97103

98104
let healthcheck t =

worker/obuilder_build.mli

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module Config : sig
55

66
val v : [ `Native of Obuilder.Native_sandbox.config
77
| `Qemu of Obuilder.Qemu_sandbox.config
8-
| `Docker of Obuilder.Docker_sandbox.config ]
8+
| `Docker of Obuilder.Docker_sandbox.config
9+
| `Hcs of Obuilder.Hcs_sandbox.config ]
910
-> Obuilder.Store_spec.store Lwt.t -> t
1011
end
1112

0 commit comments

Comments
 (0)