From e97e32126419a86d3f4dd9becd0d4d4029a0c7b7 Mon Sep 17 00:00:00 2001 From: Logan V Date: Fri, 16 Aug 2019 13:48:24 -0500 Subject: [PATCH] Generate static ARA report when necessary OpenStack CI recently switched to object based log storage, which cannot render ARA sqlite databases since there is no longer middleware to do so. The Zuul inventory contains a var that allows us to detect this situation called "ara_report_type". In the openstack gate, this var is set to "html", indicating a static report should be generated. We will now use this var in the log collection playbook to indicate to that our log collect script should generate an ARA static html report. Change-Id: I74ba6ab2ee329e3c78b470152c7f279fc34e1eb9 --- scripts/log-collect.sh | 9 ++++++++- zuul.d/playbooks/post.yml | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/log-collect.sh b/scripts/log-collect.sh index 3f7977e155..2e0833fce2 100755 --- a/scripts/log-collect.sh +++ b/scripts/log-collect.sh @@ -26,6 +26,7 @@ ## Vars ---------------------------------------------------------------------- export WORKING_DIR=${WORKING_DIR:-$(pwd)} export RUN_ARA=${RUN_ARA:-false} +export ARA_REPORT_TYPE=${ARA_REPORT_TYPE:-"database"} export TESTING_HOME=${TESTING_HOME:-$HOME} export TS=$(date +"%H-%M-%S") @@ -142,7 +143,7 @@ function find_files { ! -name '*.html' \ ! -name '*.subunit' \ ! -name "*.journal" \ - ! -name 'ansible.sqlite' | grep -v 'stackviz' + ! -name 'ansible.sqlite' | egrep -v 'stackviz|ara-report' } function rename_files { @@ -172,6 +173,12 @@ store_artifacts /openstack/log/ansible-logging/ "${WORKING_DIR}/logs/ansible" store_artifacts /openstack/log/ "${WORKING_DIR}/logs/openstack" store_artifacts /var/log/ "${WORKING_DIR}/logs/host" +# Build the ARA static html report if required +if [[ "$ARA_REPORT_TYPE" == "html" ]]; then + echo "Generating ARA static html report." + /opt/ansible-runtime/bin/ara generate html "${WORKING_DIR}/logs/ara-report" +fi + # Store the ara sqlite database in the openstack-ci expected path store_artifacts "${TESTING_HOME}/.ara/ansible.sqlite" "${WORKING_DIR}/logs/ara-report/" diff --git a/zuul.d/playbooks/post.yml b/zuul.d/playbooks/post.yml index 46456c9d1f..c7919ea508 100644 --- a/zuul.d/playbooks/post.yml +++ b/zuul.d/playbooks/post.yml @@ -27,6 +27,8 @@ ZUUL_PROJECT: "{{ zuul.project.short_name }}" TEST_EXIT_CODE: "{{ zuul_success | lower }}" RUN_ARA: "true" + # Some Zuul environments (such as OpenStack CI) use html based ara reports + ARA_REPORT_TYPE: "{{ ara_report_type | default('database') }}" WORKING_DIR: "{{ ansible_user_dir }}/src/opendev.org/openstack/openstack-ansible" - name: Check whether a logs folder exists