You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
✨ Add ability to drop-into a shell at any moment of the CI process #2197
Early versions of Docker allowed execing into intermediate build steps since intermediate images were generated and spawning a container with any of these images was extremely useful for troubleshooting productivity. Since docker (and also dagger) are using buildkit, this UX has been lost and the current way people are working around this now is commenting out part of their build pipeline only export the end result into an image and then execing into that.
It'd be awesome if Dagger could bring this UX back and allow users to drop-into a shell with the corresponding mounts and FS before or after an action execution.
It'll improve the CI troubleshooting experience drastically to understand why some actions sometimes fail due to missing files or confusions about filesystem and mounts locations.
How are you currently working around this?
By manually commenting out part of the plan execution and exporting the resulting output to a docker image that I can exec afterwards. In some cases, I have to additionally add a step to install a shell since some Dagger plans don't have one.
Reacted by Joshua Sleeper and Paweł Zmarzły
Reacted by Erik Sipsma, Oliver Mannion, Sebastian Javier Marchano, Joshua Sleeper and Paweł Zmarzły
There's a lot of features in Buildkit that will make the implementation for this much more tractable:
You can start ephemeral containers with the NewContainer API in Buildkit that support the same basic features of any ExecOp but also things like hooking up a TTY from the client
The only issue I can think of is that the ability to inspect failed exec fs state only lasts for the duration of the current client session; after the client session is closed that fs state is thrown away. This means you couldn't open a shell using the failed state from like 3 runs ago in your CI as @aluzzardi mentioned. However, if we wanted that ability I don't think it's a huge project to add to Buildkit.
In terms of how Dagger exposes this to users, the first thought off the top of my head is that we could add two flags to dagger do that support:
The ability to just open a shell at whatever your action is targeting (--shell?).
The ability to open a debug shell if there is a failure at an Exec (--shell-on-failure?).
One issue is that not all Execs actually have a shell present (i.e. distroless-like images), so an additional feature we could consider layering on top of the more basic ones is the ability to mount the fs state you want to inspect somewhere on a "debug fs state" that has a shell (and maybe other debugging tools). This would require the ability to specify what the debug state should be, would have to think about clean ways of approaching that. This is more advanced though obviously, not P0.
Also, in terms of implementation, this issue is related to a few others that involve long-running async tasks (a category that debug shells fall under I think):
Activity
jpadams commentedon Apr 14, 2022
#826
sipsma commentedon Apr 14, 2022
There's a lot of features in Buildkit that will make the implementation for this much more tractable:
NewContainerAPI in Buildkit that support the same basic features of any ExecOp but also things like hooking up a TTY from the clientThe only issue I can think of is that the ability to inspect failed exec fs state only lasts for the duration of the current client session; after the client session is closed that fs state is thrown away. This means you couldn't open a shell using the failed state from like 3 runs ago in your CI as @aluzzardi mentioned. However, if we wanted that ability I don't think it's a huge project to add to Buildkit.
In terms of how Dagger exposes this to users, the first thought off the top of my head is that we could add two flags to
dagger dothat support:--shell?).--shell-on-failure?).One issue is that not all Execs actually have a shell present (i.e. distroless-like images), so an additional feature we could consider layering on top of the more basic ones is the ability to mount the fs state you want to inspect somewhere on a "debug fs state" that has a shell (and maybe other debugging tools). This would require the ability to specify what the debug state should be, would have to think about clean ways of approaching that. This is more advanced though obviously, not P0.
sipsma commentedon Apr 14, 2022
Also, in terms of implementation, this issue is related to a few others that involve long-running async tasks (a category that debug shells fall under I think):
marcosnils commentedon Jan 3, 2023
closing in favor of #3024