Skip to content

Commit

Permalink
Made pickles not generate files if build fails or is aborted.
Browse files Browse the repository at this point in the history
  • Loading branch information
immeraufdemhund committed Mar 20, 2017
1 parent cb2ca2e commit dac23f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.robertsnyder.pickles</groupId>
<artifactId>pickles-notifier</artifactId>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.2</version>
<packaging>hpi</packaging>

<parent>
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/hudson/plugins/pickles/PicklesNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());

Expand Down

0 comments on commit dac23f4

Please sign in to comment.