Skip to content

Commit b4e993c

Browse files
cunningtclaude
andcommitted
Improve parse_errors.sh debugging output
Add clear START/END banners with timestamps and visual indicators to make it easier to trace parse_errors.sh execution in CI logs. Changes: - Add timestamp banners at start and end of script execution - Replace [DEBUG] prefix with cleaner [parse_errors.sh] prefix - Add visual indicators: ✓ ✗ ⊘ ⚠ for status - Use box-drawing characters for failure sections - Always show exit 0 with timestamp at end Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 3025df8 commit b4e993c

1 file changed

Lines changed: 35 additions & 35 deletions

File tree

.github/actions/incremental-build/parse_errors.sh

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,65 +21,67 @@ set +e
2121

2222
LOG_FILE=$1
2323

24-
echo "[DEBUG parse_errors.sh] Processing: $LOG_FILE" >&2
24+
echo "============================================================" >&2
25+
echo "[parse_errors.sh START] $(date '+%Y-%m-%d %H:%M:%S')" >&2
26+
echo "[parse_errors.sh] Processing: $LOG_FILE" >&2
27+
echo "============================================================" >&2
2528

2629
# Extract module path from log file path
2730
# e.g., ./components-starter/camel-slack-starter/target/surefire-reports/foo.txt -> components-starter/camel-slack-starter
2831
MODULE_PATH=$(echo "$LOG_FILE" | sed 's|^\./||' | sed 's|/target/.*||')
29-
echo "[DEBUG parse_errors.sh] Module path: $MODULE_PATH" >&2
32+
echo "[parse_errors.sh] Module: $MODULE_PATH" >&2
3033

3134
# Skip if file doesn't exist or is not readable
3235
if [[ ! -f "$LOG_FILE" ]]; then
33-
echo "[DEBUG parse_errors.sh] File does not exist: $LOG_FILE" >&2
36+
echo "[parse_errors.sh] ⊘ File does not exist, skipping" >&2
37+
echo "[parse_errors.sh END] $(date '+%Y-%m-%d %H:%M:%S') - exit 0" >&2
38+
echo "============================================================" >&2
3439
exit 0
3540
fi
3641

3742
if [[ ! -r "$LOG_FILE" ]]; then
38-
echo "[DEBUG parse_errors.sh] File is not readable: $LOG_FILE" >&2
43+
echo "[parse_errors.sh] ⊘ File not readable, skipping" >&2
44+
echo "[parse_errors.sh END] $(date '+%Y-%m-%d %H:%M:%S') - exit 0" >&2
45+
echo "============================================================" >&2
3946
exit 0
4047
fi
4148

42-
echo "[DEBUG parse_errors.sh] File exists and is readable, size: $(wc -c < "$LOG_FILE") bytes" >&2
49+
echo "[parse_errors.sh] File size: $(wc -c < "$LOG_FILE") bytes" >&2
4350

4451
# Extract failures/errors
45-
echo "[DEBUG parse_errors.sh] Searching for FAILURE|ERROR patterns..." >&2
52+
echo "[parse_errors.sh] Searching for FAILURE|ERROR patterns..." >&2
4653
raw_failures=$(cat "$LOG_FILE" | egrep "FAILURE|ERROR" 2>/dev/null || true)
4754
if [[ -z "$raw_failures" ]]; then
48-
echo "[DEBUG parse_errors.sh] No FAILURE or ERROR patterns found in file" >&2
55+
echo "[parse_errors.sh] ✓ No failures found" >&2
56+
echo "[parse_errors.sh END] $(date '+%Y-%m-%d %H:%M:%S') - exit 0" >&2
57+
echo "============================================================" >&2
4958
exit 0
5059
fi
5160

52-
echo "[DEBUG parse_errors.sh] Found FAILURE/ERROR entries (count: $(echo "$raw_failures" | wc -l))" >&2
53-
echo "[DEBUG parse_errors.sh] First few lines of raw_failures:" >&2
61+
echo "[parse_errors.sh] Found FAILURE/ERROR entries: $(echo "$raw_failures" | wc -l)" >&2
62+
echo "[parse_errors.sh] First 5 lines:" >&2
5463
echo "$raw_failures" | head -5 >&2
5564

5665
# Look for "Time elapsed" entries and extract org.* test names
57-
echo "[DEBUG parse_errors.sh] Searching for 'Time elapsed' entries..." >&2
5866
time_elapsed_entries=$(echo "$raw_failures" | grep "Time elapsed" 2>/dev/null || true)
59-
echo "[DEBUG parse_errors.sh] Time elapsed entries found: $(echo "$time_elapsed_entries" | wc -l)" >&2
67+
echo "[parse_errors.sh] Time elapsed entries: $(echo "$time_elapsed_entries" | wc -l)" >&2
6068

