Small tweaks: fix example for running one API test in run-tests.sh;
[arvados-dev.git] / jenkins / run-deploy.sh
index 6509e916a5594bca0011cb40f947354f98b99734..a55678bc69a4cc8301fde6fa7e52b0fd80464e1a 100755 (executable)
@@ -88,7 +88,7 @@ title "Deploying API server complete"
 # Install updated debian packages
 title "Deploying updated arvados debian packages"
 
-ssh -p2222 $IDENTIFIER.arvadosapi.com -C "apt-get update && apt-get install arvados-src python-arvados-fuse python-arvados-python-client"
+ssh -p2222 root@$IDENTIFIER.arvadosapi.com -C "apt-get update && apt-get -qqy install arvados-src python-arvados-fuse python-arvados-python-client"
 
 if [[ "$ECODE" != "0" ]]; then
   title "!!!!!! DEPLOYING DEBIAN PACKAGES FAILED !!!!!!"
@@ -98,6 +98,19 @@ fi
 
 title "Deploying updated arvados debian packages complete"
 
+# Install updated arvados gems
+title "Deploying updated arvados gems"
+
+ssh -p2222 root@$IDENTIFIER.arvadosapi.com -C "/usr/local/rvm/bin/rvm default do gem install arvados arvados-cli && /usr/local/rvm/bin/rvm default do gem clean arvados arvados-cli"
+
+if [[ "$ECODE" != "0" ]]; then
+  title "!!!!!! DEPLOYING ARVADOS GEMS FAILED !!!!!!"
+  EXITCODE=$(($EXITCODE + $ECODE))
+  exit $EXITCODE
+fi
+
+title "Deploying updated arvados gems complete"
+
 # Deploy Workbench
 title "Deploying workbench"
 cd "$WORKSPACE"
@@ -123,4 +136,70 @@ fi
 
 title "Deploying workbench complete"
 
+# Update compute node(s)
+title "Update compute node(s)"
+
+# Get list of nodes that are up
+COMPRESSED_NODE_LIST=`ssh -p2222 root@$IDENTIFIER -C "sinfo --long -p crypto -r -o "%N" -h"`
+
+if [[ "$COMPRESSED_NODE_LIST" != '' ]]; then
+  COMPUTE_NODES=`ssh -p2222 root@$IDENTIFIER -C "scontrol show hostname $COMPRESSED_NODE_LIST"`
+
+  SUM_ECODE=0
+  for node in $COMPUTE_NODES; do
+    echo "Updating $node.$IDENTIFIER"
+    ssh -p2222  -o "StrictHostKeyChecking no" -o "ConnectTimeout 5" root@$node.$IDENTIFIER -C "/usr/bin/puppet agent -t"
+    ECODE=$?
+    if [[ "$ECODE" != "255" && "$ECODE" != "2" && "$ECODE" != "0"  ]]; then
+      # 255 -> connection timed out. Just ignore that, it's possible the compute node was being shut down.
+      # Puppet exits '2' if there are changes. For real!
+      SUM_ECODE=$(($SUM_ECODE + $ECODE))
+      echo "ERROR updating $node.$IDENTIFIER: exit code $ECODE"
+    fi
+  done
+
+  if [[ "$SUM_ECODE" != "0" ]]; then
+    title "!!!!!! Update compute node(s) FAILED !!!!!!"
+    EXITCODE=$(($EXITCODE + $SUM_ECODE))
+  fi
+fi
+
+title "Update compute node(s) complete"
+
+title "Update shell"
+
+ssh -p2222 root@shell.$IDENTIFIER -C "/usr/bin/puppet agent -t"
+
+ECODE=$?
+
+if [[ "$ECODE" == "2" ]]; then
+  # Puppet exits '2' if there are changes. For real!
+  ECODE=0
+fi
+
+if [[ "$ECODE" != "0" ]]; then
+  title "!!!!!! Update shell FAILED !!!!!!"
+  EXITCODE=$(($EXITCODE + $ECODE))
+fi
+
+title "Update shell complete"
+
+title "Update keep0"
+
+ssh -p2222 root@keep0.$IDENTIFIER -C "/usr/bin/puppet agent -t"
+
+ECODE=$?
+
+if [[ "$ECODE" == "2" ]]; then
+  # Puppet exits '2' if there are changes. For real!
+  ECODE=0
+fi
+
+if [[ "$ECODE" != "0" ]]; then
+  title "!!!!!! Update keep0 FAILED !!!!!!"
+  EXITCODE=$(($EXITCODE + $ECODE))
+fi
+
+title "Update keep0 complete"
+
 exit $EXITCODE