podman/contrib/cirrus/logcollector.sh
Chris Evich 6a6e868290
Cirrus: Collect ginkgo node logs artifacts
In rare cases, it's possible for one of the ginkgo processes to "hang".
When this occurs, the main output will contain this message:

``Ginkgo timed out waiting for all parallel nodes to report``

The only way to debug this was to look through concatenated printing
of the ginkgo node logs.  This is a tedious and daunting task,
requiring special search knowledge, facing a "wall of text".

Simplify the situation by collecting the node logs separately, as
individual files in a cirrus-artifact.  In this way, it's faster to
figure out which test "hung" by examining each log individually.  The
log file which does not have a pass/fail summary at the end,
indicates the last test hung (for whatever reason), and includes it's
output (if any).

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-02-03 10:44:41 -05:00

85 lines
2.6 KiB
Bash
Executable file

#!/usr/bin/env bash
set -e
# shellcheck source=contrib/cirrus/lib.sh
source $(dirname $0)/lib.sh
req_env_vars CIRRUS_WORKING_DIR OS_RELEASE_ID
# Assume there are other log collection commands to follow - Don't
# let one break another that may be useful, but also keep any
# actual script-problems fatal so they are noticed right away.
showrun() {
echo '+ '$(printf " %q" "$@")
set +e
echo '------------------------------------------------------------'
"$@"
local status=$?
[[ $status -eq 0 ]] || \
echo "[ rc = $status -- proceeding anyway ]"
echo '------------------------------------------------------------'
set -e
}
case $1 in
audit)
case $OS_RELEASE_ID in
ubuntu) showrun cat /var/log/kern.log ;;
fedora) showrun cat /var/log/audit/audit.log ;;
*) bad_os_id_ver ;;
esac
;;
df) showrun df -lhTx tmpfs ;;
journal) showrun journalctl -b ;;
podman) showrun ./bin/podman system info ;;
server)
msg "(Trailing 100 lines of $PODMAN_SERVER_LOG)"
if [[ -r "$PODMAN_SERVER_LOG" ]]; then tail -100 $PODMAN_SERVER_LOG; fi
;;
packages)
# These names are common to Fedora and Ubuntu
PKG_NAMES=(\
conmon \
containernetworking-plugins \
containers-common \
criu \
crun \
golang \
podman \
runc \
skopeo \
slirp4netns \
)
case $OS_RELEASE_ID in
fedora)
cat /etc/fedora-release
PKG_LST_CMD='rpm -q --qf=%{N}-%{V}-%{R}-%{ARCH}\n'
PKG_NAMES+=(\
container-selinux \
libseccomp \
)
;;
ubuntu)
cat /etc/issue
PKG_LST_CMD='dpkg-query --show --showformat=${Package}-${Version}-${Architecture}\n'
PKG_NAMES+=(\
cri-o-runc \
libseccomp2 \
)
;;
*) bad_os_id_ver ;;
esac
echo "Kernel: " $(uname -r)
echo "Cgroups: " $(stat -f -c %T /sys/fs/cgroup)
# Any not-present packages will be listed as such
$PKG_LST_CMD "${PKG_NAMES[@]}" | sort -u
;;
time)
# Assumed to be empty/undefined outside of Cirrus-CI (.cirrus.yml)
# shellcheck disable=SC2154
if [[ -r "$STATS_LOGFILE" ]]; then cat "$STATS_LOGFILE"; fi
;;
*) die "Warning, $(basename $0) doesn't know how to handle the parameter '$1'"
esac