This is an automated email from the ASF dual-hosted git repository.

rhoughton pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 82c0a73  GEODE-7567: Improve cleanup logic in create_instance.sh 
(#4459)
82c0a73 is described below

commit 82c0a739efaa28e4456f045f3dc3d574325cb109
Author: Scott Jewell <[email protected]>
AuthorDate: Wed Dec 11 09:26:03 2019 -0800

    GEODE-7567: Improve cleanup logic in create_instance.sh (#4459)
    
    * GEODE-7567: Improve cleanup logic in create_instance.sh
    
    * GEODE-7567: Increase number of retry attempts
---
 ci/pipelines/geode-build/jinja.template.yml | 10 +++++-----
 ci/scripts/create_instance.sh               | 14 +++++---------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/ci/pipelines/geode-build/jinja.template.yml 
b/ci/pipelines/geode-build/jinja.template.yml
index e004081..f562a59 100644
--- a/ci/pipelines/geode-build/jinja.template.yml
+++ b/ci/pipelines/geode-build/jinja.template.yml
@@ -261,7 +261,7 @@ jobs:
           path: new
         - name: instance-data
       timeout: 15m
-      attempts: 2
+      attempts: 5
   - aggregate:
     - put: geode-build-version
       params:
@@ -528,7 +528,7 @@ jobs:
       - name: attempts-log
         path: new
     timeout: 15m
-    attempts: 2
+    attempts: 5
   - task: rsync_code_up
     image: alpine-tools-image
     config:
@@ -615,7 +615,7 @@ jobs:
             - name: attempts-log
               path: new
           timeout: 15m
-          attempts: 2
+          attempts: 5
         - task: rsync_code_up-{{java_test_version.name}}
           image: alpine-tools-image
           config:
@@ -628,7 +628,7 @@ jobs:
             - name: instance-data-{{java_test_version.name}}
               path: instance-data
           timeout: 15m
-          attempts: 2
+          attempts: 5
         - task: execute_tests-{{java_test_version.name}}
           image: alpine-tools-image
           config:
@@ -666,7 +666,7 @@ jobs:
               - name: geode-results-{{java_test_version.name}}
                 path: geode-results
             timeout: 15m
-            attempts: 2
+            attempts: 5
           ensure:
             do:
             - aggregate:
diff --git a/ci/scripts/create_instance.sh b/ci/scripts/create_instance.sh
index 78884ca..3c4b165 100755
--- a/ci/scripts/create_instance.sh
+++ b/ci/scripts/create_instance.sh
@@ -85,22 +85,18 @@ cp old/attempts new/
 echo attempt >> new/attempts
 attempts=$(cat new/attempts | wc -l)
 
+PERMITTED_ZONES=(us-central1-a us-central1-b us-central1-c us-central1-f)
 if [ $attempts -eq 1 ]; then
   ZONE=${MY_ZONE}
 else
-  #during retry we need to clean up the prior zone
-  PRIOR_ZONE=$(cat new/prior-zone)
-  gcloud compute instances delete ${INSTANCE_NAME} --zone=${PRIOR_ZONE} 
--quiet &>/dev/null || true
-  PERMITTED_ZONES=(us-central1-a us-central1-b us-central1-c us-central1-f)
   ZONE=${PERMITTED_ZONES[$((${RANDOM} % 4))]}
 fi
 echo "Deploying to zone ${ZONE}"
 
-#remember zone in case we retry
-echo ${ZONE} > new/prior-zone
-
-#in a retry loop we intentionally generate the same instance name, so make 
sure prior attempt is cleaned up
-gcloud compute instances delete ${INSTANCE_NAME} --zone=${ZONE} --quiet 
&>/dev/null || true
+# Ensure no existing instance with this name in any zone
+for KILL_ZONE in "${PERMITTED_ZONES}"; do
+  gcloud compute instances delete ${INSTANCE_NAME} --zone=${KILL_ZONE} --quiet 
&>/dev/null || true
+done
 
 echo "${INSTANCE_NAME}" > "instance-data/instance-name"
 echo "${GCP_PROJECT}" > "instance-data/project"

Reply via email to