From dac23f4ca6522e08691daff8a5fa77c030fcc99e Mon Sep 17 00:00:00 2001 From: Robert Snyder Date: Mon, 20 Mar 2017 13:14:44 -0400 Subject: [PATCH] Made pickles not generate files if build fails or is aborted. --- pom.xml | 2 +- src/main/java/hudson/plugins/pickles/PicklesNotifier.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 01d999a..75893ee 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.robertsnyder.pickles pickles-notifier - 1.0.2-SNAPSHOT + 1.0.2 hpi diff --git a/src/main/java/hudson/plugins/pickles/PicklesNotifier.java b/src/main/java/hudson/plugins/pickles/PicklesNotifier.java index 4ea6173..764402e 100644 --- a/src/main/java/hudson/plugins/pickles/PicklesNotifier.java +++ b/src/main/java/hudson/plugins/pickles/PicklesNotifier.java @@ -10,6 +10,7 @@ import hudson.model.AbstractBuild; import hudson.model.AbstractProject; import hudson.model.BuildListener; +import hudson.model.Result; import hudson.plugins.pickles.utilities.BuildPicklesArguments; import hudson.plugins.pickles.utilities.FindPicklesInstallation; import hudson.tasks.BuildStepDescriptor; @@ -70,8 +71,13 @@ public BuildStepMonitor getRequiredMonitorService() { @Override public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { - ArgumentListBuilder args = new ArgumentListBuilder(); + Result result = build.getResult(); + if(result == Result.ABORTED || result == Result.FAILURE){ + listener.getLogger().println("[pickles] Build is Aborted or Failed, skipping pickles generation"); + return true; + } + ArgumentListBuilder args = new ArgumentListBuilder(); EnvVars env = build.getEnvironment(listener); env.putAll(build.getBuildVariables());