Skip to content

Commit a52f598

Browse files
committed
Collect system logs from CI failing runs
Signed-off-by: apostasie <[email protected]>
1 parent 62477fb commit a52f598

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/workflows/job-test-in-container.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,11 @@ jobs:
179179
else
180180
docker run -t --rm --privileged -e GITHUB_STEP_SUMMARY="$GITHUB_STEP_SUMMARY" -v "$GITHUB_STEP_SUMMARY":"$GITHUB_STEP_SUMMARY" -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622:-} "${args[@]}" -test.only-flaky=true -test.target=${{ inputs.binary }}
181181
fi
182+
183+
- name: Logs
184+
if: ${{ failure() }}
185+
uses: actions/upload-artifact@v4
186+
with:
187+
name: "System logs"
188+
path: /tmp/debug-logs.tar.gz
189+
retention-days: 1

hack/github/gotestsum-reporter.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,27 @@ GITHUB_STEP_SUMMARY="${GITHUB_STEP_SUMMARY:-/dev/null}"
4242
gotestsum tool slowest --threshold 15s --jsonfile "$GOTESTSUM_JSONFILE"
4343
echo '```'
4444
} >> "$GITHUB_STEP_SUMMARY"
45+
46+
if [[ "$(id -u)" = "0" ]]; then
47+
{ systemctl --no-pager list-units || echo "failed retrieving units list"; } > ~/systemctl-list.log
48+
for unit in apparmor containerd stargz-snapshotter test-integration-ipfs-offline test-integration-buildkit-nerdctl-test test-integration-soci-snapshotter; do
49+
{ journalctl --no-pager -u "$unit" || echo "failed retrieving $unit logs"; } > ~/"$unit"-rootful.log
50+
done
51+
{
52+
find /var/lib -iname "*.log" -exec echo "{}" \; 2>/dev/null;
53+
find ~/ -iname "*.log" -exec echo "{}" \; 2>/dev/null;
54+
} | tar -cf ~/debug-logs.tar.gz --files-from=/dev/stdin || {
55+
echo "failed tarring $?"
56+
}
57+
else
58+
{ systemctl --user --no-pager list-units || echo "failed retrieving units list"; } > ~/systemctl-list.log
59+
for unit in apparmor containerd stargz-snapshotter test-integration-ipfs-offline test-integration-buildkit-nerdctl-test test-integration-soci-snapshotter; do
60+
{ journalctl --user --no-pager -u "$unit" || echo "failed retrieving $unit logs"; } > ~/"$unit"-rootless.log
61+
done
62+
{
63+
find ~/.local/share/nerdctl -iname "*.log" -exec echo "{}" \; 2>/dev/null
64+
find ~/ -iname "*.log" -exec echo "{}" \; 2>/dev/null;
65+
} | tar -cf ~/debug-logs.tar.gz --files-from=/dev/stdin || {
66+
echo "failed tarring $?"
67+
}
68+
fi

0 commit comments

Comments
 (0)