From 45bab4b6acf94475b4b1007fbc27f20fc2ebc792 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Thu, 1 Feb 2018 10:45:59 +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. Depends-On: I7ebb045885dd645b820de2b7f75b46c755c015f6 Change-Id: I7069c906395b37e8af20db82d88d8a069faf5f79 Related-Bug: #1741471 --- tests/test-install-previous-swift.yml | 3 +++ tests/test-swift-upgrades.sh | 22 +++++++++++++++++++--- tests/test-upgrade.yml | 6 ------ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/test-install-previous-swift.yml b/tests/test-install-previous-swift.yml index 97dc44e6..534a87f2 100644 --- a/tests/test-install-previous-swift.yml +++ b/tests/test-install-previous-swift.yml @@ -13,6 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Ensure the repo is setup for previous version +- include: common/previous/test-repo-setup.yml + - name: Playbook for deploying swift hosts: "{{ swift_groups | default('swift_all:swift_remote_all') }}" user: root diff --git a/tests/test-swift-upgrades.sh b/tests/test-swift-upgrades.sh index ea817a19..273613ff 100755 --- a/tests/test-swift-upgrades.sh +++ b/tests/test-swift-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,28 @@ 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 Swift +# Prepare environment for the initial deploy of (previous and current) Swift # No upgrading or testing is done yet. export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-swift-install.log" -# Execute the setup of Stable/Newton Neutron +# 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-swift.yml" +export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-previous_swift-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 Neutron +execute_ansible_playbook + +# Unset previous branch overrides +unset PREVIOUS_VENV +unset ANSIBLE_BIN + # Prepare environment for the upgrade of Swift export TEST_PLAYBOOK="${WORKING_DIR}/tests/benchmark-upgrade.yml" export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-swift-upgrade.log" diff --git a/tests/test-upgrade.yml b/tests/test-upgrade.yml index b193a586..ae0fabf2 100644 --- a/tests/test-upgrade.yml +++ b/tests/test-upgrade.yml @@ -24,9 +24,3 @@ # Setup Swift-hosts - include: common/test-setup-swifthosts.yml - -# Ensure the repo is setup for previous version -- include: common/previous/test-repo-setup.yml - -# Install previous swift -- include: test-install-previous-swift.yml