Make sure the d-g hooks end up in reproduce.sh

Currently we don't have any handling for devstack-gate hooks in the
reproduce.sh script so jobs that rely on them don't generate accurate
reproduce.sh scripts. Fix this by explicitly adding each of the three
hooks to the reproduce.sh script if they are defined.

Change-Id: Iae6191dfc2dab81e7ca172762728ede2946f5f62
This commit is contained in:
Clark Boylan 2016-10-07 14:09:40 -07:00
parent 8e6edce98d
commit 4b70a09636
2 changed files with 15 additions and 0 deletions

View File

@ -203,6 +203,11 @@ EOF
if [ -n "$JOB_PROJECTS" ] ; then
echo "declare -x PROJECTS=\"$JOB_PROJECTS\"" >> $WORKSPACE/logs/reproduce.sh
fi
for fun in pre_test_hook gate_hook post_test_hook ; do
if function_exists $fun ; then
declare -fp $fun >> $WORKSPACE/logs/reproduce.sh
fi
done
cat >> $WORKSPACE/logs/reproduce.sh <<EOF

View File

@ -525,6 +525,11 @@ declare -x ZUUL_VAR_MULTILINE="zuul-var-setting1
zuul-var-setting2"
declare -x DEVSTACK_VAR_MULTILINE="devstack-var-setting1
devstack-var-setting2"
gate_hook ()
{
echo "The cake is a lie"
}
declare -fx gate_hook
EOF
# prepare environment for test
@ -535,6 +540,10 @@ devstack-var-setting2"
export ZUUL_VAR=zuul-var
export ZUUL_VAR_MULTILINE="zuul-var-setting1
zuul-var-setting2"
function gate_hook {
echo "The cake is a lie"
}
export -f gate_hook
JOB_NAME=test-job
mkdir $WORKSPACE/logs
@ -558,6 +567,7 @@ zuul-var-setting2"
unset ZUUL_VAR
unset ZUUL_VAR_MULTILINE
unset JOB_NAME
unset gate_hook
}
# Run tests: