Skip to content

Commit

Permalink
minor modifications to gcp_auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarsh2001 committed Oct 6, 2023
1 parent 8109adc commit b08ed07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions .github/auth/vm_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ def authenticate_vm(path):

def _start_ssh_session(response, creds, username, passphrase):
external_ip = response["networkInterfaces"][0]["accessConfigs"][0]["natIP"]
print(external_ip)

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

Expand Down Expand Up @@ -53,6 +51,7 @@ def start_runner(
max_wait_time = 600
wait_interval = 10
waited_time = 0
response = None

while waited_time < max_wait_time:
response = (
Expand All @@ -61,7 +60,6 @@ def start_runner(
status = response.get("status")

if status == "RUNNING":
print("Yaaaay")
break

time.sleep(wait_interval)
Expand All @@ -76,7 +74,7 @@ def start_runner(

def stop_runner(creds):
compute = authenticate_vm(creds)
request = compute.instances().start(
request = compute.instances().stop(
project="gpu-insatnce", zone="us-central1-a", instance="demos-tests"
)
request.execute()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gcp-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
echo "${{ secrets.SSH_KEY }}" > $HOME/.ssh/id_rsa
chmod 600 $HOME/.ssh/id_rsa
python3 db_auth.py ${{ secrets.DB_ENDPOINT }} ${{ secrets.DB_OBJ_ID }}
python3 vm_auth.py ${{ secrets.SSH_USERNAME }} ${{ secrets.SSH_PASSPHRASE }} "true"
python3 vm_auth.py ${{ secrets.SSH_USERNAME }} ${{ secrets.SSH_PASSPHRASE }} "false"
run-test:
needs: activate-vm
Expand Down Expand Up @@ -71,6 +71,6 @@ jobs:
run: |
cd demos/.github/auth
python3 db_auth.py ${{ secrets.DB_ENDPOINT }} ${{ secrets.DB_OBJ_ID }}
python3 vm_auth.py ${{ secrets.SSH_USERNAME }} ${{ secrets.SSH_PASSPHRASE }} "false"
python3 vm_auth.py ${{ secrets.SSH_USERNAME }} ${{ secrets.SSH_PASSPHRASE }} "true"

0 comments on commit b08ed07

Please sign in to comment.