fix: use pgrep -f to detect OpenVPN server, not transient processes

The previous check using `pgrep -x openvpn` was matching transient
openvpn processes like `openvpn --genkey` that run during installation,
causing false positives. This led to race conditions where the CI
thought the server was running when it was actually still installing.

Use `pgrep -f "openvpn.*server.conf"` to specifically match the actual
OpenVPN server process running with the server configuration.
This commit is contained in:
Stanislas Lange
2025-12-11 17:11:11 +01:00
committed by Stanislas
parent 6cca56f5b5
commit d9e11822db

View File

@@ -99,8 +99,9 @@ jobs:
run: | run: |
echo "Waiting for OpenVPN server to install and start..." echo "Waiting for OpenVPN server to install and start..."
for i in {1..60}; do for i in {1..60}; do
# Use pgrep -x to match exactly "openvpn" process, not "apt-get install openvpn" # Use pgrep -f to match openvpn running with server.conf, not transient
if docker exec openvpn-server pgrep -x openvpn > /dev/null 2>&1; then # processes like "openvpn --genkey" that run during installation
if docker exec openvpn-server pgrep -f "openvpn.*server.conf" > /dev/null 2>&1; then
echo "OpenVPN server is running!" echo "OpenVPN server is running!"
break break
fi fi
@@ -111,7 +112,7 @@ jobs:
done done
# Final check # Final check
if ! docker exec openvpn-server pgrep -x openvpn > /dev/null 2>&1; then if ! docker exec openvpn-server pgrep -f "openvpn.*server.conf" > /dev/null 2>&1; then
echo "ERROR: OpenVPN server failed to start" echo "ERROR: OpenVPN server failed to start"
docker logs openvpn-server docker logs openvpn-server
exit 1 exit 1