Add a switch for the gate job exit tasks

Before, they could only be enabled if /etc/nodepool exists. Now,
they are enabled if /etc/nodepool exists, or also if an env var
called "GATE_EXIT_LOG_COPY" is true. Also add a switch to disable
the gzipping of log files, enabled by default, called
GATE_EXIT_LOG_GZIP.

Also remove a var that is not referenced by anything in OSA called
OSA_GATE_JOB. It is set to true in gate-check-commit.sh, but never
referenced and can probably be removed.

Change-Id: I1ae20702e42666d58738397829770c258c3bdc2f
This commit is contained in:
Logan V 2017-08-04 12:08:06 -05:00
parent 28a50d51c1
commit 4e24b584a6
2 changed files with 13 additions and 6 deletions

View File

@ -33,10 +33,6 @@ export BOOTSTRAP_OPTS=${BOOTSTRAP_OPTS:-''}
# Ensure the terminal type is set # Ensure the terminal type is set
export TERM=linux export TERM=linux
# This variable is being added to ensure the gate job executes an exit
# function at the end of the run.
export OSA_GATE_JOB=true
# Store the clone repo root location # Store the clone repo root location
export OSA_CLONE_DIR="$(readlink -f $(dirname ${0})/..)" export OSA_CLONE_DIR="$(readlink -f $(dirname ${0})/..)"

View File

@ -22,6 +22,15 @@ ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:-""}
STARTTIME="${STARTTIME:-$(date +%s)}" STARTTIME="${STARTTIME:-$(date +%s)}"
COMMAND_LOGS=${COMMAND_LOGS:-"/openstack/log/ansible_cmd_logs"} COMMAND_LOGS=${COMMAND_LOGS:-"/openstack/log/ansible_cmd_logs"}
GATE_EXIT_LOG_COPY="${GATE_EXIT_LOG_COPY:-false}"
GATE_EXIT_LOG_GZIP="${GATE_EXIT_LOG_GZIP:-true}"
# If this is a gate node from OpenStack-Infra Store all logs into the
# execution directory after gate run.
if [[ -d "/etc/nodepool" ]]; then
GATE_EXIT_LOG_COPY=true
fi
# The default SSHD configuration has MaxSessions = 10. If a deployer changes # The default SSHD configuration has MaxSessions = 10. If a deployer changes
# their SSHD config, then the ANSIBLE_FORKS may be set to a higher number. We # their SSHD config, then the ANSIBLE_FORKS may be set to a higher number. We
# set the value to 10 or the number of CPU's, whichever is less. This is to # set the value to 10 or the number of CPU's, whichever is less. This is to
@ -99,7 +108,7 @@ function exit_fail {
function gate_job_exit_tasks { function gate_job_exit_tasks {
# If this is a gate node from OpenStack-Infra Store all logs into the # If this is a gate node from OpenStack-Infra Store all logs into the
# execution directory after gate run. # execution directory after gate run.
if [[ -d "/etc/nodepool" ]];then if [ "$GATE_EXIT_LOG_COPY" == true ]; 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 --archive --verbose --safe-links --ignore-errors /var/log/ "${GATE_LOG_DIR}/host" || true rsync --archive --verbose --safe-links --ignore-errors /var/log/ "${GATE_LOG_DIR}/host" || true
@ -113,7 +122,9 @@ function gate_job_exit_tasks {
/opt/ansible-runtime/bin/ara generate html "${GATE_LOG_DIR}/ara" || true /opt/ansible-runtime/bin/ara generate html "${GATE_LOG_DIR}/ara" || true
# Compress the files gathered so that they do not take up too much space. # 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. # We use 'command' to ensure that we're not executing with some sort of alias.
command gzip --best --recursive "${GATE_LOG_DIR}/" if [ "$GATE_EXIT_LOG_GZIP" == true ]; then
command gzip --best --recursive "${GATE_LOG_DIR}/"
fi
# Ensure that the files are readable by all users, including the non-root # Ensure that the files are readable by all users, including the non-root
# OpenStack-CI jenkins user. # OpenStack-CI jenkins user.
chmod -R 0777 "${GATE_LOG_DIR}" chmod -R 0777 "${GATE_LOG_DIR}"