#!/usr/bin/env bash # # probe-e2e-fixtures.sh — reachability gate for the guarded v2-e2e workflow (#757). # # TCP-probes the shared fixture host's REQUIRED simulator ports. Prints `reachable=true|false` (and # appends it to $GITHUB_OUTPUT when set). Exit status is always 0: an unreachable fleet is an expected, # clean skip (the runner is off-VPN, the host is down), not a failure. Only the probe itself erring # (bad usage) exits non-zero. # # Env: E2E_FIXTURE_HOST (default 10.100.0.35) # E2E_REQUIRED_PORTS (default "5020 1102 50000" = Modbus, S7, opc-plc) # E2E_PROBE_TIMEOUT (seconds per port, default 5) set -uo pipefail host="${E2E_FIXTURE_HOST:-10.100.0.35}" ports="${E2E_REQUIRED_PORTS:-5020 1102 50000}" t="${E2E_PROBE_TIMEOUT:-5}" ok=true for p in $ports; do if timeout "$t" bash -c "exec 3<>/dev/tcp/$host/$p" 2>/dev/null; then echo "probe: $host:$p open" else echo "probe: $host:$p UNREACHABLE"; ok=false fi done echo "reachable=$ok" [ -n "${GITHUB_OUTPUT:-}" ] && echo "reachable=$ok" >> "$GITHUB_OUTPUT" exit 0