From 4dade964a21ddcb3467692ce34cf6ff01ee43aae Mon Sep 17 00:00:00 2001 From: Helber Belmiro Date: Wed, 13 Nov 2024 12:55:00 -0300 Subject: [PATCH] Collect events and logs Signed-off-by: Helber Belmiro --- .github/workflows/kind-integration.yml | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/kind-integration.yml b/.github/workflows/kind-integration.yml index f38c75069..c1a986d44 100644 --- a/.github/workflows/kind-integration.yml +++ b/.github/workflows/kind-integration.yml @@ -47,6 +47,44 @@ jobs: uses: ./.github/actions/kind - name: Run test + id: test working-directory: ${{ github.workspace }}/.github/scripts/tests run: | sh tests.sh --kind + continue-on-error: true + + - name: Collect events and logs + if: steps.test.outcome != 'success' + run: | + POD_NAMES=$(kubectl -n test-dspa get pods --field-selector=status.phase=Running -o custom-columns=":metadata.name") + + for POD_NAME in ${POD_NAMES}; do + echo "===== Pod: ${POD_NAME} =====" + + echo "----- EVENTS -----" + kubectl describe pod ${POD_NAME} -n test-dspa | grep -A 100 Events + + echo "----- LOGS -----" + kubectl logs ${POD_NAME} -n test-dspa + + echo "===========================" + echo "" + done + + POD_NAMES=$(kubectl -n opendatahub get pods --field-selector=status.phase=Running -o custom-columns=":metadata.name") + + for POD_NAME in ${POD_NAMES}; do + echo "===== Pod: ${POD_NAME} =====" + + echo "----- EVENTS -----" + kubectl describe pod ${POD_NAME} -n opendatahub | grep -A 100 Events + + echo "----- LOGS -----" + kubectl logs ${POD_NAME} -n opendatahub + + echo "===========================" + echo "" + done + + exit 1 +