-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix JENKINS-70171: publisher exceptions are catched, doesn't result i…
…n failing builds (#562)
- Loading branch information
Showing
8 changed files
with
45 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,29 +18,32 @@ | |
|
||
package org.jenkinsci.plugins.pipeline.maven.publishers; | ||
|
||
import hudson.Extension; | ||
import hudson.FilePath; | ||
import hudson.Launcher; | ||
import hudson.model.Run; | ||
import hudson.model.StreamBuildListener; | ||
import hudson.model.TaskListener; | ||
import org.jenkinsci.Symbol; | ||
import org.jenkinsci.plugins.jgiven.JgivenReportGenerator; | ||
import org.jenkinsci.plugins.pipeline.maven.MavenDependency; | ||
import org.jenkinsci.plugins.pipeline.maven.MavenPublisher; | ||
import org.jenkinsci.plugins.workflow.steps.StepContext; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
import org.w3c.dom.Element; | ||
import static org.jenkinsci.plugins.pipeline.maven.publishers.DependenciesLister.listDependencies; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
import java.util.ArrayList; | ||
import java.util.Set; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
import static org.jenkinsci.plugins.pipeline.maven.publishers.DependenciesLister.listDependencies; | ||
import javax.annotation.Nonnull; | ||
|
||
import org.jenkinsci.Symbol; | ||
import org.jenkinsci.plugins.jgiven.JgivenReportGenerator; | ||
import org.jenkinsci.plugins.pipeline.maven.MavenDependency; | ||
import org.jenkinsci.plugins.pipeline.maven.MavenPublisher; | ||
import org.jenkinsci.plugins.workflow.steps.StepContext; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
import org.w3c.dom.Element; | ||
|
||
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; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Cyrille Le Clerc</a> | ||
|
@@ -91,7 +94,8 @@ public void process(@Nonnull final StepContext context, @Nonnull final Element m | |
} | ||
if (!foundJGivenDependency) { | ||
if (LOGGER.isLoggable(Level.FINE)) { | ||
listener.getLogger().println("[withMaven] jgivenPublisher - JGiven not found within your project dependencies, aborting."); | ||
listener.getLogger().println( | ||
"[withMaven] jgivenPublisher - JGiven not found within your project dependencies, aborting."); | ||
} | ||
return; | ||
} | ||
|
@@ -113,8 +117,9 @@ public void process(@Nonnull final StepContext context, @Nonnull final Element m | |
generator.perform(run, workspace, launcher, listener); | ||
} catch (final Exception e) { | ||
listener.error( | ||
"[withMaven] jgivenPublisher - Silently ignore exception archiving JGiven reports: " + e); | ||
"[withMaven] jgivenPublisher - exception archiving JGiven reports: " + e + ". Failing the build."); | ||
LOGGER.log(Level.WARNING, "Exception processing JGiven reports archiving", e); | ||
run.setResult(Result.FAILURE); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters