Skip to content

Commit a0cdfd0

Browse files
pRizzclaude
andcommitted
fix(ci): fix systemd smoke test for cgroups v2
GitHub Actions runners use cgroups v2 which requires: - --cgroupns=host for systemd to access cgroup hierarchy - :rw cgroup mount (not :ro) for systemd to manage cgroups Also adds better debugging: - Check if container exits unexpectedly - Show container status on failure - Attempt systemctl status inside container - Increase timeout to 90s for systemd boot time Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e68931f commit a0cdfd0

1 file changed

Lines changed: 28 additions & 6 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,37 @@ jobs:
6969
- name: Smoke test - verify container starts and becomes healthy
7070
run: |
7171
echo "Starting container for smoke test..."
72+
# Note: systemd in containers requires:
73+
# - --privileged OR specific capabilities
74+
# - --cgroupns=host for cgroups v2 (GitHub Actions runners)
75+
# - rw cgroup mount for systemd to manage cgroups
7276
docker run -d \
7377
--name smoke-test \
7478
--privileged \
75-
--cap-add SYS_ADMIN \
79+
--cgroupns=host \
7680
--tmpfs /run \
7781
--tmpfs /tmp \
78-
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
82+
-v /sys/fs/cgroup:/sys/fs/cgroup:rw \
7983
-p 3000:3000 \
8084
-e USE_SYSTEMD=1 \
8185
${{ env.IMAGE_NAME_GHCR }}:test
8286
83-
echo "Waiting for container to become healthy (max 60 seconds)..."
84-
for i in {1..60}; do
87+
echo "Container started, checking status..."
88+
docker ps -a --filter name=smoke-test
89+
90+
echo "Waiting for container to become healthy (max 90 seconds)..."
91+
for i in {1..90}; do
92+
# Check if container is still running
93+
if ! docker ps --filter name=smoke-test --filter status=running -q | grep -q .; then
94+
echo "✗ Container exited unexpectedly"
95+
echo "Container status:"
96+
docker ps -a --filter name=smoke-test
97+
echo "Container logs:"
98+
docker logs smoke-test 2>&1 || echo "(no logs)"
99+
docker rm smoke-test || true
100+
exit 1
101+
fi
102+
85103
if curl -sf http://localhost:3000/health > /dev/null 2>&1; then
86104
echo "✓ Container is healthy after ${i} seconds"
87105
docker logs smoke-test --tail 20
@@ -92,9 +110,13 @@ jobs:
92110
sleep 1
93111
done
94112
95-
echo "✗ Container failed to become healthy within 60 seconds"
113+
echo "✗ Container failed to become healthy within 90 seconds"
114+
echo "Container status:"
115+
docker ps -a --filter name=smoke-test
96116
echo "Container logs:"
97-
docker logs smoke-test
117+
docker logs smoke-test 2>&1 || echo "(no logs)"
118+
echo "Checking systemd status inside container:"
119+
docker exec smoke-test systemctl status || echo "(systemctl failed)"
98120
docker stop smoke-test || true
99121
docker rm smoke-test || true
100122
exit 1

0 commit comments

Comments
 (0)