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
job_pods=$(kubectl get pods -l job-name=upgrade-test-runner -o jsonpath="{.items[*].metadata.name}")
37
-
kubectl logs --tail=20 "$job_pods"||echo"Unable to retrieve logs for pod: $job_pods"
38
-
forpodin$job_pods;do
39
-
containers=$(kubectl get pod "$pod" -o jsonpath='{.spec.containers[*].name}')
40
-
forcontainerin$containers;do
41
-
if [[ "$container"=="sdk-client-test"||"$container"=="upgrade-test-controller" ]];then
42
-
echo"----- Logs from pod: $pod, container: $container -----"
43
-
kubectl logs "$pod" -c "$container"||echo"Failed to retrieve logs from $pod/$container"
44
-
fi
38
+
if [[ -z"$job_pods" ]];then
39
+
echo"No pods found for job upgrade-test-runner. They might have failed to schedule or were deleted."
40
+
else
41
+
kubectl logs --tail=20 "$job_pods"||echo"Unable to retrieve logs for pod: $job_pods"
42
+
forpodin$job_pods;do
43
+
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
45
50
done
46
-
done
51
+
fi
47
52
48
-
log_url="https://console.cloud.google.com/logs/query;storageScope=storage,projects%2F${PROJECT_ID}%2Flocations%2Fglobal%2Fbuckets%2Fupgrade-test-container-logs%2Fviews%2F_AllLogs;query=$(printf 'resource.labels.container_name=(\"upgrade-test-controller\" OR \"sdk-client-test\")'| jq -sRr @uri);cursorTimestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ);duration=PT10M?project=${PROJECT_ID}"
49
-
echo"Logs from log bucket: $log_url"
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}"
0 commit comments