From 64708ec7d1efdf271d463f2ae80d304149417d3d Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 7 Sep 2016 09:00:06 +0100 Subject: [PATCH] Compress all gathered logs for CI In order to ensure that all logs gathered do not take up too much space on CI systems, the logs are gzipped. In order to make them viewable via a browser from the CI log host, the files are renamed to .txt before compressing them. Closes-Bug: #1620849 Change-Id: I71e629c505770b8e95a6328c79d46ab45ee0300a --- bindep.txt | 3 +++ scripts/scripts-library.sh | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bindep.txt b/bindep.txt index e2b047351c..d18f11f7ae 100644 --- a/bindep.txt +++ b/bindep.txt @@ -10,6 +10,9 @@ # will fall back to installing its default packages which # will potentially be detrimental to the tests executed. +# Required for compressing collected log files in CI +gzip + # Requirements for Paramiko 2.0 libssl-dev [platform:dpkg] libffi-dev [platform:dpkg] diff --git a/scripts/scripts-library.sh b/scripts/scripts-library.sh index 77f6538a5b..35923025f2 100755 --- a/scripts/scripts-library.sh +++ b/scripts/scripts-library.sh @@ -137,8 +137,16 @@ function gate_job_exit_tasks { if [[ -d "/etc/nodepool" ]];then GATE_LOG_DIR="$(dirname "${0}")/../logs" mkdir -p "${GATE_LOG_DIR}/host" "${GATE_LOG_DIR}/openstack" - rsync -av --ignore-errors /var/log/ "${GATE_LOG_DIR}/host" || true - rsync -av --ignore-errors /openstack/log/ "${GATE_LOG_DIR}/openstack" || true + rsync --archive --verbose --safe-links --ignore-errors /var/log/ "${GATE_LOG_DIR}/host" || true + rsync --archive --verbose --safe-links --ignore-errors /openstack/log/ "${GATE_LOG_DIR}/openstack" || true + # Rename all files gathered to have a .txt suffix so that the compressed + # files are viewable via a web browser in OpenStack-CI. + find "${GATE_LOG_DIR}/" -type f -exec mv {} {}.txt \; + # Compress the files gathered so that they do not take up too much space. + # We use 'command' to ensure that we're not executing with some sort of alias. + command gzip --best --recursive "${GATE_LOG_DIR}/" + # Ensure that the files are readable by all users, including the non-root + # OpenStack-CI jenkins user. chmod -R 0777 "${GATE_LOG_DIR}" fi }