From 113aa975b18172a57ad60e519651d9c209e8639f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Thu, 1 Feb 2018 09:50:37 +0000 Subject: [PATCH] Use a venv with previous ansible version for upgrades When doing the role upgrade, we run every playbook with current's branch ansible. This is normal for the infrastructure bits (which are running on current branch), but not for the installation of the previous branch's role, which should use previous branch's environment. Change-Id: I88e2616db193487905e1e1552695ec4847bcb4f9 Depends-On: I7ebb045885dd645b820de2b7f75b46c755c015f6 Related-Bug: #1741471 --- tests/test-install-previous-nova.yml | 3 +++ tests/test-nova-upgrades.sh | 21 +++++++++++++++++++-- tests/test-upgrade.yml | 6 ------ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/test-install-previous-nova.yml b/tests/test-install-previous-nova.yml index 4fc67c2d..efa1b6c4 100644 --- a/tests/test-install-previous-nova.yml +++ b/tests/test-install-previous-nova.yml @@ -15,6 +15,9 @@ - include: common/previous/setting-nodepool-variables.yml +# Ensure the repo is setup for previous version +- include: common/previous/test-repo-setup.yml + - name: Prepare for nova services hosts: nova_all user: root diff --git a/tests/test-nova-upgrades.sh b/tests/test-nova-upgrades.sh index 586ee067..b10ce485 100755 --- a/tests/test-nova-upgrades.sh +++ b/tests/test-nova-upgrades.sh @@ -55,7 +55,8 @@ echo "TEST_IDEMPOTENCE: ${TEST_IDEMPOTENCE}" function execute_ansible_playbook { export ANSIBLE_CLI_PARAMETERS="${ANSIBLE_PARAMETERS} -e @${ANSIBLE_OVERRIDES}" - CMD_TO_EXECUTE="ansible-playbook ${TEST_PLAYBOOK} $@ ${ANSIBLE_CLI_PARAMETERS}" + export ANSIBLE_BIN=${ANSIBLE_BIN:-"ansible-playbook"} + CMD_TO_EXECUTE="${ANSIBLE_BIN} ${TEST_PLAYBOOK} $@ ${ANSIBLE_CLI_PARAMETERS}" echo "Executing: ${CMD_TO_EXECUTE}" echo "With:" @@ -71,13 +72,29 @@ function execute_ansible_playbook { # Ensure that the Ansible environment is properly prepared source "${COMMON_TESTS_PATH}/test-ansible-env-prep.sh" -# Prepare environment for the initial deploy of previous Nova +# Prepare environment for the initial deploy of (previous and current) Nova # No upgrading or testing is done yet. export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-nova-install.log" +# Execute the setup of current infrastructure +execute_ansible_playbook + + +# Prepare environment for the deploy of previous Nova: +# No upgrading or testing is done yet. +export TEST_PLAYBOOK="${WORKING_DIR}/tests/test-install-previous-nova.yml" +export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-previous_nova-install.log" +export PREVIOUS_VENV="ansible-previous" +export ANSIBLE_BIN="${WORKING_DIR}/.tox/${PREVIOUS_VENV}/bin/ansible-playbook" +source ${COMMON_TESTS_PATH}/test-create-previous-venv.sh + # Execute the setup of previous Nova execute_ansible_playbook +# Unset previous branch overrides +unset PREVIOUS_VENV +unset ANSIBLE_BIN + # Prepare environment for the upgrade of Nova export TEST_PLAYBOOK="${WORKING_DIR}/tests/benchmark-upgrade.yml" export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-nova-upgrade.log" diff --git a/tests/test-upgrade.yml b/tests/test-upgrade.yml index 6e90336c..6bc2d39c 100644 --- a/tests/test-upgrade.yml +++ b/tests/test-upgrade.yml @@ -27,9 +27,3 @@ # Install Neutron - include: common/test-install-neutron.yml - -# Ensure the repo is setup for previous version -- include: common/previous/test-repo-setup.yml - -# Install previous Nova -- include: test-install-previous-nova.yml