I run Gitea on a Debian server, and wanted to use Drone for CI/CD.
So I have successfully built two images, one for drone-server and one for drone-agent, and started the two containers; set up a reverse proxy in Apache, and it all seems to work! Except that Drone doesn’t seem to be authenticating in order to pull private repositories (it works fine with public repos)
As far as I understand, this was fixed in Gitea (as per this thread and this pull request, so I got both Gitea and Drone from git (today). But it seems that my setup has that same problem:
- I can see the Gitea repos from Drone;
- The webhooks are working properly;
- Drone runs, does
git fetchwithout problems in public repositories
- Drone runs, but fails with
fatal: could not read Usernamein private repositories In Gitea logs, I see this:
[Macaron] 2018-05-16 15:17:27: Completed GET /jpellegrini/private-rep.git/info/refs?service=git-upload-pack 401 Unauthorized in 2.013867ms
- But the rest works fine – I can even go to the Gitea repository page, and there is a link to the Drone test page for that repo.
So – is this still an issue (and I misread what was in the thread and the pull request mentioned), or did I do something wrong in my setup?
I already tried using
DRONE_GOGS_URL instead of the Gitea driver, but that didn’t help.
Below is configuration I used for the two containers (
debian-stable is a minimalistic Debian image, built locally with
docker-compose.yml (the reverse proxy redirects traffic to
version: "2" services: drone-server: image: jpellegrini/drone-server ports: - 1111:8000 - 9000 volumes: - /var/lib/drone:/var/lib/drone/ - ./drone:/var/lib/drone/ restart: always environment: - DRONE_HOST=https://drone.domain.info - DRONE_GITEA=true - DRONE_GITEA_URL=https://gitea.domain.info - DRONE_OPEN=false - DRONE_ADMIN=jpellegrini - DRONE_GITEA_PRIVATE_MODE=true - DRONE_GITEA_SKIP_VERIFY=false - DRONE_SECRET=............. drone-agent: image: jpellegrini/drone-agent command: agent restart: always depends_on: [ drone-server ] volumes: - /var/run/docker.sock:/var/run/docker.sock environment: - DRONE_SERVER=drone-server:9000 - DRONE_SECRET=.............
Dockerfile.server is a variant of the Dockerfile in the Drone sources:
FROM debian-stable EXPOSE 8000 9000 80 443 ENV DATABASE_DRIVER=sqlite3 ENV DATABASE_CONFIG=/var/lib/drone/drone.sqlite ENV GODEBUG=netdns=go ENV XDG_CACHE_HOME=/var/lib/drone COPY go/bin/drone-server /bin/ RUN mkdir -p /var/lib/drone ENV DEBIAN_FRONTEND=noninteractive RUN apt update && apt-get --yes install ca-certificates && apt clean ENTRYPOINT ["/bin/drone-server"]
Dockerfile.agent is this:
FROM debian-stable ENV GODEBUG=netdns=go COPY go/bin/drone-agent /bin/ ENV DEBIAN_FRONTEND=noninteractive RUN apt update && apt-get --yes install ca-certificates && apt clean EXPOSE 3000 HEALTHCHECK CMD ["/bin/drone-agent", "ping"] ENTRYPOINT ["/bin/drone-agent"]