Repository navigation
Change shim to be an oci-runtime wrapper. - #3913
Conversation
|
Damn! Already :) Looking into it |
There was a problem hiding this comment.
small nit: was this file mv'd instead of git mv? Or was just `git confused
Doesn't matter, but will make your rebase on the other PR harder
There was a problem hiding this comment.
Oh yeah I just mv'd probably. I'll see if it's possible to retroactively git mv it somehow.
There was a problem hiding this comment.
Can you add a comment explaining this sorcery?
If I understand correctly, we're getting called twice: once as dagger-shim which prepares calling ourselves again, this time as _shim, which triggers a different code path
Also, instead of documenting, WDYT if we made it more explicit by having cmd/shim and cmd/oci-worker? Since we're injecting a binary, we might as well inject 2.
There was a problem hiding this comment.
If I understand correctly, we're getting called twice: once as dagger-shim which prepares calling ourselves again, this time as _shim, which triggers a different code path
That's correct, it's basically just like having two subcommands available for use in the same binary; I just didn't bother to have an nice command line interface since these are far removed from anything a human should touch (or even see, they are buried in the engine image, never local to users).
I have a comment on setupBundle above but I'll expand it some more and put it down here or otherwise try to make it easier to find.
Also, instead of documenting, WDYT if we made it more explicit by having cmd/shim and cmd/oci-worker? Since we're injecting a binary, we might as well inject 2.
We can but there's some shared consts between the two that make it nicer to be in one main func and splitting probably slightly increases our image size + memory usage by not combining common executable pages together. So I'd overall prefer to keep them together at least right now if it's not too confusing.
There was a problem hiding this comment.
Updated with a lot more comments, should be more clear now hopefully
Now shim is no longer built on the fly, instead it's built into our engine image. We then include it in dagger execs by configuring buildkitd to use *it* as the oci runtime binary. It then updates the container configuration to setup itself as the shim, which results in the same code executing as previously. This new approach has the short term benefit of stopping us from needing to pull in golang images at runtime and build the shim on the fly, which is a frequent user complaint. In the longer term, the ability to hook into the container runtime unlocks a ton of other interesting possibilities. Signed-off-by: Erik Sipsma <[email protected]>
|
Perfect! |
Signed-off-by: Erik Sipsma <[email protected]>
|
@aluzzardi I noticed one thing looking through the buildkitd logs; it was in some cases printing errors about failing to kill runc because that command doesn't take Very small modification so I'll merge once tests pass if I don't hear back, but happy to address anything more in follow ups too if there happens to be any concerns with the second commit. |
Now shim is no longer built on the fly, instead it's built into our engine image. We then include it in dagger execs by configuring buildkitd to use it as the oci runtime binary. It then updates the container configuration to setup itself as the shim, which results in the same code executing as previously.
This new approach has the short term benefit of stopping us from needing to pull in golang images at runtime and build the shim on the fly, which is a frequent user complaint.
In the longer term, the ability to hook into the container runtime unlocks a ton of other interesting possibilities.
Signed-off-by: Erik Sipsma [email protected]
Problems solved and possibilities unlocked
_shimfrom log output (we partially hid it previously but it still showed up in errors when an exec exited non-zero, now it's gone from that too).dagger_meta_mountartifacts that end up in each exec (which was always an unfortunate side effect of adding the shim's abilities)