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
This commit is contained in:
Logan V 2019-08-16 13:48:24 -05:00 committed by Dmitriy Rabotyagov (noonedeadpunk)
parent 0f92985608
commit e97e321264
2 changed files with 10 additions and 1 deletions

View File

@ -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/"

View File

@ -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