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 <noreply@anthropic.com>
This commit is contained in:
Gan, Jimmy
2026-06-03 03:34:43 +08:00
parent fccdf64435
commit ab24bd8526
+4
View File
@@ -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