Drone

Runner docker - --add-host for clone?

Hello,

runner-docker executes containers, even for cloning a repo. Is there a way to specify extra_hosts or a docker run command --add-host parameter when running the clone container, or any other containers?

This is still on the table for me, but I may need to extend or give an example. I reviewed source code of drone and the docker runner (and got lost a bit), but see my drone.yml:

---
kind: pipeline
type: docker
name: sphinx-builder

clone:
  extra_hosts:
  - "gitea.corp:1.2.3.4"

steps:
- name: something
  image: debian:slim
  extra_hosts:
  - "gitea.corp:1.2.3.4"
  commands:
  - env

This produces in clone step:

Initialized empty Git repository in /drone/src/.git/
+ git fetch origin +refs/heads/master:
fatal: unable to access 'https://gitea.corp/mkovac/dronetest.git/': Could not resolve host: gitea.corp

I solved this temporarily by running extra DNS server. But now I get SSL verification error during clone step:

fatal: unable to access 'https://gitea.corp/mkovac/dronetest.git/': SSL certificate problem: self signed certificate in certificate chain

None of the *_SKIP_VERIFY configuration variables can be used to ignore certificate during clone step. Can custom DRONE_RUNNER_CLONE_IMAGE derived from original and injected corporate certification authority be an option, @bradrydzewski ?

are you running Drone and Gitea on the same machine? If so please see the following thread which discusses the recommended solution: Drone docker agents on custom network?

if you want to disable ssl for cloning see the following thread: Drone Git Clone SSL Error

Thanks, solved.

The skip_verify deserves to be documented here https://docker-runner.docs.drone.io/configuration/cloning/ since I reviewed it many times and could not find it…

I am not running on a single host, but single swarm cluster - so technically containers can end up together on one machine, but I run into no problems with this. I also setup gitea & drone several times on single docker host without issues.