Drone

Debug local build (drone exec)

Hi all,
I’m new to Drone: it’s amazing! Thank you for this well done OSS project! :clap: :clap: :clap:

I’m trying to port all the Hanami builds to a self-hosted Drone instance. The process is going well, but sometimes I need to understand why a build that passes on “bare metal” fails locally when running it via drone exec.

Is there a way to debug a local build? By placing byebug (Ruby debugger) statements in code, Drone won’t stop, because I guess it doesn’t run the build with a TTY. Is it possible to force drone to use a TTY?

Am I missing something? There is any other way to inspect what’s going on within the build process/container?

Thanks in advance. Cheers. :slight_smile:

FWIW, I manage debugging by adding sleep 999999 to the container where I want to debug, run drone exec, and then when the container is at the sleep step, I use docker exec -it <container-id> <shell> and go from there. I’d love to know if there are better ways, but this is what I’m currently doing and it works well enough.

@stevecrozz Hey, thanks for this trick! Once inside the container, do you get a shell prompt? How do you attach a debugger to the current running test suite? Thanks.

That all depends on your application. If you have a shell installed in your container, then you can execute that shell using docker exec. At this point, drone isn’t involved and you’ll be able to debug your container using whatever tools are available in that container.

Thanks for your help. I’ll figure out the next time the build won’t pass, and eventually report the solution here.