Skip to content
Permalink
Browse files
[JENKINS-27395] temporarily disable bump to the jenkins-junit-pipelin…
…e 1.23 due to additional dependencies.
  • Loading branch information
Cyrille Le Clerc committed Feb 20, 2018
1 parent 7224db1 commit 31c1156f199515f907154938ed8e3bf5a14431c8
@@ -76,7 +76,10 @@
<jenkins.version>2.46.3</jenkins.version>
<scm-api-plugin.version>2.1.1</scm-api-plugin.version>
<git-plugin.version>3.3.0</git-plugin.version>
<junit-plugin.version>1.23</junit-plugin.version>
<!--
stick to junit 1.20 clarifying the impact of the introduction of the dependencies
workflow-step-api or workflow-api-->
<junit-plugin.version>1.20</junit-plugin.version>
<java.level>7</java.level>
</properties>
<dependencies>
@@ -150,13 +153,15 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!--
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>${junit-plugin.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
-->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit-attachments</artifactId>
@@ -27,15 +27,11 @@
import hudson.Extension;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.Result;
import hudson.model.Run;
import hudson.model.StreamBuildListener;
import hudson.model.TaskListener;
import hudson.tasks.junit.JUnitResultArchiver;
import hudson.tasks.junit.TestDataPublisher;
import hudson.tasks.junit.TestResultAction;
import hudson.tasks.junit.pipeline.JUnitResultsStepExecution;
import hudson.tasks.test.PipelineTestDetails;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.pipeline.maven.MavenArtifact;
import org.jenkinsci.plugins.pipeline.maven.MavenSpyLogProcessor;
@@ -59,8 +55,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import static hudson.tasks.junit.pipeline.JUnitResultsStepExecution.getEnclosingStagesAndParallels;

/**
* @author <a href="mailto:cleclerc@cloudbees.com">Cyrille Le Clerc</a>
*/
@@ -204,8 +198,11 @@ private void executeReporter(StepContext context, TaskListener listener, List<El
return;
}

/*
See commented code below: JUnitResultArchiver.parseAndAttach(...)
FlowNode node = context.get(FlowNode.class);
String nodeId = node.getId();
*/

for (Element testEvent : testEvents) {
String surefireEventType = testEvent.getAttribute("type");
@@ -277,21 +274,26 @@ private void executeReporter(StepContext context, TaskListener listener, List<El
}

try {
archiver.perform(run, workspace, launcher, listener);
/*
TODO replace "archiver.perform(run, workspace, launcher, listener)" by the code below when we can bump the junit-plugin to version 1.23+
List<FlowNode> enclosingBlocks = JUnitResultsStepExecution.getEnclosingStagesAndParallels(node);
PipelineTestDetails pipelineTestDetails = new PipelineTestDetails();
pipelineTestDetails.setNodeId(nodeId);
pipelineTestDetails.setEnclosingBlocks(JUnitResultsStepExecution.getEnclosingBlockIds(enclosingBlocks));
pipelineTestDetails.setEnclosingBlockNames(JUnitResultsStepExecution.getEnclosingBlockNames(enclosingBlocks));
TestResultAction testResultAction = JUnitResultArchiver.parseAndAttach(archiver, pipelineTestDetails,
run, workspace, launcher, listener);
run, workspace, launcher, listener);JunitTestsPublisher
if (testResultAction != null) {
// TODO: Once JENKINS-43995 lands, update this to set the step status instead of the entire build.
if (testResultAction.getResult().getFailCount() > 0) {
context.setResult(Result.UNSTABLE);
}
}
*/
} catch (Exception e) {
listener.error("[withMaven] junitPublisher - Silently ignore exception archiving JUnit results for Maven artifact " + mavenArtifact.toString() + " generated by " + pluginInvocation + ": " + e);
LOGGER.log(Level.WARNING, "Exception processing " + XmlUtils.toString(testEvent), e);
@@ -42,7 +42,6 @@
import hudson.model.Result;
import hudson.plugins.tasks.TasksResultAction;
import hudson.tasks.Fingerprinter;
import hudson.tasks.junit.pipeline.JUnitResultsStepTest;
import hudson.tasks.junit.TestResultAction;
import jenkins.mvn.FilePathGlobalSettingsProvider;
import jenkins.mvn.FilePathSettingsProvider;
@@ -965,10 +964,13 @@ public void maven_build_test_results_by_stage_and_branch() throws Exception {
assertThat(testResultAction.getTotalCount(), is(6));
assertThat(testResultAction.getFailCount(), is(0));

/*
TODO enable test below when we can bump the junit-plugin to version 1.23+
JUnitResultsStepTest.assertStageResults(build, 4, 6, "first");
JUnitResultsStepTest.assertBranchResults(build, 2, 3, "a", "first");
JUnitResultsStepTest.assertBranchResults(build, 2, 3, "b", "first");
*/
}

}

0 comments on commit 31c1156

Please sign in to comment.