Fix the setup_workspace to handle missing ZUUL_BRANCH
This commit adds logic to the setup_workspace function to be able to handle the case where the var ZUUL_BRANCH isn't set. This is what apparently happens during periodic jobs and causes those to fail. If ZUUL_BRANCH isn't set we just use the fallback zuul ref which is what the expected behavior would be if the function didn't explode. Change-Id: I77b98b8a8d8602da0092a5250cc0ce49de9215db
This commit is contained in:
parent
b28eef644e
commit
52c97ccb8c
|
@ -345,7 +345,12 @@ function setup_project {
|
|||
fi
|
||||
|
||||
# Try the specified branch before the ZUUL_BRANCH.
|
||||
OVERRIDE_ZUUL_REF=$(echo $ZUUL_REF | sed -e "s,$ZUUL_BRANCH,$branch,")
|
||||
if [[ ! -z $ZUUL_BRANCH ]]; then
|
||||
OVERRIDE_ZUUL_REF=$(echo $ZUUL_REF | sed -e "s,$ZUUL_BRANCH,$branch,")
|
||||
else
|
||||
OVERRIDE_ZUUL_REF=""
|
||||
fi
|
||||
|
||||
|
||||
# Update git remotes
|
||||
git_remote_update
|
||||
|
|
|
@ -398,6 +398,19 @@ function test_periodic {
|
|||
assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'stable/havana'
|
||||
}
|
||||
|
||||
# Run setup_project without setting a ZUUL_BRANCH which is how a subset of
|
||||
# periodic jobs operate
|
||||
function test_periodic_no_branch {
|
||||
|
||||
declare -A TEST_GIT_CHECKOUTS
|
||||
declare -A TEST_ZUUL_REF
|
||||
local ZUUL_PROJECT='openstack/glance'
|
||||
|
||||
setup_project openstack/glance 'master'
|
||||
|
||||
assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'master'
|
||||
}
|
||||
|
||||
# setup_workspace fails without argument
|
||||
function test_workspace_branch_arg {
|
||||
assert_raises setup_workspace
|
||||
|
@ -466,6 +479,7 @@ test_multi_branch_on_stable
|
|||
test_multi_branch_project_override
|
||||
test_one_on_master
|
||||
test_periodic
|
||||
test_periodic_no_branch
|
||||
test_two_on_master
|
||||
test_workspace_branch_arg
|
||||
test_call_hook_if_defined
|
||||
|
|
Loading…
Reference in New Issue