From 12733e9bf1fba53376ca1e158674a6c22c8cc3f2 Mon Sep 17 00:00:00 2001
From: Christian Boettcher <c.boettcher@fz-juelich.de>
Date: Thu, 5 Aug 2021 09:33:54 +0200
Subject: [PATCH] wait for the new instance to be available before attaching
 the floating ip

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 72199c9..e3d6fba 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -94,6 +94,7 @@ deploy-testing:
     - openstack server remove floating ip $OLD_ID $FLOATING_IP
     # NO VOLUME IN TESTING DEPLOYMENT - openstack server remove volume $OLD_ID $VOLUME_ID
     - INSTANCE_ID=`openstack server create -f value -c id --prefix IMAGE_ --flavor s2 --image 149a65b5-aeb8-499f-aaa6-ec966bd28dd6 --user-data deploy_scripts/cloudinit.yml --security-group ssh --security-group www --security-group https testing-deployment`
+    - while [ "`openstack server show $INSTANCE_ID -c addresses -f value`"" = "{}" ]; do sleep 5; done # wait until an address is available to attach the floating ip
     - openstack server add floating ip $INSTANCE_ID $FLOATING_IP
     # NO VOLUME IN TESTING DEPLOYMENT - openstack server add volume $INSTANCE_ID $VOLUME_ID
     - openstack server delete $OLD_ID
-- 
GitLab