From 96cfbf464ff6ee5db28adbcee101ebb6038c4718 Mon Sep 17 00:00:00 2001 From: nanxun Date: Fri, 8 May 2026 20:25:05 +0800 Subject: [PATCH] fix: surface buildx errors in jenkins heartbeat --- Jenkinsfile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0896d63..16cf762 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 \