From 9f56dc611a5235c87a5d809228b7a840c086edb3 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 7 Apr 2023 13:09:41 +0200 Subject: [PATCH] Add Yoga upgrade jobs This patch aims to implement testing of SLURP upgrades. While 2023.1 is the first SLURP release, upgrade from Yoga to 2023.1 is considered as unofficial SLURP upgrade. With that we're adding changes to gate-check-commit to be able to provide source release from which upgrade will be perfromed. While running upgrade script user is required to provide source release as input to script for SLURP releases. Also regular upgrades are now switched to Zed as they supposed to be. Change-Id: I64e55b2c685782d23bb84e7e9f7c60708c276cc3 --- scripts/gate-check-commit.sh | 20 ++++++++------- scripts/run-upgrade.sh | 44 ++++++++++++++++++++++++-------- zuul.d/jobs.yaml | 18 +++++++++++++ zuul.d/playbooks/pre-osa-aio.yml | 4 +-- zuul.d/project-templates.yaml | 3 +++ 5 files changed, 67 insertions(+), 22 deletions(-) diff --git a/scripts/gate-check-commit.sh b/scripts/gate-check-commit.sh index f457a1ffd0..49df25ea8f 100755 --- a/scripts/gate-check-commit.sh +++ b/scripts/gate-check-commit.sh @@ -46,11 +46,6 @@ export ACTION=${2:-"deploy"} # Set the installation method for the OpenStack services export INSTALL_METHOD=${3:-"source"} -# Set the source branch for upgrade tests -# Be sure to change this whenever a new stable branch -# is created. The checkout must always be N-1. -export UPGRADE_SOURCE_BRANCH=${UPGRADE_SOURCE_BRANCH:-'stable/yoga'} - # enable the ARA callback plugin export SETUP_ARA=${SETUP_ARA:-true} @@ -60,7 +55,14 @@ export SETUP_ARA=${SETUP_ARA:-true} # deployment. # This needs to be done before the first "source" to ensure # the correct functions are used for the branch. -if [[ "${ACTION}" == "upgrade" ]]; then +if [[ "${ACTION}" =~ "upgrade" ]]; then + # Set the source branch for upgrade tests + # Be sure to change this whenever a new stable branch + # is created. + UPGRADE_ACTION_ARRAY=(${ACTION//_/ }) + export UPGRADE_SOURCE_RELEASE=${UPGRADE_ACTION_ARRAY[1]:-'zed'} + export UPGRADE_SOURCE_BRANCH=${UPGRADE_SOURCE_BRANCH:-stable/$UPGRADE_SOURCE_RELEASE} + # Store the target SHA/branch export UPGRADE_TARGET_BRANCH=$(git rev-parse HEAD) export OPENSTACK_SETUP_EXTRA_ARGS="-e tempest_install=no -e tempest_run=no -e rally_install=no" @@ -214,7 +216,7 @@ else # Log some data about the instance and the rest of the system log_instance_info - if [[ $SCENARIO =~ "infra" && $ACTION != "upgrade" ]]; then + if [[ $SCENARIO =~ "infra" && ! $ACTION =~ "upgrade" ]]; then # Verify our infra setup and do not continue with openstack part openstack-ansible healthcheck-infrastructure.yml -e osa_gather_facts=False fi @@ -231,7 +233,7 @@ fi # If the action is to upgrade, then checkout the original SHA for # the checkout, and execute the upgrade. -if [[ "${ACTION}" == "upgrade" ]]; then +if [[ "${ACTION}" =~ "upgrade" ]]; then # Checkout the original HEAD we started with git checkout ${UPGRADE_TARGET_BRANCH} @@ -263,7 +265,7 @@ if [[ "${ACTION}" == "upgrade" ]]; then # To execute the upgrade script we need to provide # an affirmative response to the warning that the # upgrade is irreversable. - echo 'YES' | bash "${OSA_CLONE_DIR}/scripts/run-upgrade.sh" + echo 'YES' | SOURCE_SERIES=${UPGRADE_SOURCE_RELEASE} bash "${OSA_CLONE_DIR}/scripts/run-upgrade.sh" if [[ $SCENARIO =~ "infra" ]]; then # TODO(noonedeadpunk): Remove after Y release diff --git a/scripts/run-upgrade.sh b/scripts/run-upgrade.sh index dee0fd42c9..77aead91b7 100755 --- a/scripts/run-upgrade.sh +++ b/scripts/run-upgrade.sh @@ -30,8 +30,8 @@ export SCRIPTS_PATH="$(dirname "$(readlink -f "${0}")")" # The git checkout root path export MAIN_PATH="$(dirname "${SCRIPTS_PATH}")" -# The expected source series name -export SOURCE_SERIES="zed" +# The expected source series names +export SUPPORTED_SOURCE_SERIES=("yoga" "zed") # The expected target series name export TARGET_SERIES="2023.1" @@ -123,20 +123,17 @@ function pre_flight { # Notify the user. echo -e " - This script will perform a ${SOURCE_SERIES^} to ${TARGET_SERIES^} upgrade. + This script will perform an upgrade from ${SOURCE_SERIES^} + to ${TARGET_SERIES^}. + Once you start the upgrade there is no going back. Note that the upgrade targets impacting the data plane as little as possible, but assumes that the control plane can experience some down time. - This script executes a one-size-fits-all upgrade, - and given that the tests implemented for it are - not monitored as well as those for a greenfield - environment, the results may vary with each release. - Please use it against a test environment with your - configurations to validate whether it suits your + configurations first to validate whether it suits your needs and does a suitable upgrade. Are you ready to perform this upgrade now? @@ -151,9 +148,32 @@ function pre_flight { fi } +function set_source_series { + + if [ ${#SUPPORTED_SOURCE_SERIES[@]} -gt 1 ]; then + echo -e " + Upgrade to ${TARGET_SERIES^} is supported only from one of the following releases: + " + for release_id in ${!SUPPORTED_SOURCE_SERIES[@]}; do + option_id=${release_id} + echo -e " $((++option_id)): ${SUPPORTED_SOURCE_SERIES[$release_id]^}" + done + echo -e "" + read -p ' Please specify the release to upgrade from [1]: ' SELECTED_OPTION + SOURCE_OPTION=${SELECTED_OPTION:-1} + export SOURCE_SERIES=${SUPPORTED_SOURCE_SERIES[$((--SOURCE_OPTION))]} + + else + export SOURCE_SERIES=${SUPPORTED_SOURCE_SERIES[0]} + fi +} + ## Main ---------------------------------------------------------------------- function main { + if [ -z "${SOURCE_SERIES+defined}" ]; then + set_source_series + fi pre_flight check_for_current create_working_dir @@ -175,8 +195,10 @@ function main { pushd ${MAIN_PATH}/playbooks RUN_TASKS+=("${SCRIPTS_PATH}/upgrade-utilities/deploy-config-changes.yml") - RUN_TASKS+=("${SCRIPTS_PATH}/upgrade-utilities/define-neutron-plugin.yml") - RUN_TASKS+=("certificate-ssh-authority.yml") + if [[ "${SOURCE_SERIES}" == "yoga" ]]; then + RUN_TASKS+=("${SCRIPTS_PATH}/upgrade-utilities/define-neutron-plugin.yml") + RUN_TASKS+=("certificate-ssh-authority.yml") + fi # we don't want to trigger container restarts for galera and rabbit # but as there will be no hosts available for metal deployments, # as a fallback option we just run setup-hosts.yml without any arguments diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index e7736ed2f1..aca2aa716f 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -521,18 +521,36 @@ nodeset: ubuntu-focal timeout: 10800 +- job: + name: openstack-ansible-upgrade_yoga-aio_metal-ubuntu-focal + parent: openstack-ansible-deploy-aio + nodeset: ubuntu-focal + timeout: 10800 + - job: name: openstack-ansible-upgrade-aio_lxc-ubuntu-focal parent: openstack-ansible-deploy-aio nodeset: ubuntu-focal timeout: 10800 +- job: + name: openstack-ansible-upgrade_yoga-aio_lxc-ubuntu-focal + parent: openstack-ansible-deploy-aio + nodeset: ubuntu-focal + timeout: 10800 + - job: name: openstack-ansible-upgrade-infra_lxc-ubuntu-focal parent: openstack-ansible-deploy-aio-infra nodeset: ubuntu-focal timeout: 10800 +- job: + name: openstack-ansible-upgrade_yoga-infra_lxc-ubuntu-focal + parent: openstack-ansible-deploy-aio-infra + nodeset: ubuntu-focal + timeout: 10800 + - job: name: openstack-ansible-deploy-infra_lxc-ubuntu-focal parent: openstack-ansible-deploy-aio-infra diff --git a/zuul.d/playbooks/pre-osa-aio.yml b/zuul.d/playbooks/pre-osa-aio.yml index eb62f91de6..965325d1b3 100644 --- a/zuul.d/playbooks/pre-osa-aio.yml +++ b/zuul.d/playbooks/pre-osa-aio.yml @@ -40,7 +40,7 @@ ZUUL_SRC_PATH: "{{ (action != 'shastest') | ternary(_zuul_src_path, '') }}" ANSIBLE_PACKAGE: "{{ ansible_package | default('') }}" SETUP_ARA: 'true' - when: action != 'upgrade' + when: "'upgrade' not in action" - name: Run bootstrap-aio script become: yes become_user: root @@ -56,6 +56,6 @@ ACTION: "{{ action }}" INSTALL_METHOD: "{{ install_method }}" when: - - action != 'upgrade' + - "'upgrade' not in action" - action != 'linters' - action != 'shastest' diff --git a/zuul.d/project-templates.yaml b/zuul.d/project-templates.yaml index e93ac1b2a0..d251968557 100644 --- a/zuul.d/project-templates.yaml +++ b/zuul.d/project-templates.yaml @@ -65,6 +65,7 @@ jobs: - openstack-ansible-upgrade-infra_lxc-rockylinux-9 - openstack-ansible-upgrade-infra_lxc-ubuntu-focal + - openstack-ansible-upgrade_yoga-infra_lxc-ubuntu-focal gate: jobs: - openstack-ansible-upgrade-infra_lxc-rockylinux-9 @@ -76,6 +77,7 @@ jobs: - openstack-ansible-upgrade-aio_metal-rockylinux-9 - openstack-ansible-upgrade-aio_metal-ubuntu-focal + - openstack-ansible-upgrade_yoga-aio_metal-ubuntu-focal gate: jobs: - openstack-ansible-upgrade-aio_metal-rockylinux-9 @@ -166,6 +168,7 @@ - openstack-ansible-deploy-aio_metal-ubuntu-jammy - openstack-ansible-upgrade-aio_metal-rockylinux-9 - openstack-ansible-upgrade-aio_metal-ubuntu-focal + - openstack-ansible-upgrade_yoga-aio_metal-ubuntu-focal gate: jobs: - openstack-ansible-deploy-aio_metal-debian-bullseye