Skip to content

Commit 7afa25f

Browse files
committed
fix(ci): add in-rootfs agent verification and build logging
The agent binary verified after cargo build has vsock support, but the same binary inside the built rootfs does not. Add verification steps to catch this: log source/dest sizes during rootfs build, and mount the rootfs after build to verify the agent inside has vsock strings.
1 parent fc85d71 commit 7afa25f

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/build-images.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,22 @@ jobs:
7171
sudo make toolchain \
7272
TOOLCHAIN=${{ github.event.inputs.toolchain }}
7373
74+
- name: Verify agent inside rootfs has vsock
75+
run: |
76+
ROOTFS="images/output/ubuntu-22.04/${{ github.event.inputs.toolchain || 'base' }}/rootfs.ext4"
77+
MNT=$(mktemp -d)
78+
sudo mount -o loop,ro "$ROOTFS" "$MNT"
79+
AGENT="$MNT/usr/local/bin/sandchest-guest-agent"
80+
echo "Agent binary inside rootfs:"
81+
ls -la "$AGENT"
82+
VSOCK_COUNT=$(strings "$AGENT" | grep -c vsock || true)
83+
echo "vsock string count: $VSOCK_COUNT"
84+
sudo umount "$MNT" && rmdir "$MNT"
85+
if [ "$VSOCK_COUNT" -lt 10 ]; then
86+
echo "ERROR: agent binary inside rootfs is missing vsock support ($VSOCK_COUNT strings)"
87+
exit 1
88+
fi
89+
7490
- name: Validate image
7591
working-directory: images
7692
run: ./scripts/validate-image.sh --output output/ubuntu-22.04/${{ github.event.inputs.toolchain || 'base' }}

images/scripts/build-rootfs.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,11 @@ if [[ -n "$AGENT_BIN" ]]; then
159159
exit 1
160160
fi
161161
echo ">>> Installing guest agent..."
162+
echo " Source: $(ls -la "$AGENT_BIN")"
162163
cp "$AGENT_BIN" "${MOUNT_POINT}/usr/local/bin/sandchest-guest-agent"
163164
chmod +x "${MOUNT_POINT}/usr/local/bin/sandchest-guest-agent"
165+
echo " Installed: $(ls -la "${MOUNT_POINT}/usr/local/bin/sandchest-guest-agent")"
166+
echo " vsock strings: $(strings "${MOUNT_POINT}/usr/local/bin/sandchest-guest-agent" | grep -c vsock || echo 0)"
164167
else
165168
echo ">>> Skipping guest agent (no --agent-bin provided)"
166169
echo " Install manually: cp agent /usr/local/bin/sandchest-guest-agent"

0 commit comments

Comments
 (0)