podman/contrib/cirrus/logcollector.sh
Ed Santiago cabd6c1607 CI: package_versions: include hostinfo, kernel
In the package_versions CI step, include Fedora/Ubuntu
version, uname -r, and cgroups version.

Cgroups version is simply the FS type of /sys/fs/cgroup,
which shows 'tmpfs' for v1 and 'cgroup2fs' for v2. I
don't think it's worth the effort to prettify those
into 'v1/v2' - I think our readers are sophisticated
enough to figure it out from context - but am willing
to add that feature if requested.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-27 09:40:35 -07:00

83 lines
2.5 KiB
Bash
Executable file

#!/bin/bash
set -e
source $(dirname $0)/lib.sh
req_env_var CIRRUS_WORKING_DIR OS_RELEASE_ID TEST_REMOTE_CLIENT
# 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 ;;
ginkgo) showrun cat $CIRRUS_WORKING_DIR/test/e2e/ginkgo-node-*.log ;;
journal) showrun journalctl -b ;;
podman) showrun podman system info ;;
varlink)
if [[ "$TEST_REMOTE_CLIENT" == "true" ]]
then
echo "(Trailing 100 lines of $VARLINK_LOG)"
showrun tail -100 $VARLINK_LOG
else
die 0 "\$TEST_REMOTE_CLIENT is not 'true': $TEST_REMOTE_CLIENT"
fi
;;
packages)
# These names are common to Fedora and Ubuntu
PKG_NAMES=(\
conmon \
containernetworking-plugins \
containers-common \
criu \
golang \
podman \
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 \
crun \
runc \
)
;;
ubuntu*)
cat /etc/issue
PKG_LST_CMD='dpkg-query --show --showformat=${Package}-${Version}-${Architecture}\n'
PKG_NAMES+=(\
cri-o-runc \
)
;;
*) 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
;;
*) die 1 "Warning, $(basename $0) doesn't know how to handle the parameter '$1'"
esac