From ab24bd852683cb924755ae35e43c776fb8d75cca Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Wed, 3 Jun 2026 03:34:43 +0800 Subject: [PATCH] Add gitea hosts entry before checkout steps to work around DNS override Runner's --dns options bypass Docker's embedded DNS resolver, so job containers can't resolve the "gitea" hostname even when connected to the gitea_gitea network. Add /etc/hosts entry pointing gitea to 172.21.0.4 before each checkout step. Co-Authored-By: Claude Opus 4.8 --- .gitea/workflows/deploy.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index cc5503a..2e9c766 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -21,6 +21,8 @@ jobs: steps: - name: Checkout repository run: | + # Runner DNS overrides bypass Docker's embedded DNS; add gitea to hosts + grep -q gitea /etc/hosts || echo "172.21.0.4 gitea" >> /etc/hosts if [ ! -d .git ]; then git clone --depth=1 "http://gitea:3000/${GITHUB_REPOSITORY}.git" . fi @@ -107,6 +109,7 @@ jobs: steps: - name: Checkout repository run: | + grep -q gitea /etc/hosts || echo "172.21.0.4 gitea" >> /etc/hosts if [ ! -d .git ]; then git clone --depth=1 "http://gitea:3000/${GITHUB_REPOSITORY}.git" . fi @@ -185,6 +188,7 @@ jobs: steps: - name: Checkout repository run: | + grep -q gitea /etc/hosts || echo "172.21.0.4 gitea" >> /etc/hosts if [ ! -d .git ]; then git clone --depth=1 "http://gitea:3000/${GITHUB_REPOSITORY}.git" . fi