From 537a2926745a2acbacfa682295f06fa44c42716a Mon Sep 17 00:00:00 2001 From: andrea-frittoli Date: Tue, 27 May 2014 21:24:51 +0100 Subject: [PATCH] Allow to configure git base URL Makes the devstack-gate usable with a generic git repo. git.openstack.org is hard-coded in functions.sh. Make it configurable via GIT_BASE. Set defaults in functions.sh just in case there is a consumer of functions.sh other than devstack-gate-gate-wrap.sh. Define GIT_BASE in devstack-vm-gate-wrap.sh which defaults to git.openstack.org, so that it can be set via JJB changes only (layout.yaml). The name of the "trunk" branch where devstack-gate is fecthed from, and where grenade gets the latest code from, is hard-coded to "master. Define GIT_BRANCH in devstack-vm-gate-wrap.sh which defaults to master. Change-Id: I59c1c63d6e8ac8482821728bf03bfce69898e919 --- devstack-vm-gate-wrap.sh | 9 ++++++--- functions.sh | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/devstack-vm-gate-wrap.sh b/devstack-vm-gate-wrap.sh index c033e135..331cf19b 100755 --- a/devstack-vm-gate-wrap.sh +++ b/devstack-vm-gate-wrap.sh @@ -22,6 +22,9 @@ # Most of the work of this script is done in functions so that we may # easily redirect their stdout / stderr to log files. +GIT_BASE=${GIT_BASE:-https://git.openstack.org} +GIT_BRANCH=${GIT_BRANCH:-master} + source $WORKSPACE/devstack-gate/functions.sh start_timer @@ -107,7 +110,7 @@ if [ -z "$SKIP_DEVSTACK_GATE_PROJECT" ]; then # Since we're early in the script, we need to update the d-g # copy in the workspace, not $DEST, which is what will be # updated later. - setup_project openstack-infra/devstack-gate master + setup_project openstack-infra/devstack-gate $GIT_BRANCH cd $WORKSPACE re_exec_devstack_gate @@ -215,7 +218,7 @@ if [ "$DEVSTACK_GATE_GRENADE" -eq "1" ]; then export GRENADE_NEW_BRANCH="stable/icehouse" else # master export GRENADE_OLD_BRANCH="stable/icehouse" - export GRENADE_NEW_BRANCH="master" + export GRENADE_NEW_BRANCH="$GIT_BRANCH" fi if [ "$DEVSTACK_GATE_GRENADE_PARTIAL_NCPU" -eq "1" ]; then export DO_NOT_UPGRADE_SERVICES=[n-cpu] @@ -230,7 +233,7 @@ elif [ "$DEVSTACK_GATE_GRENADE_FORWARD" -eq "1" ]; then export GRENADE_NEW_BRANCH="stable/icehouse" elif [ "$GRENADE_BASE_BRANCH" == "stable/icehouse" ]; then export GRENADE_OLD_BRANCH="stable/icehouse" - export GRENADE_NEW_BRANCH="master" + export GRENADE_NEW_BRANCH="$GIT_BRANCH" fi fi diff --git a/functions.sh b/functions.sh index 4e4e1f76..9f542034 100644 --- a/functions.sh +++ b/functions.sh @@ -131,10 +131,11 @@ function git_remote_set_url { function git_clone_and_cd { local project=$1 local short_project=$2 + local git_base=${GIT_BASE:-https://git.openstack.org} if [[ ! -e $short_project ]]; then echo " Need to clone $short_project" - git clone https://git.openstack.org/$project + git clone $git_base/$project fi cd $short_project } @@ -208,11 +209,12 @@ function setup_project { local project=$1 local branch=$2 local short_project=`basename $project` + local git_base=${GIT_BASE:-https://git.openstack.org} echo "Setting up $project @ $branch" git_clone_and_cd $project $short_project - git_remote_set_url origin https://git.openstack.org/$project + git_remote_set_url origin $git_base/$project # allow for possible project branch override local uc_project=`echo $short_project | tr [:lower:] [:upper:] | tr '-' '_' | sed 's/[^A-Z_]//'`