@cyanautomation/kaseki-agent 1.22.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/kaseki-agent.sh +20 -2
- package/package.json +1 -1
package/kaseki-agent.sh
CHANGED
|
@@ -47,6 +47,8 @@ VALIDATION_FAILED_COMMAND_DETAIL=""
|
|
|
47
47
|
VALIDATION_FAILURE_REASON=""
|
|
48
48
|
VALIDATION_STOPPED_EARLY=false
|
|
49
49
|
VALIDATION_COMMANDS_ATTEMPTED=0
|
|
50
|
+
FILTER_STDERR_TAIL=""
|
|
51
|
+
FILTER_STDERR_FILE="/tmp/kaseki-filter-stderr.log"
|
|
50
52
|
DIFF_NONEMPTY=false
|
|
51
53
|
QUALITY_EXIT=0
|
|
52
54
|
QUALITY_FAILURE_REASON=""
|
|
@@ -373,6 +375,8 @@ write_metadata() {
|
|
|
373
375
|
"github_api_error_type": $(printf '%s' "$GITHUB_API_ERROR_TYPE" | json_encode),
|
|
374
376
|
"github_api_error_message": $(printf '%s' "$GITHUB_API_ERROR_MESSAGE" | json_encode),
|
|
375
377
|
"github_api_http_status": $(printf '%s' "$GITHUB_API_HTTP_STATUS" | json_encode),
|
|
378
|
+
"validation_filter_stderr_tail": $(printf '%s' "$FILTER_STDERR_TAIL" | json_encode),
|
|
379
|
+
"validation_filter_exit_code": 0,
|
|
376
380
|
"node_version": $(node --version 2>/dev/null | json_encode || printf 'null'),
|
|
377
381
|
"npm_version": $(npm --version 2>/dev/null | json_encode || printf 'null'),
|
|
378
382
|
"pi_version": $(printf '%s' "$PI_VERSION" | json_encode)
|
|
@@ -2267,7 +2271,7 @@ else
|
|
|
2267
2271
|
command_exit=$?
|
|
2268
2272
|
printf 'exit_code=%s\n' "$command_exit"
|
|
2269
2273
|
exit "$command_exit"
|
|
2270
|
-
} 2>&1 | tee -a /results/validation.log | validation-output-filter
|
|
2274
|
+
} 2>&1 | tee -a /results/validation.log | validation-output-filter 2>>"$FILTER_STDERR_FILE"
|
|
2271
2275
|
pipe_statuses=("${PIPESTATUS[@]}")
|
|
2272
2276
|
set +o pipefail
|
|
2273
2277
|
# pipe_statuses[0] = bash command exit code
|
|
@@ -2280,6 +2284,16 @@ else
|
|
|
2280
2284
|
printf '%s\t%s\t%s\n' "$trimmed" "$command_exit" "$duration" >> "$VALIDATION_TIMINGS_FILE"
|
|
2281
2285
|
emit_event "validation_command_finished" "command=$trimmed" "exit_code=$command_exit" "filter_exit_code=$filter_exit" "duration_seconds=$duration"
|
|
2282
2286
|
|
|
2287
|
+
# Capture and process filter stderr for diagnostics
|
|
2288
|
+
if [ -f "$FILTER_STDERR_FILE" ] && [ -s "$FILTER_STDERR_FILE" ]; then
|
|
2289
|
+
FILTER_STDERR_TAIL="$(tail -50 "$FILTER_STDERR_FILE" 2>/dev/null || echo '<failed to read filter stderr>')"
|
|
2290
|
+
{
|
|
2291
|
+
printf '\n[DIAGNOSTICS] Validation output filter stderr (last 50 lines):\n'
|
|
2292
|
+
printf '%s\n' "$FILTER_STDERR_TAIL"
|
|
2293
|
+
} | tee -a /results/validation.log /results/quality.log
|
|
2294
|
+
rm -f "$FILTER_STDERR_FILE"
|
|
2295
|
+
fi
|
|
2296
|
+
|
|
2283
2297
|
# Detect and handle SIGPIPE errors (exit code 141 = 128 + 13)
|
|
2284
2298
|
if [ "$command_exit" -eq 141 ] && [ "$filter_exit" -ne 0 ]; then
|
|
2285
2299
|
{
|
|
@@ -2287,7 +2301,11 @@ else
|
|
|
2287
2301
|
printf ' Command exit code: 141 (SIGPIPE)\n'
|
|
2288
2302
|
printf ' Filter exit code: %s\n' "$filter_exit"
|
|
2289
2303
|
printf ' This typically indicates the validation-output-filter process encountered an error.\n'
|
|
2290
|
-
|
|
2304
|
+
if [ -n "$FILTER_STDERR_TAIL" ]; then
|
|
2305
|
+
printf ' Filter stderr was captured above.\n'
|
|
2306
|
+
else
|
|
2307
|
+
printf ' (No stderr captured from filter)\n'
|
|
2308
|
+
fi
|
|
2291
2309
|
} | tee -a /results/quality.log
|
|
2292
2310
|
fi
|
|
2293
2311
|
|
package/package.json
CHANGED