hack/dind-systemd: collect firewalld logs

Add a systemd service 'collect-firewalld-logs.service' that copies
firewalld log file into bundles/ on container shutdown. This won't
provide much value for developers who run `make shell`, but it'll be
useful on CI to include firewalld logs in the exported artifacts.

The CI is already configured to pick every *.log file from bundles/, so
no further change is needed on that side.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
Albin Kerouanton
2025-08-26 21:15:02 +02:00
parent 03df89b84a
commit 5682f65cca

View File

@@ -83,6 +83,25 @@ EOF
ExecStart=
ExecStart=/usr/sbin/firewalld --nofork --nopid --debug=4
EOF
# Copy firewalld logs into the bundles/ folder on shutdown to let the CI
# include it in jobs reports.
cat > /etc/systemd/system/collect-firewalld-logs.service << EOF
[Unit]
Description=Collect firewalld logs on shutdown
After=firewalld.service
[Service]
Type=oneshot
ExecStart=/bin/true
RemainAfterExit=true
ExecStop=cp /var/log/firewalld /go/src/github.com/docker/docker/bundles/firewalld.log
[Install]
WantedBy=firewalld.service
EOF
systemctl enable collect-firewalld-logs.service
fi
env > /etc/docker-entrypoint-env