From e4456ed4c1f7e3506e4698e17dc94b4778517bf9 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Mon, 22 Jan 2018 14:11:21 +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. Related-Bug: #1741471 Depends-On: I7ebb045885dd645b820de2b7f75b46c755c015f6 Change-Id: I7bc4dd644c48b403e9e669cb0ea460d9d1149410 --- tests/test-galera-upgrades.sh | 21 +++++++++++++++++++-- tests/test-install-previous-galera.yml | 25 +++++++++++++++++++++++++ tests/test-upgrade-pre.yml | 11 ----------- 3 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 tests/test-install-previous-galera.yml diff --git a/tests/test-galera-upgrades.sh b/tests/test-galera-upgrades.sh index c68a5ef1..79e53de6 100755 --- a/tests/test-galera-upgrades.sh +++ b/tests/test-galera-upgrades.sh @@ -49,7 +49,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:" @@ -72,7 +73,7 @@ source "${COMMON_TESTS_PATH}/test-ansible-env-prep.sh" # Set gate job exit traps, this is run regardless of exit state when the job finishes. trap gate_job_exit_tasks EXIT -# Prepare environment for the initial deploy of previous version +# Prepare environment for the initial deploy of (previous and current) Galera # No upgrading or testing is done yet. export TEST_PLAYBOOK="${WORKING_DIR}/tests/test-upgrade-pre.yml" export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-install.log" @@ -80,6 +81,22 @@ export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-install.log" # Execute the setup of previous version execute_ansible_playbook +# Create an ansible venv matching previous branch +source ${WORKING_DIR}/tests/common/test-create-previous-venv.sh + +# Prepare environment for the deploy of previous Galera: +# No upgrading or testing is done yet. +export TEST_PLAYBOOK="${WORKING_DIR}/tests/test-install-previous-galera.yml" +export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-previous_galera-install.log" +export PREVIOUS_VENV="ansible-previous" +export ANSIBLE_BIN="${WORKING_DIR}/.tox/${PREVIOUS_VENV}/bin/ansible-playbook" + +# Execute the setup of previous Keystone +execute_ansible_playbook +# Unset previous branch overrides +unset PREVIOUS_VENV +unset ANSIBLE_BIN + # Prepare environment for the upgrade export TEST_PLAYBOOK="${WORKING_DIR}/tests/test-upgrade-post.yml" export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-upgrade.log" diff --git a/tests/test-install-previous-galera.yml b/tests/test-install-previous-galera.yml new file mode 100644 index 00000000..80e7d1ad --- /dev/null +++ b/tests/test-install-previous-galera.yml @@ -0,0 +1,25 @@ +--- +# Copyright 2018, SUSE LINUX GmbH. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Install previous version +- name: Deploy previous galera version + hosts: galera_all + user: root + serial: 1 + gather_facts: true + roles: + - role: "previous_galera_server" + vars_files: + - common/previous/test-vars.yml diff --git a/tests/test-upgrade-pre.yml b/tests/test-upgrade-pre.yml index ca11b7e6..6db6808c 100644 --- a/tests/test-upgrade-pre.yml +++ b/tests/test-upgrade-pre.yml @@ -18,14 +18,3 @@ # Prepare the containers - include: common/test-prepare-containers.yml - -# Install previous version -- name: Deploy previous galera version - hosts: galera_all - user: root - serial: 1 - gather_facts: true - roles: - - role: "previous_galera_server" - vars_files: - - common/previous/test-vars.yml