Support launching shell on a build step for debugging#2813
Conversation
|
PTAL #1472 I think we should start with interactive container on build result and on error point and last snapshot before error point. The LLB digests are not stable so not very useful for this. To debug a specific point of the build I think some contract with frontend is needed. Why are there so many solver/gateway changes in this PR? My understanding was (and based on my own similar POC attempts) that we have already added all the features required for debugging support in current releases and no daemon update is needed. If some internal updates or refactoring is needed it should be done separately. If there are new features then they need new caps etc. Also note that |
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
Thank you for the pointer. I'll take a look at that. Are there any on-going PRs?
Changes are mainly for enabling the client to execute a container with the same configuration and mounts as an arbitrary execOp. This commit also adds a change deferring
Thank you for the suggestion. I'll take look at buildx as well. |
This lifecycle should be covered by the |
It would be great if BuildKit supports interactive debugging of each step of a build by launching shell via
buildctl. This patch is an initial PoC toward that feature. Any feedback about the current design and implementation are very welcome.plainis supported as of now).--debug-buildoption ofbuildctl builddefers the cleanup of resources related to the build job until the user explicitly runsbuildctl debug close <JOB-ID>.buildctl debug shellallows the user launching shell on an arbitrary vertex as long as its op supports process execution (only execOp is supported as of now).The following is an example of debugging a failed build.
This build can be debugged using the ID printed in the above log (
oywfw5gz2f2avxvtmk4b18mru).For example, we debug
RUN cat /non-existing-file.In the above log, this RUN execution is printed as the following:
This prints the digest of the vertex where the RUN is executed. We can use it for
buildctl debug shellcommand to launch a shell on that vertex.Finally, job-related resouces needs to be released using
buildctl debug close oywfw5gz2f2avxvtmk4b18mru.Some considerations
github.com/moby/buildkit/frontend/gatewaypackage for launching a shell process. Maybe we should move the process-execution-related logic into a separated common package.TODOs
Future works