-
Notifications
You must be signed in to change notification settings - Fork 80
run: add support for swappable engines #191
Conversation
I'd also like to use this opportunity to write some tests for run, and I'd like to make that part of this PR. So don't merge this until that's done, but putting this up for review until I finish that. |
526c3ea
to
4677463
Compare
Also as soon as this gets merged I'll add a chroot-only engine (guess I'll call it fly?) and explore adding a runc engine. |
pre-test review ping? |
I don't really understand the motivation for introducing a new command-line API for this - it seems like an unnecessary layer of indirection - are you anticipating that it's too difficult for people to upstream engine implementations? I can't imagine we'd see more than a handful developed? |
I wanted to keep it easy for others to add engines, although if you think this is too much overhead I could just make it an interface that the engine author needs to implement.
|
4677463
to
b39d9fd
Compare
I just changed this to have engines be a golang interface. This made some things in |
- `cp` | ||
- `modprobe` | ||
- `gpg` | ||
|
||
Additionally `systemd-nspawn` is required to use the default engine for acbuild |
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.
Could inline a link to the engine section here.
Thanks, I think we should go with this interface route for now and then later if it makes sense we can explore the exec one |
da11ac9
to
ed87b6c
Compare
Fixed the issues you found, updated the comment on |
1c9fd2a
to
b33cc13
Compare
Waiting on travis fix... |
56ea405
to
7dec30b
Compare
Looks like the OS travis uses doesn't have systemd. I've modified TestRun so it gets skipped if |
Travis is fixed. Last call for nits. |
"github.com/appc/spec/schema/types" | ||
) | ||
|
||
type Engine interface { |
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.
Docstring would be nice.
Two nits. LGTM. |
This commit revamps `lib/run.go` to rely on an interface for the actual execution of the desired command, such that alternate ways to run a command in the container can be easily added. A flag has been added to the run command to select a non-default engine. The default (and currently only) engine is systemd-nspawn.
7dec30b
to
e224535
Compare
This commit revamps
lib/run.go
to rely on external binaries to performthe actual execution of the desired command. Each external binary, or
engine, is expected to either exist on the PATH or in the same directory
as the acbuild binary, and must be named as
acbuild-$ENGINENAME
. Thedefault (and currently only) engine is systemd-nspawn.
When the engine is started a JSON message detailing what it is to run
and with what environment variables is written into it on stdin. The
package
github.com/appc/acbuild/engine
has been added to define theschema for this (and also holds some helper utilities for engines).
Almost fixes #13.
Kind of a workaround for #162.