From 291825bd09bc8d0afd869b186b18329a910001c4 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sun, 28 Jan 2018 11:44:54 +0300 Subject: Set build state to STOPPED on abort --- .../org/jenkinsci/plugins/bbprb/BitbucketBuildListener.java | 10 ++++++++-- .../java/org/jenkinsci/plugins/bbprb/bitbucket/BuildState.java | 8 +------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/main/java/org/jenkinsci') diff --git a/src/main/java/org/jenkinsci/plugins/bbprb/BitbucketBuildListener.java b/src/main/java/org/jenkinsci/plugins/bbprb/BitbucketBuildListener.java index 2b42ba3..15fe4ee 100644 --- a/src/main/java/org/jenkinsci/plugins/bbprb/BitbucketBuildListener.java +++ b/src/main/java/org/jenkinsci/plugins/bbprb/BitbucketBuildListener.java @@ -47,8 +47,14 @@ public class BitbucketBuildListener extends RunListener> { if (trigger != null) { LOGGER.log(Level.FINE, "Completed after BitbucketBuildTrigger"); Result result = build.getResult(); - BuildState state = (result == Result.SUCCESS) ? BuildState.SUCCESSFUL - : BuildState.FAILED; + BuildState state; + if (Result.SUCCESS == result) { + state = BuildState.SUCCESSFUL; + } else if (Result.ABORTED == result) { + state = BuildState.STOPPED; + } else { + state = BuildState.FAILED; + } BitbucketCause cause = build.getCause(BitbucketCause.class); trigger.setPRState(cause, state, build.getUrl()); } diff --git a/src/main/java/org/jenkinsci/plugins/bbprb/bitbucket/BuildState.java b/src/main/java/org/jenkinsci/plugins/bbprb/bitbucket/BuildState.java index 8fe1cdd..d070a35 100644 --- a/src/main/java/org/jenkinsci/plugins/bbprb/bitbucket/BuildState.java +++ b/src/main/java/org/jenkinsci/plugins/bbprb/bitbucket/BuildState.java @@ -1,9 +1,3 @@ package org.jenkinsci.plugins.bbprb.bitbucket; -/** - * Valid build states for a pull request - * - * @see - * "https://confluence.atlassian.com/bitbucket/buildstatus-resource-779295267.html" - */ -public enum BuildState { FAILED, INPROGRESS, SUCCESSFUL } +public enum BuildState { FAILED, INPROGRESS, SUCCESSFUL, STOPPED } -- cgit v1.2.3