Drone

[SOLVED] Deployment phase: Drone turning up another docker network

I have configured Drone + Gogs + minikube. I can successfully execute a build and publish, but fail on deployment to my minikubeK/8s. I see that Drone is creating a new docker network to spin up a container to do the deployment stage and unfortunately, that breaks connectivity/communications. I’ve configured drone to use a DRONE_RUNNER_NETWORKS. I’m not running an agent being that Drone and Gogs are on the same machine, (Should I use an agent?) Is there anyway to configure Drone not to turn up Docker networks or allow me to be selective? my config is below from my docker-compose.yaml . thanks for the help!

services:
gogs:
image: gogs/gogs
container_name: dc-gogs
volumes:
- ./gogs:/data
ports:
- “3000:3000”

drone-server:
image: drone/drone:1
container_name: dc-drone
ports:
- 80:80
- 443:443
volumes:
- ./drone:/var/lib/drone/
- /var/run/docker.sock:/var/run/docker.sock
restart: always
environment:
- DRONE_OPEN=true
- DRONE_ORGS=chet
- DRONE_ADMIN=carello
- DRONE_RUNNER_NETWORKS=drone-gogs-cicd_default
- DRONE_GIT_ALWAYS_AUTH=false
- DRONE_GOGS=true
- DRONE_GOGS_SERVER=http://dc-gogs:3000
- DRONE_SERVER_HOST=dc-drone
- DRONE_SERVER_PROTO=http
- DRONE_TLS_AUTOCERT=false
- DRONE_LOGS_DEBUG=true
- DRONE_SECRET=

Drone creates a new docker network for each pipeline execution. This is required and cannot be disabled. DRONE_RUNNER_NETWORKS is going to be required. Please note that your git clone url hostname must match the network name. The clone url is provided by the gogs webhook, and can be customized via gogs settings (I’m not sure which, I’ve never had to do this).

any suggestions on how I put the the deploy pipeline execution container in the proper network? I already have DRONE_RUNNER_NETWORKS configured and works for the build and publish phases. However when Drone is executing the deploy phase it’s building anther network. I don’t see where I can configure DRONE_RUNNER_NETWORKS for this phase… thanks again.

Been banging at this for a while, trying different configs and code rev,… and reading. Basically it appears DRONE_RUNNER_NETWORKS doesn’t work. the execution pipeline container still gets instantiated in a new network during my Deployment phase of my pipeline. As I mentioned, build and publish phases are working fine. From what I’ve read, I’m not the first to have this issue and use case requirement. Am I missing something? thanks.

services:
dc-gogs:
image: gogs/gogs
container_name: dc-gogs
volumes:

  • ./gogs:/data
    ports:
  • “3000:3000”

dc-drone-server:
image: drone/drone:1
container_name: dc-drone-server
ports:

  • 80:80
  • 443:443
    volumes:
  • ./drone:/var/lib/drone/
  • /var/run/docker.sock:/var/run/docker.sock
    restart: always
    environment:
  • DRONE_OPEN=true
  • DRONE_ORGS=chet
  • DRONE_ADMIN=carello
  • DRONE_RUNNER_NETWORKS=dc-gogs_default
  • DRONE_GIT_ALWAYS_AUTH=false
  • DRONE_GOGS=true
  • DRONE_GOGS_SERVER=http://dc-gogs:3000
  • DRONE_SERVER_HOST=dc-drone-server
  • DRONE_SERVER_PROTO=http
  • DRONE_TLS_AUTOCERT=false
  • DRONE_LOGS_DEBUG=true
  • DRONE_SECRET=

At this point, I’m stuck,… I don’t see a work around for this. Hopefully, someone can enlighten me :slight_smile:

Basically it appears DRONE_RUNNER_NETWORKS doesn’t work

I have tested this setting and can confirm it is working as expected. Community members have also recently confirmed it is working.

I don’t see where I can configure DRONE_RUNNER_NETWORKS for this phase

This setting is global and applies to all pipeline containers. You cannot configure an external network for a single step.

the execution pipeline container still gets instantiated in a new network during my Deployment phase of my pipeline

Your pipeline will always get instantiated with a new per-pipeline network. As I mentioned previously this behavior is required and cannot be disabled. If you set DRONE_RUNNER_NETWORKS=my-network the pipeline containers will be attached to two networks. They will be attached to the per-pipeline network and network my-network.

I do not understand the exact problem you are facing, however, if you need to attach your pipelines to multiple external networks you can pass multiple values to DRONE_RUNNER_NETWORKS separated by a comma. For example:

DRONE_RUNNER_NETWORKS=networka,networkb,networkc

Brad - Finally getting back to this; thanks for the explanation. I looked at the networks and didn’t see the container in both of network. So I reloaded Docker and things are working. thanks for the help!