Files
kolla-ansible/tests/upgrade.sh
Michal Arbet 41267c041d [CI] Fix bootstrap testing
This patch adjusts the CI in such a way that we
can finally test the correctness of bootstrap-servers.

 - It correctly installs the virtualenv at the beginning
 - It sets ansible_python_interpreter to this virtualenv
 - It runs bootstrap-servers between upgrades
 - It moves package installation from the CI playbook
   to ansible-collections-kolla

To summarize: this patch aligns behavior and tests the code
within the boundaries it should be tested in - that is, inside
a virtualenv. This naturally also tests the correctness of
ansible-collection-kolla, which installs packages and other
dependencies (now not mixed with OS py interpreter).
This is important, especially due to a bug in older versions
of Docker and requests, which required running bootstrap-servers.
Proof of this is that the rocky9-octavia job is finally working,
with no more issues with package cryptography (which was read from OS
python environment by ansible).

TL;DR: From now on, it runs correctly inside a virtualenv,
and the OS interpreter no longer interferes.

Depends-On: https://review.opendev.org/c/openstack/ansible-collection-kolla/+/946983

Change-Id: Ifea75c2e14ffececbe271bee1549e92bded90d48
2025-05-14 16:46:07 +02:00

63 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
set -o xtrace
set -o errexit
# Enable unbuffered output for Ansible in Jenkins.
export PYTHONUNBUFFERED=1
function upgrade {
RAW_INVENTORY=/etc/kolla/inventory
source $KOLLA_ANSIBLE_VENV_PATH/bin/activate
kolla-ansible certificates -i ${RAW_INVENTORY} -vvv &> /tmp/logs/ansible/certificates
# Previous versions had older docker, requests requirements for example
# Therefore we need to run bootstrap again to ensure libraries are in
# proper versions (ansible-collection-kolla is different for new version, potentionally
# also dependencies).
kolla-ansible bootstrap-servers -i ${RAW_INVENTORY} -vvv &> /tmp/logs/ansible/upgrade-bootstrap
# Skip rabbitmq-ha-precheck before the queues are migrated.
kolla-ansible prechecks -i ${RAW_INVENTORY} --skip-tags rabbitmq-ha-precheck -vvv &> /tmp/logs/ansible/upgrade-prechecks-pre-rabbitmq
# NOTE(SvenKieske): As om_enable_rabbitmq_transient_quorum_queue now also
# enables quorum_queues for fanout/reply queues in Epoxy, we need
# to perform a migration to durable queues.
# TODO(SvenKieske): Remove these steps in F Cycle.
SERVICE_TAGS="heat,keystone,neutron,nova"
if [[ $SCENARIO == "zun" ]] || [[ $SCENARIO == "cephadm" ]]; then
SERVICE_TAGS+=",cinder"
fi
if [[ $SCENARIO == "scenario_nfv" ]]; then
SERVICE_TAGS+=",barbican"
fi
if [[ $SCENARIO == "ironic" ]]; then
SERVICE_TAGS+=",ironic"
fi
if [[ $SCENARIO == "masakari" ]]; then
SERVICE_TAGS+=",masakari"
fi
if [[ $SCENARIO == "ovn" ]] || [[ $SCENARIO == "octavia" ]]; then
SERVICE_TAGS+=",octavia"
fi
if [[ $SCENARIO == "magnum" ]]; then
SERVICE_TAGS+=",magnum,designate"
fi
kolla-ansible stop -i ${RAW_INVENTORY} -vvv --tags $SERVICE_TAGS --yes-i-really-really-mean-it --ignore-missing &> /tmp/logs/ansible/stop
kolla-ansible genconfig -i ${RAW_INVENTORY} -vvv &> /tmp/logs/ansible/genconfig
kolla-ansible rabbitmq-reset-state -i ${RAW_INVENTORY} -vvv &> /tmp/logs/ansible/rabbitmq-reset-state
# Include rabbitmq-ha-precheck this time to confirm all queues have migrated.
kolla-ansible prechecks -i ${RAW_INVENTORY} -vvv &> /tmp/logs/ansible/upgrade-prechecks
kolla-ansible pull -i ${RAW_INVENTORY} -vvv &> /tmp/logs/ansible/pull-upgrade
kolla-ansible upgrade -i ${RAW_INVENTORY} -vvv &> /tmp/logs/ansible/upgrade
kolla-ansible post-deploy -i ${RAW_INVENTORY} -vvv &> /tmp/logs/ansible/upgrade-post-deploy
kolla-ansible validate-config -i ${RAW_INVENTORY} -vvv &> /tmp/logs/ansible/validate-config
}
upgrade