fix: surface buildx errors in jenkins heartbeat

This commit is contained in:
2026-05-08 20:25:05 +08:00
parent cc37d90d92
commit 96cfbf464f
Vendored
+12 -2
View File
@@ -85,6 +85,7 @@ pipeline {
"\$@" >"\$log_file" 2>&1 &
cmd_pid=\$!
last_line=0
cmd_status=0
while kill -0 "\$cmd_pid" >/dev/null 2>&1; do
if [ -f "\$log_file" ]; then
total_lines=\$(wc -l < "\$log_file" || echo 0)
@@ -99,13 +100,17 @@ pipeline {
fi
sleep 20
done
wait "\$cmd_pid"
wait "\$cmd_pid" || cmd_status=\$?
if [ -f "\$log_file" ]; then
total_lines=\$(wc -l < "\$log_file" || echo 0)
if [ "\$total_lines" -gt "\$last_line" ]; then
sed -n "\$((last_line + 1)),\${total_lines}p" "\$log_file"
fi
fi
if [ "\$cmd_status" -ne 0 ]; then
echo "[heartbeat] API multi-arch build failed with exit code \$cmd_status"
fi
return "\$cmd_status"
}
if ! sudo docker buildx inspect --builder ${BUILDER_NAME} >/dev/null 2>&1; then
sudo docker buildx create \
@@ -156,6 +161,7 @@ pipeline {
"\$@" >"\$log_file" 2>&1 &
cmd_pid=\$!
last_line=0
cmd_status=0
while kill -0 "\$cmd_pid" >/dev/null 2>&1; do
if [ -f "\$log_file" ]; then
total_lines=\$(wc -l < "\$log_file" || echo 0)
@@ -170,13 +176,17 @@ pipeline {
fi
sleep 20
done
wait "\$cmd_pid"
wait "\$cmd_pid" || cmd_status=\$?
if [ -f "\$log_file" ]; then
total_lines=\$(wc -l < "\$log_file" || echo 0)
if [ "\$total_lines" -gt "\$last_line" ]; then
sed -n "\$((last_line + 1)),\${total_lines}p" "\$log_file"
fi
fi
if [ "\$cmd_status" -ne 0 ]; then
echo "[heartbeat] Web multi-arch build failed with exit code \$cmd_status"
fi
return "\$cmd_status"
}
if ! sudo docker buildx inspect --builder ${BUILDER_NAME} >/dev/null 2>&1; then
sudo docker buildx create \