From a743aa2de077a623b67e115b540c82ba26c25dfc Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 7 May 2024 14:16:11 -0400 Subject: [PATCH] wip: Exit polling loop if status is complete, both password and ip are set --- .github/workflows/create-instance.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-instance.yml b/.github/workflows/create-instance.yml index 94ba895c..40322b4c 100644 --- a/.github/workflows/create-instance.yml +++ b/.github/workflows/create-instance.yml @@ -148,11 +148,20 @@ jobs: jq -r .exoSetup | \ jq -r .status) - if [ "$status" = "complete" ]; then + has_pwd=$( + openstack server show $INSTANCE_NAME -c tags -f json | \ + jq -r '.tags[] | startswith("exoPw")') + + has_ip=$( + openstack server show $INSTANCE_NAME -c addresses -f json | \ + jq -r '.addresses.auto_allocated_network[1] != null' + ) + + if [ "$status" = "complete" && has_pwd $$ $has_ip ]; then echo "Status is complete. Exiting loop." break else - echo "Status is $status. Waiting for completion..." + echo "Status is '$status', has_pwd is '$has_pwd', has_ip is '$has_ip'. Waiting for completion..." sleep $wait_interval total_wait_time=$((total_wait_time + wait_interval)) fi