github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/contrib/cirrus/logcollector.sh (about) 1 #!/usr/bin/env bash 2 3 set -e 4 5 # shellcheck source=contrib/cirrus/lib.sh 6 source $(dirname $0)/lib.sh 7 8 req_env_vars CIRRUS_WORKING_DIR OS_RELEASE_ID 9 10 # Assume there are other log collection commands to follow - Don't 11 # let one break another that may be useful, but also keep any 12 # actual script-problems fatal so they are noticed right away. 13 showrun() { 14 echo '+ '$(printf " %q" "$@") 15 set +e 16 echo '------------------------------------------------------------' 17 "$@" 18 local status=$? 19 [[ $status -eq 0 ]] || \ 20 echo "[ rc = $status -- proceeding anyway ]" 21 echo '------------------------------------------------------------' 22 set -e 23 } 24 25 case $1 in 26 audit) 27 case $OS_RELEASE_ID in 28 ubuntu) showrun cat /var/log/kern.log ;; 29 fedora) showrun cat /var/log/audit/audit.log ;; 30 *) bad_os_id_ver ;; 31 esac 32 ;; 33 df) showrun df -lhTx tmpfs ;; 34 ginkgo) showrun cat $CIRRUS_WORKING_DIR/test/e2e/ginkgo-node-*.log ;; 35 journal) showrun journalctl -b ;; 36 podman) showrun ./bin/podman system info ;; 37 server) 38 msg "(Trailing 100 lines of $PODMAN_SERVER_LOG)" 39 if [[ -r "$PODMAN_SERVER_LOG" ]]; then tail -100 $PODMAN_SERVER_LOG; fi 40 ;; 41 packages) 42 # These names are common to Fedora and Ubuntu 43 PKG_NAMES=(\ 44 conmon \ 45 containernetworking-plugins \ 46 containers-common \ 47 criu \ 48 crun \ 49 golang \ 50 podman \ 51 runc \ 52 skopeo \ 53 slirp4netns \ 54 ) 55 case $OS_RELEASE_ID in 56 fedora*) 57 cat /etc/fedora-release 58 PKG_LST_CMD='rpm -q --qf=%{N}-%{V}-%{R}-%{ARCH}\n' 59 PKG_NAMES+=(\ 60 container-selinux \ 61 libseccomp \ 62 ) 63 ;; 64 ubuntu*) 65 cat /etc/issue 66 PKG_LST_CMD='dpkg-query --show --showformat=${Package}-${Version}-${Architecture}\n' 67 PKG_NAMES+=(\ 68 cri-o-runc \ 69 libseccomp2 \ 70 ) 71 ;; 72 *) bad_os_id_ver ;; 73 esac 74 echo "Kernel: " $(uname -r) 75 echo "Cgroups: " $(stat -f -c %T /sys/fs/cgroup) 76 # Any not-present packages will be listed as such 77 $PKG_LST_CMD "${PKG_NAMES[@]}" | sort -u 78 ;; 79 time) 80 # Assumed to be empty/undefined outside of Cirrus-CI (.cirrus.yml) 81 # shellcheck disable=SC2154 82 if [[ -r "$STATS_LOGFILE" ]]; then cat "$STATS_LOGFILE"; fi 83 ;; 84 *) die "Warning, $(basename $0) doesn't know how to handle the parameter '$1'" 85 esac