fix: preserve buildx logs on pipeline failure
This commit is contained in:
Vendored
+8
@@ -95,13 +95,21 @@ pipeline {
|
||||
fi
|
||||
sleep 20
|
||||
done
|
||||
set +e
|
||||
wait "$cmd_pid"
|
||||
cmd_status=$?
|
||||
set -e
|
||||
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
|
||||
if [ "$cmd_status" -ne 0 ] && [ -s "$log_file" ]; then
|
||||
echo "[captured-log] Full buildx log follows because the command failed:"
|
||||
cat "$log_file"
|
||||
fi
|
||||
fi
|
||||
return "$cmd_status"
|
||||
}
|
||||
|
||||
if ! sudo docker buildx inspect --builder ${BUILDER_NAME} >/dev/null 2>&1; then
|
||||
|
||||
Reference in New Issue
Block a user