-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker backend #127
Docker backend #127
Conversation
984772f
to
a2b9bea
Compare
af61709
to
1dcd93a
Compare
be3dcdd
to
805244a
Compare
lib/docker.mli
Outdated
of [head] and [cmd] to be given to Docker command, as Docker | ||
[--entrypoint] takes only one argument. *) | ||
|
||
(** Wrappers for various Docker client commands, exposing file descritors. *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(** Wrappers for various Docker client commands, exposing file descritors. *) | |
(** Wrappers for various Docker client commands, exposing file descriptors. *) |
let module Builder = Obuilder.Builder(Store)(Native_sandbox)(Obuilder.Docker_extract) in | ||
Native_sandbox.create ~state_dir:(Store.state_dir store / "sandbox") conf >|= fun sandbox -> | ||
let builder = Builder.v ~store ~sandbox in | ||
Builder ((module Builder), builder) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to have a stress test for the obuilder on Docker setup.
(** [transform_files ~src_dir ~from_tar ~src_manifest ~dst ~user ~to_untar] | ||
renames the _unique_ file found in [from_tar], a tar archive streamed in | ||
input, to [dst], and writes the resulting tar-format stream to | ||
[to_untar]. All files are listed as being owned by [user]. *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests for this?
@@ -128,3 +128,106 @@ module type FETCHER = sig | |||
@param log Used for outputting the progress of the fetch | |||
@param rootfs The directory in which to extract the base image *) | |||
end | |||
|
|||
(** Wrappers for various Docker client commands. *) | |||
module type DOCKER_CMD = sig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write documentation comments for this module.
let stderr = Option.value ~default:(`FD_move_safely Os.stderr) stderr in | ||
Os.exec_result ~stdin ~stdout ~stderr ?is_success ~pp cmd | ||
|
||
module Cmd = struct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to have integration tests for these commands. Run against docker linux, macos and windows.
let run_result ?stdin ~log ?name ?rm docker_argv image argv = | ||
with_log ~log (fun ~stdout ~stderr -> | ||
Cmd.run_result ?stdin ~stdout ~stderr ?name ?rm docker_argv image argv) | ||
|
||
let run_result' ?stdin ?stdout ~log ?name ?rm docker_argv image argv = | ||
with_stderr_log ~log (fun ~stderr -> | ||
Cmd.run_result' ?stdin ?stdout ~stderr ?name ?rm docker_argv image argv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have these almost duplicate functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want some invocations of Docker to log directly to the build log, but not all. Likewise, some of the logging has to be captured, and some can be ignored.
Granted, this could be a lot cleaner, but my hope is to be able to talk with the Docker daemon with its REST API rather than the command-line client.
include S.BUILDER with type context := Context.t | ||
|
||
val v : store:Store.t -> sandbox:Docker_sandbox.t -> t | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question here, why is this necessary and not just have a Docker version of S.STORE and S.SANDBOX?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that the concept of store and sandbox isn't as tightly decoupled with Docker. There are pieces of info that need sharing in that context that we don't need with runc and fs stores. It was a problem with the build IDs, and when to clean the images and the containers (Docker_sandbox.teardown
), which makes the Builder
code slightly different. Besides, you can't swap the Docker sandbox or store with a non-Docker sandbox or store while using the other Docker store or sandbox, so it makes some sense to integrate them fully.
Another option would be to write an even more generic Builder
to encompass all use cases, but this was rejected when I started writing the backend on the account that it might break the non-Docker builds.
27f2f8d
to
e6228e4
Compare
8d4e204
to
163904e
Compare
8099bb6
to
b04dbcf
Compare
89e84ac
to
ccd3f2f
Compare
525cf43
to
add2cde
Compare
0281700
to
856bb3c
Compare
using Alcotest 1.7.0
7379de6
to
6038f2a
Compare
Alea jacta est |
CHANGES: - Add a Docker backend for Windows and Linux jobs. (@MisterDA ocurrent/obuilder#127 ocurrent/obuilder#75, reviewed by @talex5 and @tmcgilchrist) - Add FreeBSD sandbox backend using jail(8) (@dustanddreams ocurrent/obuilder#156 ocurrent/obuilder#174, reviewed by @tmcgilchrist, @MisterDA, and @mtelvers) - Add Macos ZFS sandbox (@mtelvers ocurrent/obuilder#164, reviewed by @tmcgilchrist) - Support XFS store (@mtelvers ocurrent/obuilder#170, reviewed by @tmcgilchrist) - Search for bash rather than assume it lies in /bin (@dustanddreams ocurrent/obuilder#159, reviewed by @tmcgilchrist) - Prune builds one at a time up to the limit (@mtelvers ocurrent/obuilder#157) - Specify upper bound on number of items in the store (@mtelvers ocurrent/obuilder#158, reviewed by @MisterDA) - Fix case where BTRFS is not fully allocated (@mtelvers ocurrent/obuilder#162) - Avoid pruning parent cache objects (@mtelvers ocurrent/obuilder#176, reviewed by @tmcgilchrist)
CHANGES: - Add a Docker backend for Windows and Linux jobs. (@MisterDA ocurrent/obuilder#127 ocurrent/obuilder#75, reviewed by @talex5 and @tmcgilchrist) - Add FreeBSD sandbox backend using jail(8) (@dustanddreams ocurrent/obuilder#156 ocurrent/obuilder#174, reviewed by @tmcgilchrist, @MisterDA, and @mtelvers) - Add Macos ZFS sandbox (@mtelvers ocurrent/obuilder#164, reviewed by @tmcgilchrist) - Support XFS store (@mtelvers ocurrent/obuilder#170, reviewed by @tmcgilchrist) - Search for bash rather than assume it lies in /bin (@dustanddreams ocurrent/obuilder#159, reviewed by @tmcgilchrist) - Prune builds one at a time up to the limit (@mtelvers ocurrent/obuilder#157) - Specify upper bound on number of items in the store (@mtelvers ocurrent/obuilder#158, reviewed by @MisterDA) - Fix case where BTRFS is not fully allocated (@mtelvers ocurrent/obuilder#162) - Avoid pruning parent cache objects (@mtelvers ocurrent/obuilder#176, reviewed by @tmcgilchrist)
No description provided.