High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: retry docker port mapping and surface container logs on any failure
Luigi Agosti85fd67dceef9
diff --git a/scripts/docker-smoke.sh b/scripts/docker-smoke.shindex 6fe4d7a4..820f3b1f 100644--- a/scripts/docker-smoke.sh+++ b/scripts/docker-smoke.sh@@ -7,25 +7,35 @@ SMOKE_TOKEN="pinchtab-smoke-token-${RANDOM}${RANDOM}"NAME="pinchtab-smoke-${RANDOM}${RANDOM}"FAILED=0+fail() {+ FAILED=1+ echo "$1"+ exit 1+}+cleanup() {if docker ps -a --format '{{.Names}}' | grep -Fxq "$NAME"; thenif [ "$FAILED" -ne 0 ]; thenecho ""echo "Container logs:"- docker logs "$NAME" || true+ docker logs "$NAME" 2>&1 | tail -50 || truefidocker rm -f "$NAME" >/dev/null 2>&1 || truefi}-trap cleanup EXIT+trap 'FAILED=${FAILED:-1}; cleanup' EXITdocker run -d --name "$NAME" -e PINCHTAB_TOKEN="$SMOKE_TOKEN" -p 127.0.0.1::9867 "$IMAGE" >/dev/null-HOST_PORT="$(docker port "$NAME" 9867/tcp | head -1 | awk -F: '{print $NF}')"+# Retry docker port: the mapping may not be visible immediately after 'docker run -d'.+HOST_PORT=""+for _ in $(seq 1 10); do+ HOST_PORT="$(docker port "$NAME" 9867/tcp 2>/dev/null | head -1 | awk -F: '{print $NF}')"+ [ -n "$HOST_PORT" ] && break+ sleep 1+doneif [ -z "$HOST_PORT" ]; then- FAILED=1- echo "failed to determine published host port"- exit 1+ fail "failed to determine published host port after retries"fihealth_check() {@@ -42,25 +52,22 @@ for _ in $(seq 1 60); dodoneif ! health_check; then- FAILED=1- echo "health check did not pass"- exit 1+ fail "health check did not pass within 60s"fibind_addr="$(docker exec "$NAME" pinchtab config get server.bind | tr -d '\r')"if [ "$bind_addr" != "0.0.0.0" ]; then- FAILED=1- echo "unexpected server.bind: $bind_addr"- exit 1+ fail "unexpected server.bind: $bind_addr"ficonfig_path="$(docker exec "$NAME" pinchtab config path | tr -d '\r')"if [ -z "$config_path" ]; then- FAILED=1- echo "failed to determine container config path"- exit 1+ fail "failed to determine container config path"fi-docker exec "$NAME" test -f "$config_path"+if ! docker exec "$NAME" test -f "$config_path"; then+ fail "config file not found at reported path: $config_path"+fi+FAILED=0echo "Docker smoke test passed."