blob: 2bfb5eb34a8a817a6b488f4691b7f65f403792b2 [file] [log] [blame] [edit]
#!/bin/bash
# Copyright 2013 Google Inc. All Rights Reserved.
# Author: billiani@google.com (Leonardo Billiani)
#
# Script to update repositories and FR.
# It assumes all the repositories are in the same root directory
ACTION=$1
SERVER=$2
REPOSITORY_PATH=$3
FR_DIRECTORY=$4
FR_CONFIG_DIRECTORY=$5
EXPECTED_ARGS=5
function usage {
echo "Usage: $0 <restart|reconfig> <server> <repository_path> <fr_directory> <fr_config_directory>"
echo " restart|reconfig : 'restart' will restart the master and slaves."
echo " 'reconfig' will update the master."
echo " Use reconfig when no changes to sequences have been made."
echo " server : Server name to update."
echo " repository_path : Root Location of all repositories to update."
echo " fr_directory : Path to fr installation"
echo " fr_config_directory : Path to fr config directory"
}
if [ $# -lt $EXPECTED_ARGS ]
then
usage
exit 0
fi
if [ $ACTION != 'restart' -a $ACTION != 'reconfig' ]
then
usage
exit 0
fi
# Update repositories and do not output stdout
source $HOME/.bashrc
for repository in 'test' 'continuous-tests' 'autotest' 'fragglerock' 'chromite/chromite' 'chromium/src'
do
cd $REPOSITORY_PATH/$repository && /usr/bin/git clean -f -d -x 1> /dev/null && /usr/bin/git fetch 1> /dev/null && /usr/bin/git reset --hard FETCH_HEAD 1> /dev/null
done
if [ $ACTION = 'restart' ]
then
# Stop all the slaves to return all the devices
echo "Stopping the slaves"
curl http://$SERVER:8010/builders/_all/stopall
sleep 10
fi
cd $REPOSITORY_PATH/test && . ./setup_env.sh $FR_CONFIG_DIRECTORY
PYTHONPATH=$PYTHONPATH:/usr/local/autotest
cd $FR_DIRECTORY/buildbot/master && $FR_DIRECTORY/python-sandbox/bin/buildbot $ACTION
if [ $ACTION = 'restart' ]
then
# Start all the slaves after the restart
curl http://$SERVER:8010/builders/_all/forceall
fi