Revert "Fix workspace setup"

This reverts commit 4d2f0e7c85
This commit is contained in:
James E. Blair 2013-12-25 16:15:38 +00:00 committed by Gerrit Code Review
parent 4d2f0e7c85
commit 830cf239cd
3 changed files with 48 additions and 70 deletions

View File

@ -204,10 +204,6 @@ export DEVSTACK_GATE_SELECT_MIRROR=${DEVSTACK_GATE_SELECT_MIRROR:-/usr/local/jen
# to run before being aborted (default 60).
export DEVSTACK_GATE_TIMEOUT=${DEVSTACK_GATE_TIMEOUT:-60}
# Set this to override the branch selected for testing (in
# single-branch checkouts; not used for grenade)
export OVERRIDE_ZUUL_BRANCH=${OVERRIDE_ZUUL_BRANCH:-$ZUUL_BRANCH}
if ! function_exists "gate_hook"; then
# the command we use to run the gate
function gate_hook {
@ -228,7 +224,7 @@ if [ "$DEVSTACK_GATE_GRENADE" -eq "1" -o "$DEVSTACK_GATE_GRENADE_FORWARD" -eq "1
setup_workspace $GRENADE_OLD_BRANCH $BASE/old &> \
$WORKSPACE/logs/devstack-gate-setup-workspace-old.txt
else
setup_workspace $OVERRIDE_ZUUL_BRANCH $BASE/new &> \
setup_workspace $ZUUL_BRANCH $BASE/new &> \
$WORKSPACE/logs/devstack-gate-setup-workspace-new.txt
fi

View File

@ -138,30 +138,16 @@ function fix_disk_layout {
fi
}
# Set up a project in accordance with the future state proposed by
# Zuul.
# do all the zuulification magic for project at a specified branch
#
# Arguments:
# project: The full name of the project to set up
# branch: The branch to check out
#
# The branch argument should be the desired branch to check out. If
# you have no other opinions, then you should supply ZUUL_BRANCH here
# (or leave it empty which will have the same effect). This is
# generally the branch corresponding with the change being tested.
#
# If you would like to check out a branch other than what ZUUL has
# selected, for example in order to check out the old or new branches
# for grenade, or an alternate branch to test client library
# compatability, then supply that as the argument instead. This
# function will try to check out the following (in order):
#
# The zuul ref for the indicated branch
# The zuul ref for the zuul branch
# The zuul ref for the master branch
# The tip of the indicated branch
# The tip of the master branch
# The basic logic flow is as follows:
# if we have ``branch`` for project, check that out
# if we don't have ``branch`` for project, change ``branch`` to master
# and check that out
# if the global ZUUL_BRANCH matches ``branch``, then also look for a
# valid ZUUL_REF, and use that instead of the HEAD of the branch
#
# The end result is a tree on disk checked out at the right ref for zuul
function setup_project {
local project=$1
local branch=$2
@ -172,8 +158,9 @@ function setup_project {
git_remote_set_url origin https://git.openstack.org/$project
# Try the specified branch before the ZUUL_BRANCH.
OVERRIDE_ZUUL_REF=$(echo $ZUUL_REF | sed -e "s,$ZUUL_BRANCH,$branch,")
if [ -n "$OVERRIDE_ZUUL_BRANCH" ] ; then
OVERRIDE_ZUUL_REF=$(echo $ZUUL_REF | sed -e "s,$branch,$OVERRIDE_ZUUL_BRANCH,")
fi
# Update git remotes
git_remote_update
@ -182,26 +169,29 @@ function setup_project {
# See if this project has this branch, if not, use master
FALLBACK_ZUUL_REF=""
if ! git_has_branch $project $branch; then
branch=master
FALLBACK_ZUUL_REF=$(echo $ZUUL_REF | sed -e "s,$branch,master,")
fi
# See if Zuul prepared a ref for this project
if git_fetch_at_ref $project $OVERRIDE_ZUUL_REF || \
git_fetch_at_ref $project $ZUUL_REF || \
git_fetch_at_ref $project $FALLBACK_ZUUL_REF; then
# See if we should check out a Zuul ref
if [ "$ZUUL_BRANCH" == "$branch" ]; then
# See if Zuul prepared a ref for this project
if git_fetch_at_ref $project $OVERRIDE_ZUUL_REF || \
git_fetch_at_ref $project $ZUUL_REF || \
git_fetch_at_ref $project $FALLBACK_ZUUL_REF; then
# It's there, so check it out.
git_checkout $project FETCH_HEAD
else
if [ "$project" == "$ZUUL_PROJECT" ]; then
echo "Unable to find ref $ZUUL_REF for $project"
exit 1
fi
if git_has_branch $project $branch; then
git_checkout $project $branch
# It's there, so check it out.
git_checkout $project FETCH_HEAD
else
git_checkout $project master
if [ "$project" == "$ZUUL_PROJECT" ]; then
echo "Unable to find ref $ZUUL_REF for $project"
exit 1
fi
git_checkout $project $branch
fi
else
# We're ignoring Zuul refs
git_checkout $project $branch
fi
}

View File

@ -176,7 +176,8 @@ function test_multi_branch_on_stable {
setup_project openstack/glance $ZUUL_BRANCH
setup_project openstack/python-glanceclient $ZUUL_BRANCH
assert_equal "${TEST_GIT_CHECKOUTS[devstack-gate]}" 'refs/zuul/master/ZB' $LINENO
#TODO: This is a test failure indicating a bug
#assert_equal "${TEST_GIT_CHECKOUTS[devstack-gate]}" 'refs/zuul/master/ZB' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'refs/zuul/stable/havana/ZB' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[python-glanceclient]}" 'master' $LINENO
}
@ -210,7 +211,8 @@ function test_grenade_backward {
setup_project openstack/python-glanceclient $GRENADE_OLD_BRANCH
assert_equal "${TEST_GIT_CHECKOUTS[devstack-gate]}" 'refs/zuul/master/ZC' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'refs/zuul/stable/havana/ZC' $LINENO
#TODO: This is a test failure indicating a bug
#assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'refs/zuul/stable/havana/ZC' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[swift]}" 'stable/havana' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[python-glanceclient]}" 'master' $LINENO
@ -255,7 +257,8 @@ function test_grenade_forward {
setup_project openstack/swift $GRENADE_OLD_BRANCH
setup_project openstack/python-glanceclient $GRENADE_OLD_BRANCH
assert_equal "${TEST_GIT_CHECKOUTS[devstack-gate]}" 'refs/zuul/master/ZC' $LINENO
#TODO: This is a test failure indicating a bug
#assert_equal "${TEST_GIT_CHECKOUTS[devstack-gate]}" 'refs/zuul/master/ZC' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'refs/zuul/stable/havana/ZC' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[swift]}" 'stable/havana' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[python-glanceclient]}" 'master' $LINENO
@ -267,8 +270,10 @@ function test_grenade_forward {
setup_project openstack/swift $GRENADE_NEW_BRANCH
setup_project openstack/python-glanceclient $GRENADE_NEW_BRANCH
assert_equal "${TEST_GIT_CHECKOUTS[devstack-gate]}" 'refs/zuul/master/ZC' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'refs/zuul/master/ZC' $LINENO
#TODO: This is a test failure indicating a bug
#assert_equal "${TEST_GIT_CHECKOUTS[devstack-gate]}" 'refs/zuul/master/ZC' $LINENO
#TODO: This is a test failure indicating a bug
#assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'refs/zuul/master/ZC' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[swift]}" 'master' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[python-glanceclient]}" 'master' $LINENO
}
@ -283,37 +288,25 @@ function test_branch_override {
declare -A TEST_GIT_CHECKOUTS
declare -A TEST_ZUUL_REFS
ZUUL_PROJECT='openstack-infra/devstack-gate'
ZUUL_BRANCH='master'
ZUUL_BRANCH='stable/havana' # branch override
ZUUL_REF='refs/zuul/master/ZB'
OVERRIDE_ZUUL_BRANCH='stable/havana'
TEST_ZUUL_REFS[devstack-gate]+=' refs/zuul/master/ZB'
TEST_ZUUL_REFS[glance]+=' refs/zuul/stable/havana/ZA'
TEST_ZUUL_REFS[glance]+=' refs/zuul/stable/havana/ZB'
setup_project openstack-infra/devstack-gate $OVERRIDE_ZUUL_BRANCH
setup_project openstack/glance $OVERRIDE_ZUUL_BRANCH
setup_project openstack/swift $OVERRIDE_ZUUL_BRANCH
setup_project openstack/python-glanceclient $OVERRIDE_ZUUL_BRANCH
setup_project openstack-infra/devstack-gate $ZUUL_BRANCH
setup_project openstack/glance $ZUUL_BRANCH
setup_project openstack/swift $ZUUL_BRANCH
setup_project openstack/python-glanceclient $ZUUL_BRANCH
assert_equal "${TEST_GIT_CHECKOUTS[devstack-gate]}" 'refs/zuul/master/ZB' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'refs/zuul/stable/havana/ZB' $LINENO
#TODO: This is a test failure indicating a bug
#assert_equal "${TEST_GIT_CHECKOUTS[devstack-gate]}" 'refs/zuul/master/ZB' $LINENO
#TODO: This is a test failure indicating a bug
#assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'refs/zuul/stable/havana/ZB' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[swift]}" 'stable/havana' $LINENO
assert_equal "${TEST_GIT_CHECKOUTS[python-glanceclient]}" 'master' $LINENO
}
function test_periodic {
# No queue
echo "== Test periodic"
declare -A TEST_GIT_CHECKOUTS
declare -A TEST_ZUUL_REFS
ZUUL_BRANCH='stable/havana'
setup_project openstack/glance $ZUUL_BRANCH
assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'stable/havana' $LINENO
}
# Run tests:
#set -o xtrace
test_two_on_master
@ -323,4 +316,3 @@ test_multi_branch_on_stable
test_grenade_backward
test_grenade_forward
test_branch_override
test_periodic