ci: gather logs when deploying Rook fails

Log a few commands that help troubleshooting Rook deployment issues.
This might need to get extended with more commands.

Updates: #1636
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-11-23 15:44:39 +01:00 committed by mergify[bot]
parent eaeee8ac3d
commit ed033153ea

View File

@ -1,4 +1,4 @@
#!/bin/bash -e #!/bin/bash -E
ROOK_VERSION=${ROOK_VERSION:-"v1.2.7"} ROOK_VERSION=${ROOK_VERSION:-"v1.2.7"}
ROOK_DEPLOY_TIMEOUT=${ROOK_DEPLOY_TIMEOUT:-300} ROOK_DEPLOY_TIMEOUT=${ROOK_DEPLOY_TIMEOUT:-300}
@ -8,6 +8,25 @@ ROOK_CEPH_CLUSTER_VERSION="v14.2.10"
KUBECTL_RETRY=5 KUBECTL_RETRY=5
KUBECTL_RETRY_DELAY=10 KUBECTL_RETRY_DELAY=10
trap log_errors ERR
# log_errors is called on exit (see 'trap' above) and tries to provide
# sufficient information to debug deployment problems
function log_errors() {
# enable verbose execution
set -x
kubectl get nodes
kubectl -n rook-ceph get events
kubectl -n rook-ceph describe pods
kubectl -n rook-ceph logs -l app=rook-ceph-operator
kubectl -n rook-ceph get CephClusters -oyaml
kubectl -n rook-ceph get CephFilesystems -oyaml
kubectl -n rook-ceph get CephBlockPools -oyaml
# this function should not return, a fatal error was caught!
exit 1
}
rook_version() { rook_version() {
echo "${ROOK_VERSION#v}" | cut -d'.' -f"${1}" echo "${ROOK_VERSION#v}" | cut -d'.' -f"${1}"
} }