Skip to content

Commit 95a07c5

Browse files
authored
Add wait for proxy
1 parent 90e4fae commit 95a07c5

1 file changed

Lines changed: 46 additions & 4 deletions

File tree

.github/workflows/workflow.yml

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,31 @@ jobs:
100100
http_proxy: http://squid-proxy:3128
101101
https_proxy: http://squid-proxy:3128
102102
steps:
103-
- name: Install iptables
103+
- name: Wait for proxy to be ready
104+
run: |
105+
echo "Waiting for squid proxy to be ready..."
106+
for i in $(seq 1 30); do
107+
if nc -z squid-proxy 3128 2>/dev/null; then
108+
echo "Proxy is ready!"
109+
exit 0
110+
fi
111+
echo "Attempt $i: Proxy not ready, waiting..."
112+
sleep 1
113+
done
114+
echo "Proxy failed to become ready"
115+
exit 1
116+
env:
117+
http_proxy: ""
118+
https_proxy: ""
119+
- name: Install dependencies
104120
run: |
105121
apt-get update
106-
apt-get install -y iptables
122+
apt-get install -y iptables curl
123+
- name: Verify proxy is working
124+
run: |
125+
echo "Testing proxy connectivity..."
126+
curl -s -o /dev/null -w "%{http_code}" --proxy http://squid-proxy:3128 http://github.com || true
127+
echo "Proxy verification complete"
107128
- name: Block direct traffic (enforce proxy usage)
108129
run: |
109130
# Get the squid-proxy container IP
@@ -154,10 +175,31 @@ jobs:
154175
http_proxy: http://squid-proxy:3128
155176
https_proxy: http://squid-proxy:3128
156177
steps:
157-
- name: Install iptables
178+
- name: Wait for proxy to be ready
179+
run: |
180+
echo "Waiting for squid proxy to be ready..."
181+
for i in $(seq 1 30); do
182+
if nc -z squid-proxy 3128 2>/dev/null; then
183+
echo "Proxy is ready!"
184+
exit 0
185+
fi
186+
echo "Attempt $i: Proxy not ready, waiting..."
187+
sleep 1
188+
done
189+
echo "Proxy failed to become ready"
190+
exit 1
191+
env:
192+
http_proxy: ""
193+
https_proxy: ""
194+
- name: Install dependencies
158195
run: |
159196
apt-get update
160-
apt-get install -y iptables
197+
apt-get install -y iptables curl
198+
- name: Verify proxy is working
199+
run: |
200+
echo "Testing proxy connectivity..."
201+
curl -s -o /dev/null -w "%{http_code}" --proxy http://squid-proxy:3128 http://github.com || true
202+
echo "Proxy verification complete"
161203
- name: Block direct traffic (enforce proxy usage)
162204
run: |
163205
# Get the squid-proxy container IP

0 commit comments

Comments
 (0)