You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updates the upgrade test to print any fatal error messages to the job pod termination log.
The package is refactored to pass back any fatal errors, cancel context, and cleanup resources on a fatal error.Additional wait timeouts are added to prevent the test from hanging.
pod_status=$(kubectl get pod "$job_pod" -o jsonpath='{.status.phase}')
48
+
49
+
echo"--- Pod $job_pod status $pod_status. Retrieving termination message. ---"
50
+
# A non-restarting pod will have its termination message in 'state.terminated'.
51
+
termination_message=$(kubectl get pod "$job_pod" -o go-template='{{range .status.containerStatuses}}{{if eq .name "upgrade-test-controller"}}{{.state.terminated.message}}{{end}}{{end}}')
52
+
53
+
if [ -n"$termination_message" ];then
54
+
echo"Fatal Error: $termination_message"
55
+
else
56
+
echo"No termination message found for pod $job_pod. Dumping logs:"
containers=$(kubectl get pod "$pod" -o jsonpath='{.spec.containers[*].name}')
44
-
forcontainerin$containers;do
45
-
if [[ "$container"=="sdk-client-test"||"$container"=="upgrade-test-controller" ]];then
46
-
echo"----- Logs from pod: $pod, container: $container -----"
47
-
kubectl logs "$pod" -c "$container"||echo"Failed to retrieve logs from $pod/$container"
48
-
fi
49
-
done
60
+
containers=$(kubectl get pod "$pod" -o jsonpath='{.spec.containers[*].name}')
61
+
forcontainerin$containers;do
62
+
if [[ "$container"=="sdk-client-test"||"$container"=="upgrade-test-controller" ]];then
63
+
echo"----- Logs from pod: $pod, container: $container -----"
64
+
kubectl logs "$pod" -c "$container" --tail=50||echo"Failed to retrieve logs from $pod/$container"
65
+
fi
66
+
done
50
67
done
68
+
fi
51
69
fi
52
70
53
-
echo"Logs from log bucket: https://console.cloud.google.com/logs/query;storageScope=storage,projects%2F${PROJECT_ID}%2Flocations%2Fglobal%2Fbuckets%2F${BUCKET_NAME}%2Fviews%2F_AllLogs?hl=en&inv=1&invt=Ab4o5A&mods=logs_tg_prod&project=${PROJECT_ID}"
71
+
echo"Logs from log bucket: https://console.cloud.google.com/logs/query;storageScope=storage,projects%2F${PROJECT_ID}%2Flocations%2Fglobal%2Fbuckets%2F${BUCKET_NAME}%2Fviews%2F_AllLogs?hl=en&inv=1&invt=Ab4o5A&mods=logs_tg_prod&project=${PROJECT_ID}"
0 commit comments