Merge "Install ARA with zuul-cloner if we're running inside the ARA gate"

This commit is contained in:
Jenkins 2017-02-20 14:45:03 +00:00 committed by Gerrit Code Review
commit 70aef2d772
3 changed files with 24 additions and 12 deletions

View File

@ -13,6 +13,3 @@ git+git://github.com/ansible/ansible.git@e85f3f44610fa454c80da6b0f5ae84e3887a695
# The Ansible lint version used for lint tests
ansible-lint==3.4.1
# ARA for reporting
ara

View File

@ -95,15 +95,6 @@ else
echo "Skipping the role link because no role name was provided."
fi
# Link the ARA Callback directory to the the ansible callback directory
if [ -d "${WORKING_DIR}/.tox/functional/lib/python2.7/site-packages/ara/plugins/callbacks" ]; then
if [ ! -L "${ANSIBLE_PLUGIN_DIR}/callback/ara" ]; then
echo "Linking ${ANSIBLE_PLUGIN_DIR}/callback/ara to ${WORKING_DIR}/.tox/functional/lib/python2.7/site-packages/ara/plugins/callbacks/"
mkdir -p "${ANSIBLE_PLUGIN_DIR}/callback/ara"
ln -sf "${WORKING_DIR}/.tox/functional/lib/python2.7/site-packages/ara/plugins/callbacks" "${ANSIBLE_PLUGIN_DIR}/callback/ara/"
fi
fi
# Ensure that the Ansible configuration file is in the right place
if [ ! -f "${ANSIBLE_CFG_PATH}" ]; then
if [ -f "${COMMON_TESTS_PATH}/test-ansible.cfg" ]; then

View File

@ -60,6 +60,29 @@ function set_ansible_parameters {
}
function setup_ara {
# Don't do anything if ARA has already been set up
[[ -L "${ANSIBLE_PLUGIN_DIR}/callback/ara" ]] && return 0
# Install ARA from source if running in ARA gate, otherwise install from PyPi
if [[ -e /usr/zuul-env/bin/zuul-cloner && "${ZUUL_PROJECT}" == "openstack/ara" ]]; then
/usr/zuul-env/bin/zuul-cloner --workspace /tmp --cache-dir /opt/git \
git://git.openstack.org openstack/ara
${WORKING_DIR}/.tox/functional/bin/pip install /tmp/openstack/ara
else
${WORKING_DIR}/.tox/functional/bin/pip install ara
fi
# Dynamically figure out the location of ARA (ex: py2 vs py3)
ara_location=$(${WORKING_DIR}/.tox/functional/bin/python -c "import os,ara; print(os.path.dirname(ara.__file__))")
echo "Linking ${ANSIBLE_PLUGIN_DIR}/callback/ara to ${ara_location}/plugins/callbacks/"
mkdir -p "${ANSIBLE_PLUGIN_DIR}/callback/ara"
ln -sf "${ara_location}/plugins/callbacks" "${ANSIBLE_PLUGIN_DIR}/callback/ara/"
}
function execute_ansible_playbook {
CMD_TO_EXECUTE="ansible-playbook ${TEST_PLAYBOOK} $@ ${ANSIBLE_CLI_PARAMETERS}"
@ -80,6 +103,7 @@ function gate_job_exit_tasks {
# Ensure that the Ansible environment is properly prepared
source "${COMMON_TESTS_PATH}/test-ansible-env-prep.sh"
setup_ara
# Set gate job exit traps, this is run regardless of exit state when the job finishes.
trap gate_job_exit_tasks EXIT