mirror of
https://github.com/actions/cache.git
synced 2026-01-30 07:54:21 +08:00
Add wait loop for squid-proxy service to be resolvable
This commit is contained in:
parent
0d4af5e74f
commit
26cd8c103b
38
.github/workflows/workflow.yml
vendored
38
.github/workflows/workflow.yml
vendored
@ -113,9 +113,22 @@ jobs:
|
|||||||
echo "Fetching GitHub meta API..."
|
echo "Fetching GitHub meta API..."
|
||||||
curl -sS https://api.github.com/meta > /tmp/github-meta.json
|
curl -sS https://api.github.com/meta > /tmp/github-meta.json
|
||||||
|
|
||||||
# Get squid-proxy IP address
|
# Wait for squid-proxy service to be resolvable
|
||||||
PROXY_IP=$(getent hosts squid-proxy | awk '{ print $1 }')
|
echo "Waiting for squid-proxy service..."
|
||||||
echo "Proxy IP: $PROXY_IP"
|
for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||||
|
PROXY_IP=$(getent hosts squid-proxy | awk '{ print $1 }')
|
||||||
|
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
|
# Allow established connections
|
||||||
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||||
@ -354,9 +367,22 @@ jobs:
|
|||||||
echo "Fetching GitHub meta API..."
|
echo "Fetching GitHub meta API..."
|
||||||
curl -sS https://api.github.com/meta > /tmp/github-meta.json
|
curl -sS https://api.github.com/meta > /tmp/github-meta.json
|
||||||
|
|
||||||
# Get squid-proxy IP address
|
# Wait for squid-proxy service to be resolvable
|
||||||
PROXY_IP=$(getent hosts squid-proxy | awk '{ print $1 }')
|
echo "Waiting for squid-proxy service..."
|
||||||
echo "Proxy IP: $PROXY_IP"
|
for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||||
|
PROXY_IP=$(getent hosts squid-proxy | awk '{ print $1 }')
|
||||||
|
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
|
# Allow established connections
|
||||||
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user