Skip to content

Commit

Permalink
[JENKINS-46609] Show warning message when a maven execution has been …
Browse files Browse the repository at this point in the history
…interrupted and the Maven soy report is still a .tmp file
  • Loading branch information
Cyrille Le Clerc committed Sep 11, 2017
1 parent edc06d5 commit 7d10dd7
Showing 1 changed file with 14 additions and 1 deletion.
Expand Up @@ -30,7 +30,6 @@
import hudson.model.TaskListener;
import jenkins.model.InterruptedBuildAction;
import org.apache.commons.lang.StringUtils;
import org.eclipse.aether.artifact.Artifact;
import org.jenkinsci.plugins.pipeline.maven.publishers.JenkinsMavenEventSpyLogsPublisher;
import org.jenkinsci.plugins.workflow.steps.StepContext;
import org.w3c.dom.Element;
Expand Down Expand Up @@ -117,6 +116,7 @@ public void processMavenSpyLogs(StepContext context, FilePath mavenSpyLogFolder,
}
}
}

} catch (SAXException e) {
Run run = context.get(Run.class);
if (run.getActions(InterruptedBuildAction.class).isEmpty()) {
Expand All @@ -133,6 +133,19 @@ public void processMavenSpyLogs(StepContext context, FilePath mavenSpyLogFolder,
e.printStackTrace(errorWriter);
}
}
FilePath[] mavenSpyLogsInterruptedList = mavenSpyLogFolder.list("maven-spy-*.log.tmp");
if (mavenSpyLogsInterruptedList.length > 0) {
listener.getLogger().print("[withMaven] One or multiple Maven executions have been ignored by the " +
"Jenkins Pipeline Maven Plugin because they have been interrupted before completion " +
"(" + mavenSpyLogsInterruptedList.length + "). See ");
listener.hyperlink("https://wiki.jenkins.io/display/JENKINS/Pipeline+Maven+Plugin#PipelineMavenPlugin-mavenExecutionInterrupted", "Pipeline Maven Plugin FAQ");
listener.getLogger().println(" for more details.");
if (LOGGER.isLoggable(Level.FINE)) {
for (FilePath mavenSpyLogsInterruptedLogs : mavenSpyLogsInterruptedList) {
listener.getLogger().print("[withMaven] Ignore: " + mavenSpyLogsInterruptedLogs.getRemote());
}
}
}
}

public static class MavenArtifact {
Expand Down

0 comments on commit 7d10dd7

Please sign in to comment.