Add zuul related variables in prepare script

Prepare to switch to zuul for trigger and gating.

Change-Id: I58eb2e52be04186385711daf324ec86798b8b990
This commit is contained in:
zhaoxinyu 2014-05-08 00:50:18 +00:00
parent 097ba7eaa4
commit 47550ababc

View File

@ -5,6 +5,7 @@ copy2dir()
{ {
repo=$1 repo=$1
destdir=$2 destdir=$2
git_branch=master
if [[ "$repo" =~ (git|http|https|ftp):// ]]; then if [[ "$repo" =~ (git|http|https|ftp):// ]]; then
if [[ -d $destdir || -L $destdir ]]; then if [[ -d $destdir || -L $destdir ]]; then
cd $destdir cd $destdir
@ -23,8 +24,8 @@ copy2dir()
git remote update git remote update
git reset --hard git reset --hard
git clean -x -f git clean -x -f
git checkout master git checkout $git_branch
git reset --hard remotes/origin/master git reset --hard remotes/origin/$git_branch
else else
echo "create $destdir" echo "create $destdir"
mkdir -p $destdir mkdir -p $destdir
@ -34,17 +35,25 @@ copy2dir()
exit 1 exit 1
fi fi
cd $destdir cd $destdir
git reset --hard remotes/origin/$git_branch
fi fi
gerrit_repo=$3 if [[ ! -z $ZUUL_REF || ! -z $GERRIT_REFSPEC ]]; then
if [[ ! -z $gerrit_repo ]]; then if [[ ! -z $ZUUL_REF ]]; then
if [[ -n "$GERRIT_REFSPEC" ]];then git_repo=$ZUUL_URL/$3
git fetch $gerrit_repo $GERRIT_REFSPEC && git checkout FETCH_HEAD git_ref=$ZUUL_REF
if [ $? -ne 0 ]; then git_branch=$ZUUL_BRANCH
echo "failed to git fetch $gerrit_repo $GERRIT_REFSPEC" elif [[ ! -z $GERRIT_REFSPEC ]]; then
fi git_repo=https://$GERRIT_HOST/$3
git_ref=$GERRIT_REFSPEC
git_branch=$GERRIT_BRANCH
fi fi
git reset --hard remotes/origin/$git_branch
git fetch $git_repo $git_ref && git checkout FETCH_HEAD
if [ $? -ne 0 ]; then
echo "failed to git fetch $git_repo $git_ref"
fi
git clean -x -f
fi fi
git clean -x -f
else else
sudo rm -rf $destdir sudo rm -rf $destdir
sudo cp -rf $repo $destdir sudo cp -rf $repo $destdir
@ -129,12 +138,12 @@ if [ -z $WEB_SOURCE ]; then
echo "web source $WEB_SOURCE is not set" echo "web source $WEB_SOURCE is not set"
exit 1 exit 1
fi fi
copy2dir "$WEB_SOURCE" "$WEB_HOME" "$WEB_GERRIT_URL" copy2dir "$WEB_SOURCE" "$WEB_HOME" "stackforge/compass-web"
if [ -z $ADAPTERS_SOURCE ]; then if [ -z $ADAPTERS_SOURCE ]; then
echo "adpaters source $ADAPTERS_SOURCE is not set" echo "adpaters source $ADAPTERS_SOURCE is not set"
exit 1 exit 1
fi fi
copy2dir "$ADAPTERS_SOURCE" "$ADAPTERS_HOME" "$ADAPTERS_GERRIT_URL" copy2dir "$ADAPTERS_SOURCE" "$ADAPTERS_HOME" "stackforge/compass-adapters"
if [ "$tempest" == "true" ]; then if [ "$tempest" == "true" ]; then
if [[ ! -e /tmp/tempest ]]; then if [[ ! -e /tmp/tempest ]]; then