|
32 | 32 | with: |
33 | 33 | config: networks/solana/starship/configs/config.yaml |
34 | 34 |
|
| 35 | + - name: Wait for Solana RPC (with port-forward fallback) |
| 36 | + run: | |
| 37 | + set -euxo pipefail |
| 38 | + # Try to discover the Starship namespace from action outputs or by scanning pods |
| 39 | + NS="${{ steps.starship-infra.outputs.namespace }}" |
| 40 | + if [ -z "${NS}" ]; then |
| 41 | + NS=$(kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{"\n"}{end}' | awk '/solana-genesis/{print $1; exit}' || true) |
| 42 | + fi |
| 43 | + echo "Using namespace: ${NS:-<unknown>}" |
| 44 | +
|
| 45 | + echo "Checking pods status..." |
| 46 | + kubectl get pods -A -o wide || true |
| 47 | + if [ -n "${NS}" ]; then |
| 48 | + kubectl get pods -n "$NS" -o wide || true |
| 49 | + # Wait up to 5 minutes for solana-genesis to be Ready |
| 50 | + (kubectl wait --for=condition=Ready pod -l app=solana-genesis -n "$NS" --timeout=300s || \ |
| 51 | + kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=solana-genesis -n "$NS" --timeout=300s) || true |
| 52 | + fi |
| 53 | +
|
| 54 | + echo "Waiting for RPC health on 127.0.0.1:8899 ..." |
| 55 | + ok=0 |
| 56 | + for i in $(seq 1 60); do |
| 57 | + if curl -fsS http://127.0.0.1:8899/health | grep -qi ok; then |
| 58 | + ok=1; break |
| 59 | + fi |
| 60 | + sleep 5 |
| 61 | + done |
| 62 | +
|
| 63 | + if [ "$ok" -ne 1 ]; then |
| 64 | + echo "RPC not reachable; attempting port-forward fallback..." |
| 65 | + if [ -z "${NS}" ]; then |
| 66 | + NS=$(kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{"\n"}{end}' | awk '/solana-genesis/{print $1; exit}' || true) |
| 67 | + fi |
| 68 | + if [ -n "${NS}" ]; then |
| 69 | + NS="$NS" bash networks/solana/starship/port-forward.sh || true |
| 70 | + else |
| 71 | + echo "Could not determine namespace for port-forward" >&2 |
| 72 | + fi |
| 73 | +
|
| 74 | + # Re-check for another 2 minutes |
| 75 | + for i in $(seq 1 24); do |
| 76 | + if curl -fsS http://127.0.0.1:8899/health | grep -qi ok; then |
| 77 | + ok=1; break |
| 78 | + fi |
| 79 | + sleep 5 |
| 80 | + done |
| 81 | + fi |
| 82 | +
|
| 83 | + if [ "$ok" -ne 1 ]; then |
| 84 | + echo "RPC still not healthy after retries" >&2 |
| 85 | + kubectl get pods -A -o wide || true |
| 86 | + if [ -n "${NS}" ]; then kubectl describe pods -n "$NS" || true; fi |
| 87 | + exit 1 |
| 88 | + fi |
| 89 | +
|
35 | 90 | - name: Run Solana Unit Tests |
36 | 91 | run: cd ./networks/solana && yarn test |
0 commit comments