Skip to content

Commit

Permalink
build: Fix collecting logs in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
fengelniederhammer committed Feb 26, 2024
1 parent 03c360c commit fe2a9c9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/scripts/collect_kubernetes_logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

set -e

pods=$(kubectl get pods -l app=loculus -n loculus -o jsonpath='{.items[*].metadata.name}' || true)
pods=$(kubectl get pods -l app=loculus -o jsonpath='{.items[*].metadata.name}' || true)

echo "Collecting logs from pods: $pods"

for pod in $pods; do
containers=$(kubectl get pod "$pod" -n loculus -o jsonpath='{.spec.containers[*].name}' || true)
containers=$(kubectl get pod "$pod" -o jsonpath='{.spec.containers[*].name}' || true)
for container in $containers; do
mkdir "kubernetes_logs" -p
file="kubernetes_logs/$pod-$container.txt"
echo "Logs from $pod - $container:" >> "$file"
kubectl logs "$pod" -n loculus -c "$container" >> "$file" 2>/dev/null || true
kubectl logs "$pod" -c "$container" >> "$file" 2>/dev/null || true
done
done

0 comments on commit fe2a9c9

Please sign in to comment.