From 871932cc8eac8ea50fde27d207dca69dcbe66559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Mon, 25 Oct 2021 17:51:39 +0200 Subject: [PATCH] ci: log and describe all the pod/deploys on errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the CI fails, we want to collect more logs and describe from the entire environment. Signed-off-by: Sébastien Han --- tests/scripts/collect-logs.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/scripts/collect-logs.sh b/tests/scripts/collect-logs.sh index a765119075a9..f0bf62cebb43 100755 --- a/tests/scripts/collect-logs.sh +++ b/tests/scripts/collect-logs.sh @@ -16,14 +16,19 @@ $CEPH_CMD -s > "${LOG_DIR}"/ceph-status.txt $CEPH_CMD osd dump > "${LOG_DIR}"/ceph-osd-dump.txt $CEPH_CMD report > "${LOG_DIR}"/ceph-report.txt +for pod in $(kubectl -n "${CLUSTER_NAMESPACE}" get pod -o jsonpath='{.items[*].metadata.name}'); do + kubectl -n "${CLUSTER_NAMESPACE}" describe pod "$pod" > "${LOG_DIR}"/pod-describe-"$pod".txt +done +for dep in $(kubectl -n "${CLUSTER_NAMESPACE}" get deploy -o jsonpath='{.items[*].metadata.name}'); do + kubectl -n "${CLUSTER_NAMESPACE}" describe deploy "$dep" > "${LOG_DIR}"/deploy-describe-"$dep".txt + kubectl -n "${CLUSTER_NAMESPACE}" log deploy "$dep" --all-containers > "${LOG_DIR}"/deploy-describe-"$dep"-log.txt +done kubectl -n "${OPERATOR_NAMESPACE}" logs deploy/rook-ceph-operator > "${LOG_DIR}"/operator-logs.txt kubectl -n "${OPERATOR_NAMESPACE}" get pods -o wide > "${LOG_DIR}"/operator-pods-list.txt kubectl -n "${CLUSTER_NAMESPACE}" get pods -o wide > "${LOG_DIR}"/cluster-pods-list.txt prepare_job="$(kubectl -n "${CLUSTER_NAMESPACE}" get job -l app=rook-ceph-osd-prepare --output name | awk 'FNR <= 1')" # outputs job/ kubectl -n "${CLUSTER_NAMESPACE}" describe "${prepare_job}" > "${LOG_DIR}"/osd-prepare-describe.txt kubectl -n "${CLUSTER_NAMESPACE}" logs "${prepare_job}" > "${LOG_DIR}"/osd-prepare-logs.txt -kubectl -n "${CLUSTER_NAMESPACE}" describe deploy/rook-ceph-osd-0 > "${LOG_DIR}"/rook-ceph-osd-0-describe.txt -kubectl -n "${CLUSTER_NAMESPACE}" describe deploy/rook-ceph-osd-1 > "${LOG_DIR}"/rook-ceph-osd-1-describe.txt kubectl -n "${CLUSTER_NAMESPACE}" logs deploy/rook-ceph-osd-0 --all-containers > "${LOG_DIR}"/rook-ceph-osd-0-logs.txt kubectl -n "${CLUSTER_NAMESPACE}" logs deploy/rook-ceph-osd-1 --all-containers > "${LOG_DIR}"/rook-ceph-osd-1-logs.txt kubectl get all -n "${OPERATOR_NAMESPACE}" -o wide > "${LOG_DIR}"/operator-wide.txt