Browse code

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>

Albin Kerouanton authored on 2025/08/27 04:15:02
Showing 1 changed files
... ...
@@ -83,6 +83,25 @@ EOF
83 83
 ExecStart=
84 84
 ExecStart=/usr/sbin/firewalld --nofork --nopid --debug=4
85 85
 EOF
86
+
87
+	# Copy firewalld logs into the bundles/ folder on shutdown to let the CI
88
+	# include it in jobs reports.
89
+	cat > /etc/systemd/system/collect-firewalld-logs.service << EOF
90
+[Unit]
91
+Description=Collect firewalld logs on shutdown
92
+After=firewalld.service
93
+
94
+[Service]
95
+Type=oneshot
96
+ExecStart=/bin/true
97
+RemainAfterExit=true
98
+ExecStop=cp /var/log/firewalld /go/src/github.com/docker/docker/bundles/firewalld.log
99
+
100
+[Install]
101
+WantedBy=firewalld.service
102
+EOF
103
+
104
+	systemctl enable collect-firewalld-logs.service
86 105
 fi
87 106
 
88 107
 env > /etc/docker-entrypoint-env