Skip to content

Commit

Permalink
Inline extension point
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlatombe committed Jan 16, 2023
1 parent 1460e90 commit 21b93f9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import hudson.tasks.test.AbstractTestResultAction;
import hudson.tasks.test.TabulatedResult;
import hudson.tasks.test.TestResult;
import jenkins.scm.api.SCMHead;
import jenkins.scm.api.mixin.ChangeRequestSCMHead;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.workflow.actions.LabelAction;
import org.jenkinsci.plugins.workflow.flow.FlowExecution;
Expand Down Expand Up @@ -345,22 +347,22 @@ static private void collect(TestResult r, Map<String, TestClass> data) {
}

private static TestResult findPreviousTestResult(Run<?, ?> b, TaskListener listener) {
TestResult result = getTestResult(b.getParent(), b, listener);
Job<?, ?> project = b.getParent();
TestResult result = getTestResult(project, b, listener);
if (result == null) {
for (PreviousBuildFinder pbf : ExtensionList.lookup(PreviousBuildFinder.class)) {
Run<?, ?> otherBuild = pbf.find(b, listener);
if (otherBuild == null) {
continue;
}
result = getTestResult(b.getParent(), otherBuild, listener);
if (result != null) {
break;
SCMHead head = SCMHead.HeadByItem.findHead(project);
if (head instanceof ChangeRequestSCMHead) {
SCMHead target = ((ChangeRequestSCMHead) head).getTarget();
Item targetBranch = project.getParent().getItem(target.getName());
if (targetBranch != null && targetBranch instanceof Job) {
result = getTestResult(project, ((Job<?, ?>) targetBranch).getLastBuild(), listener);
}
}
}
return result;
}


private static TestResult getTestResult(Job<?, ?> originProject, Run<?, ?> b, TaskListener listener) {
TestResult result = null;
for (int i = 0; i < NUMBER_OF_BUILDS_TO_SEARCH; i++) {// limit the search to a small number to avoid loading too much
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 21b93f9

Please sign in to comment.