-
Notifications
You must be signed in to change notification settings - Fork 198
Ingest CI test execution stats #4191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pfcoperez
merged 13 commits into
main
from
DBI-671/test/o11y/store-peerdb-ci-test-results-for-flake-analysis
Apr 20, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ae86adc
First version of the test results normalization script
pfcoperez 36f5954
Working extraction script
pfcoperez 97f2aa9
Step to ingest test results
pfcoperez b14ecec
PR Comments: Fix comments typos
pfcoperez 399e9eb
PR Comments: Fix comments typos II
pfcoperez 40affbc
Retry number is intended to be the number of attempts
pfcoperez c5a56e8
Add commit SHA
pfcoperez 41840f6
Fail at workflow ingestion step on missing mandatory fields
pfcoperez 01fd1fc
No need to use tee in append mode, it is safer to overwrite possible …
pfcoperez 685daa7
Add retry logic for SQL endpoint: Success when server returns with st…
pfcoperez 86f23b0
zc
pfcoperez 68f9d6e
Update script comments
pfcoperez c364877
Change steps order to avoid disruptions.
pfcoperez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -eo pipefail # For jq to propagate yq failures. | ||
|
|
||
| # This script processes the XML tests results and outputs a NDJSON stream with one document per test execution. | ||
| # Hence, each document corresponds to a testcase entry in the XML. It contains the following fields: | ||
| # | ||
| # - 'timestamp': As the testsuite (parent of the entry) timestamp field. | ||
| # - 'suite_name': As the entry class name. | ||
| # - 'test': As the entry name. | ||
| # - 'result': success/failure/skipped from the optional child node of the entry. No child node means success. | ||
| # - 'reason': As the entry child (skipped or failure) contents. For example, in the source, <failure>SOURCE FOR REASON</failure>. | ||
| # - 'duration_seconds': As the time field of the entry. | ||
| # - 'workflow_run_id': As the content of the environment variable 'WORKFLOW_RUN_ID' | ||
| # - 'workflow_run_link': As the content of the environment variable 'WORKFLOW_RUN_LINK' | ||
| # - 'workflow_head_branch': As the content of the environment variable 'WORKFLOW_HEAD_BRANCH' | ||
| # - 'workflow_retry_number': As the content of the environment variable 'WORKFLOW_RUN_NUMBER' | ||
| # - 'commit_sha': As the content of the environment variable 'COMMIT_SHA' | ||
| # | ||
| # INPUT: | ||
| # - The XML file(s) to process. For example, the test results generated by JUnit in the 'target/surefire-reports' directory. | ||
| # - The following environment variables to enrich with the workflow information: | ||
| # - WORKFLOW_RUN_ID | ||
| # - WORKFLOW_RUN_LINK | ||
| # - WORKFLOW_HEAD_BRANCH | ||
| # - WORKFLOW_RUN_NUMBER | ||
| # - COMMIT_SHA | ||
| # | ||
| # OUTPUT: NDJSON stream through stdout. | ||
| # | ||
| yq -p=xml -o=json \ | ||
| ' | ||
| ((.testsuites.testsuite | select(kind == "seq") | .[]), (.testsuites.testsuite | select(kind == "map"))) | | ||
| ."+@timestamp" as $ts | | ||
| select(has("testcase")) | | ||
| ((.testcase | select(kind == "seq") | .[]), (.testcase | select(kind == "map"))) | | ||
| { | ||
| "timestamp": $ts, | ||
| "suite_name": ."+@classname", | ||
| "test": ."+@name", | ||
| "result": ((keys | map(select(. == "failure" or . == "skipped")) | .[0]) // "success"), | ||
| "reason": ((.failure."+content" // .skipped."+@message") // null), | ||
| "duration_seconds": (."+@time" | select(. != "") | tonumber // null), | ||
| "workflow_run_id": (strenv(WORKFLOW_RUN_ID) | tonumber), | ||
| "workflow_run_link": strenv(WORKFLOW_RUN_LINK), | ||
| "workflow_head_branch": strenv(WORKFLOW_HEAD_BRANCH), | ||
| "workflow_retry_number": (strenv(WORKFLOW_RUN_NUMBER) | tonumber), | ||
| "commit_sha": strenv(COMMIT_SHA) | ||
| } | | ||
| select(.suite_name != null) | ||
| ' \ | ||
| "$@" \ | ||
| | jq -c . # jq for compacting the output to NDJSON. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.