Skip to content

Commit 78ec870

Browse files
committed
ci: emergency debug artifact upload for failures
1 parent c516575 commit 78ec870

File tree

3 files changed

+37
-22
lines changed

3 files changed

+37
-22
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: emergency-debugging
2+
description: Store debugging information in case of test failure
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Obtain logs from test runner
7+
shell: bash
8+
run: |
9+
cp /var/log/libvirt/qemu/*.log . || true
10+
journalctl --no-pager > journal.log || true
11+
12+
- name: Obtain logs from hypervisors
13+
shell: bash
14+
run: |
15+
KEY=/opt/ssh_host_ed25519_key
16+
SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
17+
USER="root"
18+
HV1_IP="192.168.122.2"
19+
HV2_IP="192.168.122.3"
20+
21+
ssh $SSH_OPTS $USER@$HV1_IP "journalctl --no-pager" > "journal-HV1.log" || true
22+
scp $SSH_OPTS $USER@$HV1_IP:/var/log/libvirt/qemu/VM-QEMU.log "VM-QEMU-HV1.log" || true
23+
scp $SSH_OPTS $USER@$HV1_IP:/var/log/libvirt/ch/VM-CHV.log "VM-CHV-HV1.log" || true
24+
25+
ssh $SSH_OPTS $USER@$HV2_IP "journalctl --no-pager" > "journal-HV2.log" || true
26+
scp $SSH_OPTS $USER@$HV2_IP:/var/log/libvirt/qemu/VM-QEMU.log "VM-QEMU-HV2.log" || true
27+
scp $SSH_OPTS $USER@$HV2_IP:/var/log/libvirt/ch/VM-CHV.log "VM-CHV-HV2.log" || true
28+
29+
- name: Upload artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: debug-logs
33+
path: *.log
34+

.github/actions/test/integration/test/qemu/action.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -130,25 +130,3 @@ runs:
130130
sleep 10
131131
done
132132
EOF
133-
134-
- name: Clean up HyperVisors
135-
shell: bash
136-
run: |
137-
KEY=/opt/ssh_host_ed25519_key
138-
SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
139-
USER="root"
140-
IP_HV1="192.168.122.2"
141-
IP_HV2="192.168.122.3"
142-
143-
cleanup() {
144-
local IP="$1"
145-
ssh $SSH_OPTS "$USER@$IP" << EOF
146-
virsh destroy VM-QEMU || true
147-
virsh undefine VM-QEMU --nvram --tpm --remove-all-storage
148-
rm -f /var/lib/libvirt/images/ubuntu.qcow2
149-
rm -f /opt/vm-qemu.xml
150-
EOF
151-
}
152-
153-
cleanup "$IP_HV1"
154-
cleanup "$IP_HV2"

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ jobs:
4040
uses: ./.github/actions/test/integration/test/qemu
4141
- name: Test CloudHypervisor
4242
uses: ./.github/actions/test/integration/test/cloudhypervisor
43+
- name: Emergency Debugging
44+
if: failure()
45+
uses: ./.github/actions/test/integration/emergency-debugging

0 commit comments

Comments
 (0)