Change git clone source to git.o.o and ref source to review.o.o

Reduce load to gerrit, only get refs from gerrit

Change-Id: I9c94bc265f3dc259c087619c7efdb8c3cbff2f92
This commit is contained in:
zhaoxinyu 2014-03-12 01:44:21 +00:00
parent 04bf061db2
commit ac2298e15d
3 changed files with 17 additions and 11 deletions

View File

@ -24,7 +24,6 @@ export NEXTSERVER=${NEXTSERVER:-}
# the domains covered by nameserver
export NAMESERVER_DOMAINS=${NAMESERVER_DOMAINS:-}
export REPO_URL=${REPO_URL:-"https://github.com"}
# set the default cobbler user "cobbler" password, if not set, the default will be cobbler/cobbler
export CBLR_USER=${CBLR_USER:-}
export CBLR_PASSWD=${CBLR_PASSWD:-}

View File

@ -2,7 +2,7 @@
# Config File for Compass Installer #
#####################################
# REPO_URL indicates the source where to download compass-web and compass-adapters from
export REPO_URL=https://review.openstack.org
#export REPO_URL=https://review.openstack.org
# OS_INSTALLER indicates the tool for OS provisioning, default is 'cobbler'.
export OS_INSTALLER=cobbler
@ -53,8 +53,8 @@ export CHEF_PASSWD=root1234
# Set Compass-web and Compass-adpater variables
export WEB_HOME=${WEB_HOME:='/tmp/web'}
export ADAPTER_HOME=${ADAPTER_HOME:-'/tmp/adapter'}
export WEB_SOURCE=${WEB_SOURCE:-${REPO_URL}'/stackforge/compass-web'}
export ADAPTER_SOURCE=${ADAPTER_SOURCE:-${REPO_URL}'/stackforge/compass-adapters'}
export WEB_SOURCE=${WEB_SOURCE:-'compass-web'}
export ADAPTER_SOURCE=${ADAPTER_SOURCE:-'compass-adapters'}
export SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
export COMPASSDIR=${SCRIPT_DIR}/..

View File

@ -3,29 +3,36 @@
copygit2dir()
{
repo=$1
project=$1
destdir=$2
if [ -z "$REPO_URL" ];then
git_repo=http://git.openstack.org/stackforge/$project
gerrit_repo=https://review.openstack.org/stackforge/$project
else
git_repo=$REPO_URL/stackforge/$project
gerrit_repo=$REPO_URL/stackforge/$project
fi
if [ -d $destdir ];then
echo "$destdir exists"
cd $destdir
git remote set-url origin $repo
git remote set-url origin $git_repo
git remote update
git reset --hard
git clean -x -f
git checkout master
git reset --hard remotes/origin/master
if [[ -n "$GERRIT_REFSPEC" ]];then
git fetch origin $GERRIT_REFSPEC && git checkout FETCH_HEAD
git fetch $gerrit_repo $GERRIT_REFSPEC && git checkout FETCH_HEAD
fi
git clean -x -f
else
echo "create $destdir"
mkdir -p $destdir
git clone $repo $destdir
git clone $git_repo $destdir
if [[ -n "$GERRIT_REFSPEC" ]];then
# project=$(echo $repo|rev|cut -d '/' -f 1|rev)
cd $destdir
git fetch $repo $GERRIT_REFSPEC && git checkout FETCH_HEAD
git fetch $gerrit_repo $GERRIT_REFSPEC && git checkout FETCH_HEAD
fi
fi
cd $SCRIPT_DIR
@ -109,8 +116,8 @@ fi
cd $SCRIPT_DIR
if [ "$source" != "local" ]; then
copygit2dir $WEB_SOURCE $WEB_HOME
copygit2dir $ADAPTER_SOURCE $ADAPTER_HOME
copygit2dir compass-web $WEB_HOME
copygit2dir compass-adapters $ADAPTER_HOME
else
copylocal2dir $WEB_SOURCE $WEB_HOME
copylocal2dir $ADAPTER_SOURCE $ADAPTER_HOME