You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/08/01 19:24:00 UTC

[geode] branch develop updated: GEODE-5500 retry start_instance on failure

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

jbarrett 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 29beb36  GEODE-5500 retry start_instance on failure
29beb36 is described below

commit 29beb36c8eb2f163b6e0a58a45e0feadc4d8a0c4
Author: fsoutherland <fs...@pivotal.io>
AuthorDate: Mon Jul 30 16:20:44 2018 -0700

    GEODE-5500 retry start_instance on failure
    
    Signed-off-by: Robert Houghton <rh...@pivotal.io>
---
 ci/pipelines/geode-build/test-template.yml |  3 +-
 ci/pipelines/pull-request/pr-template.yml  |  4 +--
 ci/scripts/start_instance.sh               | 46 ++++++++++++++++++------------
 3 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/ci/pipelines/geode-build/test-template.yml b/ci/pipelines/geode-build/test-template.yml
index cd0c1b3..6cb8779 100644
--- a/ci/pipelines/geode-build/test-template.yml
+++ b/ci/pipelines/geode-build/test-template.yml
@@ -40,7 +40,8 @@ jobs:
       - do:
         - put: concourse-metadata-resource
         - task: start_instance
-          timeout: 5m
+          timeout: 15m
+          attempts: 100
           config:
             inputs:
             - name: concourse-metadata-resource
diff --git a/ci/pipelines/pull-request/pr-template.yml b/ci/pipelines/pull-request/pr-template.yml
index 84c25c0..6f37b82 100644
--- a/ci/pipelines/pull-request/pr-template.yml
+++ b/ci/pipelines/pull-request/pr-template.yml
@@ -56,7 +56,8 @@ jobs:
       - do:
         - put: concourse-metadata-resource
         - task: start_instance
-          timeout: 5m
+          timeout: 15m
+          attempts: 100
           config:
             inputs:
             - name: concourse-metadata-resource
@@ -72,7 +73,6 @@ jobs:
               GEODE_FORK: (( grab metadata.geode-fork ))
             run:
               path: geode/ci/scripts/start_instance.sh
-
     - task: rsync_code_up
       timeout: 5m
       config:
diff --git a/ci/scripts/start_instance.sh b/ci/scripts/start_instance.sh
index 0b5126b..7bdd1fb 100755
--- a/ci/scripts/start_instance.sh
+++ b/ci/scripts/start_instance.sh
@@ -60,29 +60,39 @@ echo "${PROJECT}" > "instance-data/project"
 echo "${ZONE}" > "instance-data/zone"
 
 echo 'StrictHostKeyChecking no' >> /etc/ssh/ssh_config
-echo "RAM is ${RAM}"
 RAM_MEGABYTES=$( expr ${RAM} \* 1024 )
-echo "RAM_MEGABYTES is ${RAM_MEGABYTES}"
 
-TTL=$(($(date +%s) + 60 * 60 * 6))
+while true; do
+    TTL=$(($(date +%s) + 60 * 60 * 6))
+
+    set +e
+    INSTANCE_INFORMATION=$(gcloud compute --project=${PROJECT} instances create ${INSTANCE_NAME} \
+      --zone=${ZONE} \
+      --machine-type=custom-${CPUS}-${RAM_MEGABYTES} \
+      --min-cpu-platform=Intel\ Skylake \
+      --image-family="${IMAGE_FAMILY_PREFIX}geode-builder" \
+      --image-project=${PROJECT} \
+      --boot-disk-size=100GB \
+      --boot-disk-type=pd-ssd \
+      --labels=time-to-live=${TTL} \
+      --format=json)
+    CREATE_EXIT_STATUS=$?
+    set -e
+
+    if [ ${CREATE_EXIT_STATUS} -eq 0 ]; then
+        break
+    fi
+
+    TIMEOUT=60
+    echo "Waiting ${TIMEOUT} seconds..."
+    sleep ${TIMEOUT}
+done
 
-INSTANCE_INFORMATION=$(gcloud compute --project=${PROJECT} instances create ${INSTANCE_NAME} \
-  --zone=${ZONE} \
-  --machine-type=custom-${CPUS}-${RAM_MEGABYTES} \
-  --min-cpu-platform=Intel\ Skylake \
-  --image-family="${IMAGE_FAMILY_PREFIX}geode-builder" \
-  --image-project=${PROJECT} \
-  --boot-disk-size=100GB \
-  --boot-disk-type=pd-ssd \
-  --labels=time-to-live=${TTL} \
-  --format=json)
-CREATE_EXIT_STATUS=$?
+echo "${INSTANCE_INFORMATION}" > instance-data/instance-information
 
+INSTANCE_IP_ADDRESS=$(echo ${INSTANCE_INFORMATION} | jq -r '.[].networkInterfaces[0].accessConfigs[0].natIP')
+echo "${INSTANCE_IP_ADDRESS}" > "instance-data/instance-ip-address"
 
 while ! gcloud compute --project=${PROJECT} ssh geode@${INSTANCE_NAME} --zone=${ZONE} --ssh-key-file=${SSHKEY_FILE} --quiet -- true; do
   echo -n .
 done
-echo "${INSTANCE_INFORMATION}" > instance-data/instance-information
-
-INSTANCE_IP_ADDRESS=$(echo ${INSTANCE_INFORMATION} | jq -r '.[].networkInterfaces[0].accessConfigs[0].natIP')
-echo "${INSTANCE_IP_ADDRESS}" > "instance-data/instance-ip-address"