aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2018-01-28 11:44:54 +0300
committerIgor Pashev <pashev.igor@gmail.com>2018-01-28 11:44:54 +0300
commit291825bd09bc8d0afd869b186b18329a910001c4 (patch)
treea4cfe314aa55599e37770021a967142b94d4c077
parent7149adb8be3ed1c8774bf9100848fc8589e3fd18 (diff)
downloadbbprb-291825bd09bc8d0afd869b186b18329a910001c4.tar.gz
Set build state to STOPPED on abort
-rw-r--r--src/main/java/org/jenkinsci/plugins/bbprb/BitbucketBuildListener.java10
-rw-r--r--src/main/java/org/jenkinsci/plugins/bbprb/bitbucket/BuildState.java8
2 files changed, 9 insertions, 9 deletions
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<AbstractBuild<?, ?>> {
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 }