61-
echo "[DEBUG parse_errors.sh] Searching for org.* entries..." >&2
6269
org_entries=$(echo "$time_elapsed_entries" | egrep "^org" 2>/dev/null || true)
63-
echo "[DEBUG parse_errors.sh] org.* entries found: $(echo "$org_entries" | wc -l)" >&2
70+
echo "[parse_errors.sh] org.* test entries: $(echo "$org_entries" | wc -l)" >&2
6471

6572
if [[ -n "$org_entries" ]]; then
66-
echo "[DEBUG parse_errors.sh] Processing org_entries:" >&2
73+
echo "[parse_errors.sh] Processing failures:" >&2
6774
echo "$org_entries" >&2
6875

6976
# Generate summary with module path included in test name
7077
# Format: | Module::TestClass | Duration | Type |
71-
echo "[DEBUG parse_errors.sh] Generating failed_summary..." >&2
7278
failed_summary=$(echo "$org_entries" | sed 's/\!//g' | awk -v mod="$MODULE_PATH" -F ' ' '{printf "| **%s**::%s | %s%s | %s |\n", mod, $1,$5,$6, $8}' 2>/dev/null || true)
73-
echo "[DEBUG parse_errors.sh] failed_summary generated (length: ${#failed_summary})" >&2
7479

7580
if [[ -n "$failed_summary" ]]; then
76-
echo "[DEBUG parse_errors.sh] failed_summary is not empty" >&2
77-
7881
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
79-
echo "[DEBUG parse_errors.sh] GITHUB_STEP_SUMMARY is set to: $GITHUB_STEP_SUMMARY" >&2
82+
echo "[parse_errors.sh] Writing to GITHUB_STEP_SUMMARY" >&2
8083

8184
# Add to GitHub step summary
82-
echo "[DEBUG parse_errors.sh] Writing summary to GITHUB_STEP_SUMMARY..." >&2
8385
echo "$failed_summary" >> "$GITHUB_STEP_SUMMARY" 2>/dev/null || true
8486

8587
# Add detailed error output
@@ -91,40 +93,38 @@ if [[ -n "$org_entries" ]]; then
9193
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY" 2>/dev/null || true
9294
echo "</details>" >> "$GITHUB_STEP_SUMMARY" 2>/dev/null || true
9395
echo "" >> "$GITHUB_STEP_SUMMARY" 2>/dev/null || true
94-
echo "[DEBUG parse_errors.sh] Summary written to GITHUB_STEP_SUMMARY" >&2
9596
else
96-
echo "[DEBUG parse_errors.sh] GITHUB_STEP_SUMMARY is not set, skipping summary output" >&2
97+
echo "[parse_errors.sh] GITHUB_STEP_SUMMARY not set, cannot write summary" >&2
9798
fi
98-
else
99-
echo "[DEBUG parse_errors.sh] failed_summary is empty, skipping summary generation" >&2
10099
fi
101100

102101
# Output to stderr for CI logs
103102
echo "" >&2
104-
echo "=============================================" >&2
105-
echo "FAILURE in module: $MODULE_PATH" >&2
106-
echo "=============================================" >&2
103+
echo "╔═════════════════════════════════════════════╗" >&2
104+
echo "FAILURE in module: $MODULE_PATH" >&2
105+
echo "╚═════════════════════════════════════════════╝" >&2
107106
echo "$org_entries" >&2
108107
echo "" >&2
109108
echo "Full error details:" >&2
110109
cat "$LOG_FILE" | egrep -A 10 "FAILURE|ERROR" | head -50 >&2
111-
echo "=============================================" >&2
110+
echo "╚═════════════════════════════════════════════╝" >&2
112111
echo "" >&2
113112
else
114-
echo "[DEBUG parse_errors.sh] No org.* entries found, but raw_failures exist" >&2
115-
echo "[DEBUG parse_errors.sh] Outputting raw_failures to help debug:" >&2
113+
echo "[parse_errors.sh] ⚠ No org.* pattern match (unusual format)" >&2
116114
echo "" >&2
117-
echo "=============================================" >&2
118-
echo "FAILURE/ERROR in module: $MODULE_PATH (no org.* pattern match)" >&2
119-
echo "=============================================" >&2
115+
echo "╔═════════════════════════════════════════════╗" >&2
116+
echo "ERROR in module: $MODULE_PATH (unusual format)" >&2
117+
echo "╚═════════════════════════════════════════════╝" >&2
120118
echo "Raw failures found:" >&2
121119
echo "$raw_failures" | head -20 >&2
122120
echo "" >&2
123121
echo "Full log file content (first 100 lines):" >&2
124122
head -100 "$LOG_FILE" >&2
125-
echo "=============================================" >&2
123+
echo "╚═════════════════════════════════════════════╝" >&2
126124
echo "" >&2
127125
fi
128126

129-
echo "[DEBUG parse_errors.sh] Finished processing $LOG_FILE" >&2
127+
echo "============================================================" >&2
128+
echo "[parse_errors.sh END] $(date '+%Y-%m-%d %H:%M:%S') - exit 0" >&2
129+
echo "============================================================" >&2
130130
exit 0

0 commit comments

Comments
 (0)