Drone

Gitea and Drone: CI Failing at Clone Stage

I have Gitea, Drone, and a Drone runner setup in containers and I was able to use Oauth between Gitea and Drone to login to Drone. Drone can see all my repos. I activated one of them, added the drone yaml and did a push. (Also have activated via Test deliveries).

Each time I get the following error:

Initialized empty Git repository in /drone/src/.git/

Where is this resolution failing? The Drone container or the runner? Because if I enter the drone container, I can run the following:

#nslookup gitea.mushroomkingdom
Server: 192.168.1.14
Address: 192.168.1.14:53

gitea.mushroomkingdom canonical name = tanukimario.mushroomkingdom
Name: tanukimario.mushroomkingdom
Address: 192.168.1.14

gitea.mushroomkingdom canonical name = tanukimario.mushroomkingdom

For the runner, I added it to the hosts file and so I get the following:

#nslookup gitea.mushroomkingdom
nslookup: can’t resolve ‘(null)’: Name does not resolve

Name: gitea.mushroomkingdom
Address 1: 192.168.1.14 gitea.mushroomkingdom

This is driving me bonkers, so any help would be awesome.

Thanks!

Looked through the FAQs and adding

-e DRONE_RUNNER_NETWORKS=gitea_gitea

does not help it find gitea.

In addition to setting the runner networks, the gitea clone url must match the gitea container hostname. See [SOLVED] Git clone step adding wrong origin address. This issue comes up pretty frequently so you might also consider searching this forum and reviewing other threads for solutions. I also recommend reaching out in the gitea support forum to see if someone has a working configuration you can use.

That doesn’t apply to me. If you look at what I’m sending in the hook, it’s already correct:

  "html_url": "http://gitea.mushroomkingdom:3000/EricMesa/lastfm-twitter",
    "ssh_url": "git@gitea.mushroomkingdom:EricMesa/lastfm-twitter.git",
    "clone_url": "http://gitea.mushroomkingdom:3000/EricMesa/lastfm-twitter.git",

Please post your full installation / configuration. Are you using docker-compose? What hostname does docker compose use when linking your container environments to the shared network? If you are not using docker-compose how have you linked the container networks? We know for certain this is a networking issue, however, it is unclear what you configuration looks like.

Where is this resolution failing? The Drone container or the runner? Because if I enter the drone container, I can run the following:

For the runner, I added it to the hosts file and so I get the following:

Resolution does not happen in either of these containers – the clone does not happen in either of these containers. Drone creates a new container for each pipeline step including the clone step.

Here are some existing threads that address this error and some of your questions:

I really do recommend asking for a working configuration in the Gitea forums. Many of the Gitea maintainers are also Drone contributors and can probably provide you with a sample docker-compose file that you can use as reference.

took a look at all of those and nothing in there worked.

Gitea config file:
version: “2”

networks:
gitea:
external: false

services:
server:
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
- gitea
hostname: “gitea.mushroomkingdom:3000”
volumes:
- /media/docker/gitea/data:/data
- ./hosts:/etc/hosts
ports:
- “3000:3000”
- “2222:22”

I’ve tried with and without the networks directive and with and without the hostname directive.

Here are my drone env variables:

DRONE_GITEA_CLIENT_SECRET: my secret
DRONE_GITEA_SERVER: http://gitea.mushroomkingdom:3000
DRONE_GITEA_CLIENT_ID: the client id
DRONE_SERVER_HOST: drone.mushroomkingdom:8087
DRONE_SERVER_PROTO: http

For the runner I’ve tried both:
this command

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -e DRONE_RPC_PROTO=http -e DRONE_RPC_HOST=192.168.1.14:8087 -e DRONE_RPC_SECRET= -e DRONE_RUNNER_CAPACITY=2 -e DRONE_RUNNER_NAME=tanukimario -p 3002:3000 --restart always --name runner drone/drone-runner-docker:1

and

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -e DRONE_RPC_PROTO=http -e DRONE_RPC_HOST=192.168.1.14:8087 -e DRONE_RPC_SECRET= -e DRONE_RUNNER_CAPACITY=2 -e DRONE_RUNNER_NAME=tanukimario -e DRONE_RUNNER_NETWORKS=gitea_gitea -p 3009:3000 --restart always --name runner2 drone/drone-runner-docker:1

both fail me when it’s time to connect as I mentioned above.

OK, finally solved with the following docker-compose.yml:

version: “2”

networks:
gitea:
external: false

services:
server:
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
gitea:
aliases:
- gitea.mushroomkingdom
volumes:
- /media/docker/gitea/data:/data
- ./hosts:/etc/hosts
ports:
- “3000:3000”
- “2222:22”