mirror of
https://github.com/actions/cache.git
synced 2026-01-30 16:04:23 +08:00
Add wait loop for squid-proxy service to be resolvable
This commit is contained in:
parent
0d4af5e74f
commit
26cd8c103b
34
.github/workflows/workflow.yml
vendored
34
.github/workflows/workflow.yml
vendored
@ -113,9 +113,22 @@ jobs:
|
||||
echo "Fetching GitHub meta API..."
|
||||
curl -sS https://api.github.com/meta > /tmp/github-meta.json
|
||||
|
||||
# Get squid-proxy IP address
|
||||
# Wait for squid-proxy service to be resolvable
|
||||
echo "Waiting for squid-proxy service..."
|
||||
for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||
PROXY_IP=$(getent hosts squid-proxy | awk '{ print $1 }')
|
||||
echo "Proxy IP: $PROXY_IP"
|
||||
if [ -n "$PROXY_IP" ]; then
|
||||
echo "squid-proxy resolved to: $PROXY_IP"
|
||||
break
|
||||
fi
|
||||
echo "Attempt $i: squid-proxy not resolvable yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
if [ -z "$PROXY_IP" ]; then
|
||||
echo "ERROR: Could not resolve squid-proxy after 10 attempts"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Allow established connections
|
||||
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
@ -354,9 +367,22 @@ jobs:
|
||||
echo "Fetching GitHub meta API..."
|
||||
curl -sS https://api.github.com/meta > /tmp/github-meta.json
|
||||
|
||||
# Get squid-proxy IP address
|
||||
# Wait for squid-proxy service to be resolvable
|
||||
echo "Waiting for squid-proxy service..."
|
||||
for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||
PROXY_IP=$(getent hosts squid-proxy | awk '{ print $1 }')
|
||||
echo "Proxy IP: $PROXY_IP"
|
||||
if [ -n "$PROXY_IP" ]; then
|
||||
echo "squid-proxy resolved to: $PROXY_IP"
|
||||
break
|
||||
fi
|
||||
echo "Attempt $i: squid-proxy not resolvable yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
if [ -z "$PROXY_IP" ]; then
|
||||
echo "ERROR: Could not resolve squid-proxy after 10 attempts"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Allow established connections
|
||||
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user