From 1157ca2c20530465ce45bf7d35749175d2e15c00 Mon Sep 17 00:00:00 2001 From: Fabian Koller Date: Wed, 29 Oct 2025 12:49:43 +0100 Subject: [PATCH] ci: collect coredumps from HVs --- .../integration/build/dev-user-butane.yaml | 27 ++++++++++++++ .../test/integration/collect-logs/action.yml | 37 ++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/.github/actions/test/integration/build/dev-user-butane.yaml b/.github/actions/test/integration/build/dev-user-butane.yaml index 226b59c6..885a3165 100644 --- a/.github/actions/test/integration/build/dev-user-butane.yaml +++ b/.github/actions/test/integration/build/dev-user-butane.yaml @@ -56,3 +56,30 @@ storage: contents: inline: | OCI_REPO=ghcr.io/gardenlinux/gardenlinux-ccloud + # Enable unlimited core dumps for all systemd services + - path: /etc/systemd/system.conf.d/10-core.conf + mode: 0644 + contents: + inline: | + [Manager] + DefaultLimitCORE=infinity + # Configure systemd-coredump with reasonable limits + - path: /etc/systemd/coredump.conf.d/50-ci-core.conf + mode: 0644 + contents: + inline: | + [Coredump] + Storage=external + ProcessSizeMax=3G + ExternalSizeMax=3G + MaxUse=2G + KeepFree=1G + Compress=yes + # Set kernel core pattern to use systemd-coredump + - path: /etc/sysctl.d/50-core.conf + mode: 0644 + contents: + inline: | + kernel.core_pattern=|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h + kernel.core_pipe_limit=16 + fs.suid_dumpable=2 diff --git a/.github/actions/test/integration/collect-logs/action.yml b/.github/actions/test/integration/collect-logs/action.yml index 01771fcc..0974c811 100644 --- a/.github/actions/test/integration/collect-logs/action.yml +++ b/.github/actions/test/integration/collect-logs/action.yml @@ -39,9 +39,44 @@ runs: run: | sudo chmod 644 *.log - - name: Upload artifacts + - name: Collect coredumps from hypervisors + shell: bash + run: | + KEY=/opt/ssh_host_ed25519_key + SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" + USER="root" + + for HV_NAME in HV1 HV2; do + IP="192.168.122.$([[ $HV_NAME == HV1 ]] && echo 2 || echo 3)" + + ssh $SSH_OPTS $USER@$IP " + # Only proceed if coredumps exist + if coredumpctl list --no-legend 2>/dev/null | grep -q .; then + mkdir -p /tmp/coredumps-$HV_NAME + for id in \$(coredumpctl list --no-legend 2>/dev/null | awk '{print \$5}'); do + echo Processing core \$id + coredumpctl info \$id > /tmp/coredumps-$HV_NAME/info-\$id.txt 2>/dev/null || true + coredumpctl dump \$id > /tmp/coredumps-$HV_NAME/core-\$id 2>/dev/null || true + done + else + echo 'No coredumps present on $HV_NAME' + fi + " || true + + if ssh $SSH_OPTS $USER@$IP "[ -d /tmp/coredumps-$HV_NAME ] && [ -n \"\$(ls /tmp/coredumps-$HV_NAME 2>/dev/null)\" ]"; then + scp -r $SSH_OPTS $USER@$IP:/tmp/coredumps-$HV_NAME ./ || true + fi + done + + - name: Upload debug logs uses: actions/upload-artifact@v4 with: name: debug-logs path: "*.log" + - name: Upload coredumps (if any exist) + uses: actions/upload-artifact@v4 + if: ${{ hashFiles('coredumps-*/**') != '' }} + with: + name: coredumps + path: coredumps-*/