Fix workspace setup
Stable branch overrides for client testing, devstack-gate alternate-branch testing, and grenade old/new branch selection are all actually the same thing. Update setup_project to reflect that, fixing all known bugs in the process. Note that some jobs will need to be updated to pass in OVERRIDE_ZUUL_BRANCH. Change-Id: I6613715439bed9914b8444e335fac5eab4d14075
This commit is contained in:
parent
b3d93e5995
commit
4d2f0e7c85
|
@ -204,6 +204,10 @@ 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 {
|
||||
|
@ -224,7 +228,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 $ZUUL_BRANCH $BASE/new &> \
|
||||
setup_workspace $OVERRIDE_ZUUL_BRANCH $BASE/new &> \
|
||||
$WORKSPACE/logs/devstack-gate-setup-workspace-new.txt
|
||||
fi
|
||||
|
||||
|
|
68
functions.sh
68
functions.sh
|
@ -138,16 +138,30 @@ function fix_disk_layout {
|
|||
fi
|
||||
}
|
||||
|
||||
# do all the zuulification magic for project at a specified branch
|
||||
# Set up a project in accordance with the future state proposed by
|
||||
# Zuul.
|
||||
#
|
||||
# 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
|
||||
# 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 end result is a tree on disk checked out at the right ref for zuul
|
||||
function setup_project {
|
||||
local project=$1
|
||||
local branch=$2
|
||||
|
@ -158,9 +172,8 @@ function setup_project {
|
|||
|
||||
git_remote_set_url origin https://git.openstack.org/$project
|
||||
|
||||
if [ -n "$OVERRIDE_ZUUL_BRANCH" ] ; then
|
||||
OVERRIDE_ZUUL_REF=$(echo $ZUUL_REF | sed -e "s,$branch,$OVERRIDE_ZUUL_BRANCH,")
|
||||
fi
|
||||
# Try the specified branch before the ZUUL_BRANCH.
|
||||
OVERRIDE_ZUUL_REF=$(echo $ZUUL_REF | sed -e "s,$ZUUL_BRANCH,$branch,")
|
||||
|
||||
# Update git remotes
|
||||
git_remote_update
|
||||
|
@ -169,29 +182,26 @@ 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 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
|
||||
# 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
|
||||
git_checkout $project $branch
|
||||
fi
|
||||
# It's there, so check it out.
|
||||
git_checkout $project FETCH_HEAD
|
||||
else
|
||||
# We're ignoring Zuul refs
|
||||
git_checkout $project $branch
|
||||
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
|
||||
else
|
||||
git_checkout $project master
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -176,8 +176,7 @@ function test_multi_branch_on_stable {
|
|||
setup_project openstack/glance $ZUUL_BRANCH
|
||||
setup_project openstack/python-glanceclient $ZUUL_BRANCH
|
||||
|
||||
#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[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
|
||||
}
|
||||
|
@ -211,8 +210,7 @@ function test_grenade_backward {
|
|||
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[glance]}" 'refs/zuul/stable/havana/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
|
||||
|
||||
|
@ -257,8 +255,7 @@ function test_grenade_forward {
|
|||
setup_project openstack/swift $GRENADE_OLD_BRANCH
|
||||
setup_project openstack/python-glanceclient $GRENADE_OLD_BRANCH
|
||||
|
||||
#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[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
|
||||
|
@ -270,10 +267,8 @@ function test_grenade_forward {
|
|||
setup_project openstack/swift $GRENADE_NEW_BRANCH
|
||||
setup_project openstack/python-glanceclient $GRENADE_NEW_BRANCH
|
||||
|
||||
#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[devstack-gate]}" 'refs/zuul/master/ZC' $LINENO
|
||||
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
|
||||
}
|
||||
|
@ -288,25 +283,37 @@ function test_branch_override {
|
|||
declare -A TEST_GIT_CHECKOUTS
|
||||
declare -A TEST_ZUUL_REFS
|
||||
ZUUL_PROJECT='openstack-infra/devstack-gate'
|
||||
ZUUL_BRANCH='stable/havana' # branch override
|
||||
ZUUL_BRANCH='master'
|
||||
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 $ZUUL_BRANCH
|
||||
setup_project openstack/glance $ZUUL_BRANCH
|
||||
setup_project openstack/swift $ZUUL_BRANCH
|
||||
setup_project openstack/python-glanceclient $ZUUL_BRANCH
|
||||
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
|
||||
|
||||
#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[devstack-gate]}" 'refs/zuul/master/ZB' $LINENO
|
||||
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
|
||||
|
@ -316,3 +323,4 @@ test_multi_branch_on_stable
|
|||
test_grenade_backward
|
||||
test_grenade_forward
|
||||
test_branch_override
|
||||
test_periodic
|
||||
|
|
Loading…
Reference in New Issue