diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index f4ee86692f..e30f6b5419 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -120,6 +120,11 @@ if [[ -z "${SKIP_OSA_RUNTIME_VENV_BUILD+defined}" ]]; then build_ansible_runtime_venv fi +# Install and export the ARA callback plugin +if [ "${SETUP_ARA}" == "true" ]; then + setup_ara +fi + # Get current code version (this runs at the root of OSA clone) CURRENT_OSA_VERSION=$(cd ${OSA_CLONE_DIR}; /opt/ansible-runtime/bin/python setup.py --version) @@ -192,9 +197,4 @@ if [ -f "${ANSIBLE_ROLE_FILE}" ] && [[ -z "${SKIP_OSA_ROLE_CLONE+defined}" ]]; t unset ANSIBLE_CONFIG fi -# Install and export the ARA callback plugin -if [ "${SETUP_ARA}" == "true" ]; then - setup_ara -fi - echo "System is bootstrapped and ready for use." diff --git a/scripts/gate-check-commit.sh b/scripts/gate-check-commit.sh index 260ba45fad..5c7f17b923 100755 --- a/scripts/gate-check-commit.sh +++ b/scripts/gate-check-commit.sh @@ -55,7 +55,7 @@ export INSTALL_METHOD=${3:-"source"} export UPGRADE_SOURCE_BRANCH=${UPGRADE_SOURCE_BRANCH:-'stable/rocky'} # enable the ARA callback plugin -export SETUP_ARA=true +export SETUP_ARA=${SETUP_ARA:-true} ## Change branch for Upgrades ------------------------------------------------ # If the action is to upgrade, then store the current SHA, diff --git a/scripts/openstack-ansible.sh b/scripts/openstack-ansible.sh index 9044087b72..1bc319e647 100644 --- a/scripts/openstack-ansible.sh +++ b/scripts/openstack-ansible.sh @@ -40,6 +40,14 @@ if [[ "${PWD}" == *"${OSA_CLONE_ROOT}"* ]] || [ "${RUN_CMD}" == "openstack-ansib # Source the Ansible configuration. . /usr/local/bin/openstack-ansible.rc + # Load ARA into callback plugins if it is installed + # Dynamically retrieve the location of the ARA callback so we are able to find + # it on both py2 and py3 + ara_location=$(python -c "import os,ara; print(os.path.dirname(ara.__file__))" 2>/dev/null || true) + if [[ -n "$ara_location" ]]; then + export ANSIBLE_CALLBACK_PLUGINS="${ANSIBLE_CALLBACK_PLUGINS}:${ara_location}/plugins/callbacks" + fi + # Load userspace group vars if [[ -d ${OSA_CONFIG_DIR}/group_vars || -d ${OSA_CONFIG_DIR}/host_vars ]]; then if [[ ! -f ${OSA_CONFIG_DIR}/inventory.ini ]]; then diff --git a/scripts/scripts-library.sh b/scripts/scripts-library.sh index 0743a2166f..d39c7f7b71 100755 --- a/scripts/scripts-library.sh +++ b/scripts/scripts-library.sh @@ -203,10 +203,6 @@ function setup_ara { # PIP_OPTS contains the whole set of constraints that need to be applied. ${PIP_COMMAND} install --isolated ${PIP_OPTS} ara "${ANSIBLE_PACKAGE:-ansible}" fi - # Dynamically retrieve the location of the ARA callback so we are able to find - # it on both py2 and py3 - ara_location=$(/opt/ansible-runtime/bin/python -c "import os,ara; print(os.path.dirname(ara.__file__))") - export ANSIBLE_CALLBACK_PLUGINS="/etc/ansible/roles/plugins/callback:${ara_location}/plugins/callbacks" } function run_dstat { diff --git a/zuul.d/playbooks/pre-osa-aio.yml b/zuul.d/playbooks/pre-osa-aio.yml index cd1bd07efe..b3f6cf4a1a 100644 --- a/zuul.d/playbooks/pre-osa-aio.yml +++ b/zuul.d/playbooks/pre-osa-aio.yml @@ -30,6 +30,7 @@ # where the CI provided git sources were cloned. ZUUL_SRC_PATH: "{{ ansible_user_dir }}/src" ANSIBLE_PACKAGE: "{{ ansible_package | default('') }}" + SETUP_ARA: 'true' - name: Run bootstrap-aio script become: yes become_user: root diff --git a/zuul.d/playbooks/run.yml b/zuul.d/playbooks/run.yml index 5c184bf977..3562e61bd9 100644 --- a/zuul.d/playbooks/run.yml +++ b/zuul.d/playbooks/run.yml @@ -14,6 +14,9 @@ chdir: "src/opendev.org/openstack/openstack-ansible" executable: /bin/bash environment: + # NOTE(logan): ARA is already installed in the gate environment by the + # pre-osa-aio pre-run playbook + SETUP_ARA: false # NOTE(logan): The project is bootstrapped in the pre playbook so the # bootstrapping can be skipped here SKIP_OSA_RUNTIME_VENV_BUILD: 1