remove deploy setup network
Some checks failed
CI / build-and-test (push) Successful in 13m12s
CI / deploy (push) Failing after 1m40s

This commit is contained in:
SpecialX
2026-02-26 15:48:42 +08:00
parent 175af10881
commit 16ebbbe924

View File

@@ -142,48 +142,48 @@ jobs:
container: container:
image: dockerreg.eazygame.cn/node-with-docker:22 image: dockerreg.eazygame.cn/node-with-docker:22
steps: steps:
- name: 🌐 Setup Network (Dynamic) # - name: 🌐 Setup Network (Dynamic)
run: | # run: |
# 1. 动态获取 Docker 网关 IP # # 1. 动态获取 Docker 网关 IP
# 尝试多种方式获取网关 IP # # 尝试多种方式获取网关 IP
GATEWAY_IP="" # GATEWAY_IP=""
# 尝试使用 ip route (如果可用) # # 尝试使用 ip route (如果可用)
if command -v ip >/dev/null 2>&1; then # if command -v ip >/dev/null 2>&1; then
GATEWAY_IP=$(ip route show | grep default | awk '{print $3}') # GATEWAY_IP=$(ip route show | grep default | awk '{print $3}')
fi # fi
# 如果 ip 命令不可用,尝试 hostname -I 推断 # # 如果 ip 命令不可用,尝试 hostname -I 推断
if [ -z "$GATEWAY_IP" ]; then # if [ -z "$GATEWAY_IP" ]; then
CURRENT_IP=$(hostname -I 2>/dev/null | awk '{print $1}') # CURRENT_IP=$(hostname -I 2>/dev/null | awk '{print $1}')
if [ -n "$CURRENT_IP" ]; then # if [ -n "$CURRENT_IP" ]; then
GATEWAY_IP=$(echo "$CURRENT_IP" | sed 's/\.[0-9]*$/.1/') # GATEWAY_IP=$(echo "$CURRENT_IP" | sed 's/\.[0-9]*$/.1/')
fi # fi
fi # fi
# 兜底 # # 兜底
if [ -z "$GATEWAY_IP" ]; then # if [ -z "$GATEWAY_IP" ]; then
echo "Warning: Could not detect gateway IP, using fallback 172.17.0.1" # echo "Warning: Could not detect gateway IP, using fallback 172.17.0.1"
GATEWAY_IP="172.17.0.1" # GATEWAY_IP="172.17.0.1"
fi # fi
echo "Detected Docker Gateway: $GATEWAY_IP" # echo "Detected Docker Gateway: $GATEWAY_IP"
# 2. 配置 Host 解析 (解决 gittea.eazygame.cn 无法访问的问题) # # 2. 配置 Host 解析 (解决 gittea.eazygame.cn 无法访问的问题)
# 注意:需要容器内有 root 权限 # # 注意:需要容器内有 root 权限
if [ "$(id -u)" -eq 0 ]; then # if [ "$(id -u)" -eq 0 ]; then
echo "$GATEWAY_IP gittea.eazygame.cn" >> /etc/hosts # echo "$GATEWAY_IP gittea.eazygame.cn" >> /etc/hosts
cat /etc/hosts # cat /etc/hosts
else # else
echo "Warning: Not root, cannot modify /etc/hosts" # echo "Warning: Not root, cannot modify /etc/hosts"
fi # fi
# 3. 设置 NO_PROXY (非常重要!防止请求走代理导致 Timeout) # # 3. 设置 NO_PROXY (非常重要!防止请求走代理导致 Timeout)
# 包含 localhost, 127.0.0.1, 网关IP, 以及 Gitea 域名 # # 包含 localhost, 127.0.0.1, 网关IP, 以及 Gitea 域名
NO_PROXY_VAL="localhost,127.0.0.1,$GATEWAY_IP,gittea.eazygame.cn,.eazygame.cn,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12" # NO_PROXY_VAL="localhost,127.0.0.1,$GATEWAY_IP,gittea.eazygame.cn,.eazygame.cn,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12"
echo "NO_PROXY=$NO_PROXY_VAL" >> $GITHUB_ENV # echo "NO_PROXY=$NO_PROXY_VAL" >> $GITHUB_ENV
echo "no_proxy=$NO_PROXY_VAL" >> $GITHUB_ENV # echo "no_proxy=$NO_PROXY_VAL" >> $GITHUB_ENV
- name: Download artifacts - name: Download artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3