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 \