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
This commit is contained in:
Jesse Pretorius 2016-09-07 09:00:06 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 1083dc9a7f
commit 64708ec7d1
2 changed files with 13 additions and 2 deletions

View File

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

View File

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