Only create clonemap when zuul-cloner is used
In test environments outside of OpenStack-CI, it is preferred that a file is not created and deleted in the user home directory, especially if it is not used. Change-Id: I5da7802d61d2ab6b03908138e3a3ed2db22e3d29
This commit is contained in:
parent
327d134632
commit
0a793ac13a
@ -34,28 +34,39 @@ export TESTING_HOME=${TESTING_HOME:-$HOME}
|
||||
export WORKING_DIR=${WORKING_DIR:-$(pwd)}
|
||||
export CLONE_UPGRADE_TESTS=${CLONE_UPGRADE_TESTS:-no}
|
||||
|
||||
## Main ----------------------------------------------------------------------
|
||||
## Functions -----------------------------------------------------------------
|
||||
|
||||
function create_tests_clonemap {
|
||||
|
||||
# Prepare the clonemap for zuul-cloner to use
|
||||
# This is placed here instead of inside the conditional
|
||||
# to prevent indentation problems.
|
||||
cat > ${TESTING_HOME}/tests-clonemap.yaml << EOF
|
||||
clonemap:
|
||||
- name: openstack/openstack-ansible-tests
|
||||
dest: ${WORKING_DIR}/tests/common
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
## Main ----------------------------------------------------------------------
|
||||
|
||||
# If zuul-cloner is present, use it so that we
|
||||
# also include any dependent patches from the
|
||||
# tests repo noted in the commit message.
|
||||
if [[ -x /usr/zuul-env/bin/zuul-cloner ]]; then
|
||||
|
||||
# Prepare the clonemap for zuul-cloner to use
|
||||
create_tests_clonemap
|
||||
|
||||
# Execute the clone
|
||||
/usr/zuul-env/bin/zuul-cloner \
|
||||
--cache-dir /opt/git \
|
||||
--map ${TESTING_HOME}/tests-clonemap.yaml \
|
||||
git://git.openstack.org \
|
||||
openstack/openstack-ansible-tests
|
||||
|
||||
# Clean up the clonemap.
|
||||
rm -f ${TESTING_HOME}/tests-clonemap.yaml
|
||||
|
||||
# Alternatively, use a simple git-clone. We do
|
||||
# not re-clone if the directory exists already
|
||||
# to prevent overwriting any local changes which
|
||||
@ -73,9 +84,6 @@ elif [[ ! -d tests/common ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Clean up the clonemap.
|
||||
rm -f ${TESTING_HOME}/tests-clonemap.yaml
|
||||
|
||||
# If this test set includes an upgrade test, the
|
||||
# previous stable release tests repo must also be
|
||||
# cloned.
|
||||
|
Loading…
x
Reference in New Issue
Block a user