-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from rajatjindal/collect-logs-from-ci
allow ci to collect logs on failure
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
|
||
echo "collecting debug info from CI run in 'debug-logs' dir" | ||
|
||
mkdir -p debug-logs | ||
|
||
echo "-> k3d cluster list" > debug-logs/kubernetes.log | ||
k3d cluster list >> debug-logs/kubernetes.log | ||
echo "" >> debug-logs/kubernetes.log | ||
|
||
echo "-> kubectl get pods -n default -o wide" >> debug-logs/kubernetes.log | ||
kubectl get pods -n default -o wide >> debug-logs/kubernetes.log | ||
echo "" >> debug-logs/kubernetes.log | ||
|
||
echo "-> kubectl describe pods -n default" >> debug-logs/kubernetes.log | ||
kubectl describe pods -n default >> debug-logs/kubernetes.log | ||
echo "" >> debug-logs/kubernetes.log | ||
|
||
for node in `k3d node list --no-headers | awk '{print $1}'`; do | ||
echo "collecting containerd logs from $node" | ||
docker cp $node:/var/lib/rancher/k3s/agent/containerd/containerd.log debug-logs/$node.containerd.log || echo "containerd.log file not found in $node" | ||
done |