mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
* feat(collectors): Store all pod logs in cluster-resources directory All pod logs collected by the logs collector will now be stored in /cluster-resources/pods/logs/[namespace]/[pod]/[container].log. This will provide consistency and allow sbctl to find the logs when we run `kubectl logs <pod>`. To allow backwards compatibility, symlinks of the log files will be created in the current expected locations. Closes: #744
39 lines
771 B
Bash
Executable File
39 lines
771 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
tmpdir="$(mktemp -d)"
|
|
|
|
./bin/preflight --debug --interactive=false --format=json examples/preflight/e2e.yaml > "$tmpdir/result.json"
|
|
if [ $? -ne 0 ]; then
|
|
echo "preflight command failed"
|
|
exit $EXIT_STATUS
|
|
fi
|
|
|
|
cat "$tmpdir/result.json"
|
|
|
|
EXIT_STATUS=0
|
|
if grep -q "was not collected" "$tmpdir/result.json"; then
|
|
echo "Some files were not collected"
|
|
EXIT_STATUS=1
|
|
fi
|
|
|
|
if (( `jq '.pass | length' "$tmpdir/result.json"` < 1 )); then
|
|
echo "No passing preflights found"
|
|
EXIT_STATUS=1
|
|
fi
|
|
|
|
if (( `jq '.warn | length' "$tmpdir/result.json"` > 0 )); then
|
|
echo "Warnings found"
|
|
EXIT_STATUS=1
|
|
fi
|
|
|
|
if (( `jq '.fail | length' "$tmpdir/result.json"` > 0 )); then
|
|
echo "Failed preflights found"
|
|
EXIT_STATUS=1
|
|
fi
|
|
|
|
rm -rf "$tmpdir"
|
|
|
|
exit $EXIT_STATUS
|