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:"
57
+
containers=$(kubectl get pod "$job_pod" -o jsonpath='{.spec.containers[*].name}')
58
+
forcontainerin$containers;do
59
+
if [[ "$container"=="sdk-client-test"||"$container"=="upgrade-test-controller" ]];then
60
+
echo"----- Logs from pod: $job_pod, container: $container -----"
61
+
kubectl logs "$job_pod" -c "$container" --tail=50 ||echo"Failed to retrieve logs from $job_pod/$container"
62
+
fi
50
63
done
64
+
fi
51
65
fi
52
66
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}"
67
+
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