Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
ci: machine start fix
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Jul 28, 2023
1 parent dbf6961 commit 1b5de15
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ jobs:
- name: Launch self-hosted runners
if: steps.list.outputs.modified != 'modified=[]'
run: |
echo starting
curl -sSL -X POST -H "X-Api-Key: $API_KEY" https://api.paperspace.io/machines/$MACHINE/start
echo started
while test $(curl -fsSL -X GET -H "X-Api-Key: $API_KEY" https://api.paperspace.io/machines/getMachinePublic?machineId=$MACHINE | jq -r .state) != ready; do
echo sleeping
sleep 5
done
IP=$(curl -fsSL -X GET -H "X-Api-Key: $API_KEY" $API_INFO?machineId=$MACHINE_ID | jq -r .publicIpAddress)
echo ready
IP=$(curl -fsSL -X GET -H "X-Api-Key: $API_KEY" https://api.paperspace.io/machines/getMachinePublic?machineId=$MACHINE_ID | jq -r .publicIpAddress)
echo $IP
echo "$SSH_KEY" > key
ssh -o "StrictHostKeyChecking no" -i key paperspace@$IP 'touch "gha-run-${{ github.run_id }}.lock"'
env:
Expand Down Expand Up @@ -80,7 +85,7 @@ jobs:
- uses: actions/checkout@v3
- name: Stop self-hosted runners
run: |
IP=$(curl -fsSL -X GET -H "X-Api-Key: $API_KEY" $API_INFO?machineId=$MACHINE_ID | jq -r .publicIpAddress)
IP=$(curl -fsSL -X GET -H "X-Api-Key: $API_KEY" https://api.paperspace.io/machines/getMachinePublic?machineId=$MACHINE_ID | jq -r .publicIpAddress)
echo "$SSH_KEY" > key
ssh -o "StrictHostKeyChecking no" -i key paperspace@$IP \
'rm -f "gha-run-${{ github.run_id }}.lock"; sleep 10; ls gha-run-*.lock' || \
Expand Down

0 comments on commit 1b5de15

Please sign in to comment.