Merge "Compress all gathered logs for CI"

This commit is contained in:
Jenkins 2016-09-12 14:50:41 +00:00 committed by Gerrit Code Review
commit 1d8b4c5183
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 fall back to installing its default packages which
# will potentially be detrimental to the tests executed. # will potentially be detrimental to the tests executed.
# Required for compressing collected log files in CI
gzip
# Requirements for Paramiko 2.0 # Requirements for Paramiko 2.0
libssl-dev [platform:dpkg] libssl-dev [platform:dpkg]
libffi-dev [platform:dpkg] libffi-dev [platform:dpkg]

View File

@ -137,8 +137,16 @@ function gate_job_exit_tasks {
if [[ -d "/etc/nodepool" ]];then if [[ -d "/etc/nodepool" ]];then
GATE_LOG_DIR="$(dirname "${0}")/../logs" GATE_LOG_DIR="$(dirname "${0}")/../logs"
mkdir -p "${GATE_LOG_DIR}/host" "${GATE_LOG_DIR}/openstack" mkdir -p "${GATE_LOG_DIR}/host" "${GATE_LOG_DIR}/openstack"
rsync -av --ignore-errors /var/log/ "${GATE_LOG_DIR}/host" || true rsync --archive --verbose --safe-links --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 /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}" chmod -R 0777 "${GATE_LOG_DIR}"
fi fi
} }