Bazel build for STC runs

Change-Id: I75806c0cb5b71402b7e3519a84498f8e05a9cf8a
diff --git a/tools/test/bin/onos-check-bits b/tools/test/bin/onos-check-bits
index 2b0acd3..1196e27 100755
--- a/tools/test/bin/onos-check-bits
+++ b/tools/test/bin/onos-check-bits
@@ -6,18 +6,17 @@
 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
 . $ONOS_ROOT/tools/build/envDefaults
 
-# If the BUCK-built bits are newer than the Maven-built bits, use the former.
+# If the bazel-built bits are newer than the buck-built bits, use the former.
 BUCK_TAR=$ONOS_ROOT/buck-out/gen/tools/package/onos-package/onos.tar.gz
-if [ -f $BUCK_TAR ] && [ $BUCK_TAR -nt $ONOS_TAR ]; then
-  rm -f $ONOS_TAR >/dev/null; ln -s $BUCK_TAR $ONOS_TAR
+BAZEL_TAR=$ONOS_ROOT/bazel-bin/onos.tar.gz
+if [ -f $BAZEL_TAR ] && [ $BAZEL_TAR -nt $ONOS_TAR ]; then
+    rm -f $ONOS_TAR >/dev/null; ln -s $BAZEL_TAR $ONOS_TAR
+else
+    if [ -f $BUCK_TAR ] && [ $BUCK_TAR -nt $ONOS_TAR ]; then
+        rm -f $ONOS_TAR >/dev/null; ln -s $BUCK_TAR $ONOS_TAR
+    fi
 fi
 
-# If the Bazel-built bits are newer than the BUCK-built bits, use the former.
-# BAZEL_TAR=$ONOS_ROOT/bazel-bin/tools/package/onos.tar.gz
-# if [ -f $BAZEL_TAR ] && [ $BAZEL_TAR -nt $BUCK_TAR ]; then
-#   rm -f $ONOS_TAR >/dev/null; ln -s $BAZEL_TAR $ONOS_TAR
-# fi
-
 ls -lL $ONOS_TAR  && cksum $ONOS_TAR
 if [ $? -ne 0 ]; then
   echo "ONOS archive is unreadable" && exit 1
diff --git a/tools/test/bin/onos-push-bits b/tools/test/bin/onos-push-bits
index 38e2877..2187edc 100755
--- a/tools/test/bin/onos-push-bits
+++ b/tools/test/bin/onos-push-bits
@@ -87,6 +87,7 @@
   if [ -n "$locHash" ] && [ "$locHash" = "$remHash" ]; then
       echo "ONOS bits $ONOS_TAR already up-to-date on $node..."
   else
+      ssh $remote rm -f $ONOS_TAR
       scp -q $ONOS_TAR $remote_with_bracket:/tmp
   fi
 fi
diff --git a/tools/test/bin/onos-push-bits-through-proxy b/tools/test/bin/onos-push-bits-through-proxy
index b983af2..978174b 100755
--- a/tools/test/bin/onos-push-bits-through-proxy
+++ b/tools/test/bin/onos-push-bits-through-proxy
@@ -19,6 +19,7 @@
 ssh $remote "
   for other in ${others//$'\n'/ } ; do
     echo \"Pushing to \$other ...\";
+    ssh -o StrictHostKeyChecking=no $ONOS_USER@\$other rm -rf /tmp/\$(basename $ONOS_TAR) &&
     scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
         /tmp/\$(basename $ONOS_TAR) \
         $ONOS_USER@[\$other]:/tmp/\$(basename $ONOS_TAR)