jenkinsci / parallel-test-executor-plugin

Parallel test executor plugin
https://plugins.jenkins.io/parallel-test-executor/
50 stars 55 forks source link

Defending against corrupt builds #282

Closed Vlatombe closed 5 months ago

Vlatombe commented 5 months ago

I've seen some builds failing during splitTests execution with an exception like

java.lang.NullPointerException: Cannot invoke "hudson.model.Run.getRootDir()" because "this.run" is null
    at hudson.tasks.junit.TestResultAction.getDataFile(TestResultAction.java:139)
    at hudson.tasks.junit.TestResultAction.load(TestResultAction.java:233)
    at hudson.tasks.junit.TestResultAction.getResult(TestResultAction.java:150)
    at hudson.tasks.junit.TestResultAction.getResult(TestResultAction.java:66)
    at org.jenkinsci.plugins.parallel_test_executor.ParallelTestExecutor.getTestResult(ParallelTestExecutor.java:372)
    at org.jenkinsci.plugins.parallel_test_executor.ParallelTestExecutor.findPreviousTestResult(ParallelTestExecutor.java:349)
    at org.jenkinsci.plugins.parallel_test_executor.ParallelTestExecutor.findTestSplits(ParallelTestExecutor.java:196)
    at org.jenkinsci.plugins.parallel_test_executor.SplitStep$Execution.run(SplitStep.java:139)
    at org.jenkinsci.plugins.parallel_test_executor.SplitStep$Execution.run(SplitStep.java:116)
    at org.jenkinsci.plugins.workflow.steps.SynchronousStepExecution.start(SynchronousStepExecution.java:37)
[...]

There may be a bug in the JUnit plugin, or some problem with pipeline persistence that causes it to load the build partially corrupted. In any case, the plugin should defend itself against such state and skip such build.

I don't know how to recreate such a broken run state, so no added test for now.

Testing done

### Submitter checklist
- [ ] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [ ] Ensure that the pull request title represents the desired changelog entry
- [ ] Please describe what you did
- [ ] Link to relevant issues in GitHub or Jira
- [ ] Link to relevant pull requests, esp. upstream and downstream changes
- [ ] Ensure you have provided tests - that demonstrates feature works or fixes the issue