Skip to content
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

Add support for delve debugging in the shell #5553

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LaurentGoderre
Copy link
Contributor

This allows to do run the daemon or CLI with the debugger in the shell container.

Ex:

hack/shell
hack/run buildkitd

API server listening at: [::]:2345
2024-11-26T19:31:05Z warning layer=rpc Listening for remote connections (connections are not authenticated nor encrypted)
2024-11-26T19:31:05Z info layer=debugger launching process with args: [/usr/bin/buildkitd]
2024-11-26T19:31:06Z debug layer=debugger Adding target 24 "/usr/bin/buildkitd"
2024-11-26T19:31:16Z debug layer=debugger continuing
2024-11-26T19:31:16Z debug layer=debugger ContinueOnce
INFO[2024-11-26T19:31:17Z] auto snapshotter: using overlayfs            
INFO[2024-11-26T19:31:17Z] found worker "ip13jnh08d0o6ulqz27hez1k9", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:4de0dd59fa88 org.mobyproject.buildkit.worker.network:cni org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/arm64 linux/amd64 linux/amd64/v2 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/arm/v7 linux/arm/v6] 
WARN[2024-11-26T19:31:17Z] skipping containerd worker, as "/run/containerd/containerd.sock" does not exist 
INFO[2024-11-26T19:31:17Z] found 1 workers, default="ip13jnh08d0o6ulqz27hez1k9" 
WARN[2024-11-26T19:31:17Z] currently, only the default worker can be used. 
INFO[2024-11-26T19:31:17Z] running server on /run/buildkit/buildkitd.sock

@github-actions github-actions bot added area/project area/hack building buildkit itself labels Nov 26, 2024
@LaurentGoderre LaurentGoderre force-pushed the shell-debug branch 2 times, most recently from 7829129 to 605dc69 Compare November 26, 2024 20:35
@thompson-shaun thompson-shaun requested review from jsternberg and tonistiigi and removed request for jsternberg November 26, 2024 20:40
@thompson-shaun thompson-shaun added this to the v0.19.0 milestone Nov 26, 2024
@@ -356,7 +356,7 @@ ENV BUILDKIT_SETUP_CGROUPV2_ROOT=1
ENTRYPOINT ["buildkitd"]

FROM buildkit-linux AS buildkit-linux-debug
COPY --link --from=dlv /usr/bin/dlv /usr/bin/dlv
COPY --link --from=dlv /out/dlv /usr/bin/dlv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crazy-max Looks like this broke in https://github.com/moby/buildkit/pull/5497/files . We should have a CI check to make sure it doesn't go unnoticed.

Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL lint error in CI

hack/run Outdated

set -e

if ! command -v $1 &> /dev/null; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be named something more specific than "run" I think. Is there value of this outside of invoking dlv exec?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was kinda of following the way it is in Moby for consistency but it could be named debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hack building buildkit itself area/project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants