From 2e319d3ef30295551245f0592d9ad0184f302d51 Mon Sep 17 00:00:00 2001 From: Tom Yam Date: Sat, 20 May 2017 12:53:32 +0300 Subject: [PATCH] Skip codedeploy if build was not mark as success Before we run codedeploy if build was not mark as failure. This meant that we deployed for ABORTED, NOT_BUILT and UNSTABLE states as well (http://javadoc.jenkins-ci.org/hudson/model/Result.html) Until there is a finer grained configuration option, it's safer to deploy for SUCCESS builds only. Fixes #61 --- .../com/amazonaws/codedeploy/AWSCodeDeployPublisher.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java b/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java index 7ecc46f..2429367 100644 --- a/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java +++ b/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java @@ -185,9 +185,9 @@ public AWSCodeDeployPublisher( public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { this.logger = listener.getLogger(); envVars = build.getEnvironment(listener); - final boolean buildFailed = build.getResult() == Result.FAILURE; - if (buildFailed) { - logger.println("Skipping CodeDeploy publisher as build failed"); + final boolean buildSucceed = build.getResult() == Result.SUCCESS; + if (!buildSucceed) { + logger.println("Skipping CodeDeploy publisher as build was not successful"); return true; }