I’m doing CI with Drone and Gitea
Here’s my Drone docker-compose.yml setup:
version: "3"
networks:
gitea:
external: true
services:
gitea:
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
- SSH_DOMAIN=http://192.168.1.19:3000
- ROOT_URL=http://192.168.1.19:3000
- DB_TYPE=postgres
- DB_HOST=db:5432
- DB_NAME=gitea
- DB_USER=gitea
- DB_PASSWD=gitea
networks:
- gitea
volumes:
- /home/zorin/dronegitea/gitea:/data
ports:
- “2221:22”
- “3000:3000”
drone:
image: drone/drone
networks:
- gitea
depends_on:
- gitea
volumes:
- /home/zorin/dronegitea/dbdata:/var/lib/drone/
environment:
- DRONE_OPEN=false
- DRONE_ADMIN=duy
- DRONE_HOST=http://192.168.1.19:8000
- DRONE_GITEA_PRIVATE_MODE=true
- DRONE_SECRET=droneisthebest
# Gitea Config
- DRONE_GITEA=true
- DRONE_GITEA_URL=http://192.168.1.19:3000
- DRONE_NETWORK=gitea
ports:
- 8000:8000
- 8003:80
drone-agent:
image: drone/agent
networks:
- gitea
depends_on:
- drone
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DRONE_SERVER=drone:9000
- DRONE_SECRET=droneisthebest
- DRONE_MAX_PROCS=3
db:
image: postgres:alpine
environment:
- POSTGRES_USER=gitea
- POSTGRES_PASSWORD=gitea
- POSTGRES_DB=gitea
networks:
- gitea
volumes:
- /home/zorin/dronegitea/postgres:/var/lib/postgresql/data
I have a service-media with a .drone.yml:
matrix:
LOCAL_IMAGE:
- 192.168.1.19:5000/service-media:latest
pipeline:
build-local:
image: docker
commands:
- docker ps
- docker build --no-cache -t ${LOCAL_IMAGE} .
- docker push ${LOCAL_IMAGE}
when:
branch: development
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy-local:
image: docker
commands:
- SERVICE_NAME="$(docker service ls --format “{{.Name}} " --filter Label=com.docker.stack.image=${LOCAL_IMAGE})”
- echo $SERVICE_NAME
- docker service update --with-registry-auth --image ${LOCAL_IMAGE} $SERVICE_NAME
when:
branch: development
volumes:
- /var/run/docker.sock:/var/run/docker.sock
When I push to Gitea to branch development, CI works fine:
I have another service with the same .drone.yml as above, but now the CI failed. You can see the image in my comment below
I noticed that when Drone initialized the git repo, in the first case it refers to the IP address, but in the second case it refers to the domain URL
Can somebody tell me why drone refers to the domain URL in the second case ? I mean after the first successful CI, I did not change any settings, just create a repo on Gitea and push code to there, and then suddenly CI failed