retry cell get on an error

Change-Id: I113efbeeaadffb5bc412f23868600bc460104e52
diff --git a/jjb/onos/onos-run-stc-hag.sh b/jjb/onos/onos-run-stc-hag.sh
index 2a036c1..18792cd 100644
--- a/jjb/onos/onos-run-stc-hag.sh
+++ b/jjb/onos/onos-run-stc-hag.sh
@@ -28,7 +28,7 @@
     cell return
 done
 
-if [ $? -ne 0 ]; then
+if [ $err -ne 0 ]; then
     exit 1
 fi
 
diff --git a/jjb/onos/onos-run-stc.sh b/jjb/onos/onos-run-stc.sh
index 130abcd..23e8414 100644
--- a/jjb/onos/onos-run-stc.sh
+++ b/jjb/onos/onos-run-stc.sh
@@ -1,8 +1,5 @@
 #!/bin/bash
 
-# exit on errors
-set -eu -o pipefail
-
 # initialize build environment
 ONOS_ROOT=`pwd`
 . tools/build/envDefaults
@@ -19,8 +16,24 @@
 
 trap cleanup EXIT
 
+let err=0
 # grab a cell to run on
-cell borrow 30 3+1 jenkins-${ONOS_VERSION}
+for i in 1 2 3 4 5; do
+    cell borrow 30 3+1 jenkins-${ONOS_VERSION}
+    if [ $? -eq 0 ]; then
+        let err=0
+        break
+    fi
+    let err=$err+1
+    cell return
+done
+
+if [ $err -ne 0 ]; then
+    exit 1
+fi
+
+# exit on errors
+set -eu -o pipefail
 
 # build onos bits
 onos-buck build onos