Exposing drone executor port

Is it possible to expose the drone executor container port to host (to developer machine)? I googled this and someone had already asked this but in that reply the Drone team said that you don’t need to expose ports. But I have a use case that needs to expose the drone executor container port to host. I’ll explain the use case briefly. I have a Clojure app that has a lot of dependencies and fixtures that needs to be set-up correctly so that all unit tests can be run in drone. Occasionally there are some issues and usually a Clojure developer examines these issues using a Clojure REPL - connect your favorite Clojure editor to a nrepl server (its port) running inside the application running in development mode.

So, my Clojure app is running in a container on top of the drone executor container. I can expose the app container nrepl port and I can see the port in the drone executor container. But I need to expose this port further from the drone executor container to my developer machine host in order to be able to connect to the nrepl server.

So, I’m looking for something like Drone port forwarding (e.g. compared to Kubernetes port forwarding, Use Port Forwarding to Access Applications in a Cluster | Kubernetes ). Is this possible?

I really do love Drone, the container architecture, the ability to define the steps using bash etc, but I haven’t found a solution to be able to connect to the nrepl server inside applications running in the drone pipeline. For other CI server architectures (e.g. Jenkins) this is very simple.

So, my Clojure app is running in a container on top of the drone executor container. I can expose the app container nrepl port and I can see the port in the drone executor container. But I need to expose this port further from the drone executor container to my developer machine host in order to be able to connect to the nrepl server.

drone has a new feature that allows you to execute a pipeline in debug mode and remotely connect to a pipeline container of a failed build step using a remote terminal. Check out Feature Preview: Debug Mode

How about the local Drone exec? Can I somehow port forward the ports (to the developer machine) that have been exposed to the local Drone exec container? Or create a ssh tunnel to the step container’s nrepl port?
I can already “stop the Drone world” by just adding ‘sleep 100000’ in some step.
After stopping the world I’d like to be able to connect to the nrepl server inside the application running inside a Drone step container running on top of the local Drone exec container. At the moment I cannot do that since the Drone step container is not exposing its ports nor can I connect directly to the step container from the developer machine. If I’m not able to connect to the nrepl server in the running CI pipeline it’s a bit of a no-go for future Clojure based projects when choosing a CI server.

We solve this problem by using tmate, which creates an ssh tunnel into the container. We prepend the below shell snippet to the pipeline commands, which starts tmate on step failure, and generates a unique ssh address that can be used:

remote_debug() {
	if [ "$?" -ne "0" ]; then tmate -F; fi
}
trap remote_debug EXIT

I am not familiar with nrepl, but using software that creates a tunnel, similar to tmate or ngrok, is going to be your only option.

Ok. When is tmate available in the local Drone exec?

Any news regarding how to port forward from local drone executor?
So: I have a step container that exposes port X. I need to port forward this port X from drone executor container to the host (my developer machine). Is this possible? Without this debugging Clojure apps is from stone age.