Add centralized pipeline results JSON storage (Issue #4)
Creates /pipeline-results/ directory and writes a structured JSON file after each CI run (before notification), capturing branch, commit, actor, timestamp, result, test counts, features, duration, and tags. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
75dd4ee6dc
commit
e0a440232a
33
ci-runner.sh
33
ci-runner.sh
@ -266,6 +266,39 @@ print(f'Report written to $REPORT_FILE')
|
|||||||
echo "Failure report: $REPORT_FILE"
|
echo "Failure report: $REPORT_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ─── Write Pipeline Result JSON ───
|
||||||
|
RESULTS_DIR="$SCRIPT_DIR/pipeline-results"
|
||||||
|
RESULT_TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
RESULT_FILENAME=$(date -u +%Y-%m-%d_%H%M%S)_${BRANCH}.json
|
||||||
|
RESULT_FILE="$RESULTS_DIR/$RESULT_FILENAME"
|
||||||
|
mkdir -p "$RESULTS_DIR"
|
||||||
|
python3 -c "
|
||||||
|
import json, sys
|
||||||
|
|
||||||
|
result = {
|
||||||
|
'branch': '$BRANCH',
|
||||||
|
'commit': '$COMMIT',
|
||||||
|
'actor': '$ACTOR',
|
||||||
|
'timestamp': '$RESULT_TIMESTAMP',
|
||||||
|
'result': '$OVERALL',
|
||||||
|
'tests': {
|
||||||
|
'passed': int('$PASS_COUNT' or 0),
|
||||||
|
'failed': int('$FAIL_COUNT' or 0),
|
||||||
|
'skipped': int('$SKIP_COUNT' or 0),
|
||||||
|
'deselected': int('$DESELECTED_COUNT' or 0),
|
||||||
|
'errors': int('$ERROR_COUNT' or 0),
|
||||||
|
},
|
||||||
|
'features': '$FEATURES_RESULT',
|
||||||
|
'duration_seconds': int('$DURATION' or 0),
|
||||||
|
'tags_tested': '$TAGS_USED',
|
||||||
|
'trigger_source': '$ACTOR',
|
||||||
|
}
|
||||||
|
|
||||||
|
with open('$RESULT_FILE', 'w') as f:
|
||||||
|
json.dump(result, f, indent=2)
|
||||||
|
print(f'Pipeline result written: $RESULT_FILE')
|
||||||
|
" 2>&1
|
||||||
|
|
||||||
# ─── Send Notification ───
|
# ─── Send Notification ───
|
||||||
bash "$SCRIPT_DIR/ci-notify.sh" \
|
bash "$SCRIPT_DIR/ci-notify.sh" \
|
||||||
"$BRANCH" "$COMMIT" "$OVERALL" "$SUMMARY" "$FEATURES_RESULT" "${DURATION}s" "$ACTOR" "$REPORT_FILE" "$SUITE_INFO"
|
"$BRANCH" "$COMMIT" "$OVERALL" "$SUMMARY" "$FEATURES_RESULT" "${DURATION}s" "$ACTOR" "$REPORT_FILE" "$SUITE_INFO"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user