Skip to content

Commit 5e1d958

Browse files
committed
Rework server-up checking to not use SSH
1 parent eec3f69 commit 5e1d958

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/scripts/adhoc.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,15 @@ if [[ ${ACTION} == "deploy-metal" ]]; then
101101
DEVICE_ID=$(jq -r '.id' <<< "$RESPONSE")
102102
echo "Got Address ${IP_ADDRESS} and Device Id ${DEVICE_ID}"
103103
popd
104-
104+
105105
STATUS=0
106106
for i in {1..60}; do
107-
echo "Checking the SSH is up $i"
108-
if ssh -o StrictHostKeyChecking=no ubuntu@"${IP_ADDRESS}" "echo ok" 2>/dev/null; then
109-
STATUS=1
110-
break
107+
if [[ $STATUS -eq 0 ]]; then
108+
[[ "$(curl -s -H "Authorization: Bearer $TOKEN" \
109+
https://api.phoenixnap.com/bmc/v1/servers/$ID | jq -r '.status')" == "powered-on" ]] && STATUS=1
110+
fi
111+
if [[ $STATUS -eq 1 ]]; then
112+
nc -z -w 2 "$IP" 22 && break
111113
fi
112114
sleep 5
113115
done

0 commit comments

Comments
 (0)