CI: emit synthetic JUnit XML when rake task fails before tests run#5502
CI: emit synthetic JUnit XML when rake task fails before tests run#5502
Conversation
When a rake task fails before RSpec starts (wrong task name, missing gem, syntax error), no JUnit XML is produced for that task. CI artifacts then contain only results from other tasks in the batch, making the failure invisible through the normal JUnit pipeline. Write a synthetic JUnit XML with the rake error message so the failure shows up in JUnit artifact analysis without log parsing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thank you for updating Change log entry section 👏 Visited at: 2026-03-25 04:45:24 UTC |
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 44c14b8 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
BenchmarksBenchmark execution time: 2026-03-25 05:20:43 Comparing candidate commit 44c14b8 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 0 unstable metrics.
|
What does this PR do?
Wraps the
shcall inrun_batch_testswith a rescue block that writes a syntheticJUnit XML when a rake task fails before RSpec starts. The existing artifact upload step
picks it up — no changes needed to the upload or the
dd/junitmerge job.The original exception is re-raised, so the job still fails as before. This only adds
visibility.
Motivation:
I noticed that when a rake task in a CI batch fails before RSpec runs (wrong task name,
LoadError, syntax error), the JUnit artifacts from that batch only contain results from
the tasks that succeeded. The failing task produces no XML at all.
What caught my eye is that this makes the failure invisible to anything that relies on
JUnit — test failure analysis, Datadog CI Visibility — since the artifacts exist but
show 0 failures. The only way to find the actual error is log parsing.
Ran into this on PR #5111 where 8 jobs failed with "Don't know how to build task
`spec:di_with_ext`" but JUnit showed all green. The synthetic XML would have surfaced
the rake error directly in the structured data.
Change log entry
None
Additional Notes:
Not yet verified locally — `bundle exec rake standard` requires full gem setup.
CI will validate.
Worth noting: the synthetic XML uses the same directory (`tmp/rspec/`) and naming
convention as real JUnit output, so it flows through the existing pipeline without
any special handling.
How to test the change?
task, push, and confirm the synthetic XML appears in artifacts