You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by wa...@apache.org on 2022/03/03 02:37:48 UTC

[flink-kubernetes-operator] branch main updated: [FLINK-26435] Provide the container name for CI debug log

This is an automated email from the ASF dual-hosted git repository.

wangyang0918 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-kubernetes-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new 47f02cb  [FLINK-26435] Provide the container name for CI debug log
47f02cb is described below

commit 47f02cb7e0318dee16d321c91867b9a94337b9da
Author: 愚鲤 <yu...@alibaba-inc.com>
AuthorDate: Wed Mar 2 23:31:45 2022 +0800

    [FLINK-26435] Provide the container name for CI debug log
---
 e2e-tests/utils.sh | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/e2e-tests/utils.sh b/e2e-tests/utils.sh
index 8b010e0..174a2af 100644
--- a/e2e-tests/utils.sh
+++ b/e2e-tests/utils.sh
@@ -63,13 +63,17 @@ function debug_and_show_logs {
 
     echo "Flink logs:"
     kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | while read pod;do
-        echo "Current logs for $pod: "
-        kubectl logs $pod;
-        restart_count=$(kubectl get pod $pod -o jsonpath='{.status.containerStatuses[0].restartCount}')
-        if [[ ${restart_count} -gt 0 ]];then
-          echo "Previous logs for $pod: "
-          kubectl logs $pod --previous
-        fi
+        containers=(`kubectl get pods  $pod -o jsonpath='{.spec.containers[*].name}'`)
+        i=0
+        for container in "${containers[@]}"; do
+          echo "Current logs for $pod:$container: "
+          kubectl logs $pod $container;
+          restart_count=$(kubectl get pod $pod -o jsonpath='{.status.containerStatuses['$i'].restartCount}')
+          if [[ ${restart_count} -gt 0 ]];then
+            echo "Previous logs for $pod: "
+            kubectl logs $pod $container --previous
+          fi
+        done
     done
 }