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
44 lines
1.1 KiB
Bash
Executable File
44 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
tmpdir="$(mktemp -d)"
|
|
bundle_archive_name="support-bundle.tar.gz"
|
|
bundle_directory_name="support-bundle"
|
|
|
|
./bin/support-bundle --debug --interactive=false examples/support-bundle/e2e.yaml --output=$tmpdir/$bundle_archive_name
|
|
if [ $? -ne 0 ]; then
|
|
echo "support-bundle command failed"
|
|
exit $EXIT_STATUS
|
|
fi
|
|
|
|
EXIT_STATUS=0
|
|
if ! tar -xvzf $tmpdir/$bundle_archive_name --directory $tmpdir; then
|
|
echo "A valid support bundle archive was not generated"
|
|
EXIT_STATUS=1
|
|
fi
|
|
|
|
echo "$(cat $tmpdir/$bundle_directory_name/analysis.json)"
|
|
|
|
if grep -q "No matching files" "$tmpdir/$bundle_directory_name/analysis.json"; then
|
|
echo "Some files were not collected"
|
|
EXIT_STATUS=1
|
|
fi
|
|
|
|
EXIT_STATUS=0
|
|
jq -r '.[].insight.severity' "$tmpdir/$bundle_directory_name/analysis.json" | while read i; do
|
|
if [ $i == "error" ]; then
|
|
EXIT_STATUS=1
|
|
echo "Analyzers with severity of \"error\" found"
|
|
fi
|
|
|
|
if [ $i == "warn" ]; then
|
|
EXIT_STATUS=1
|
|
echo "Analyzers with severity of \"warn\" found"
|
|
fi
|
|
done
|
|
|
|
rm -rf "$tmpdir"
|
|
|
|
exit $EXIT_STATUS
|