aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/jenkinsci/plugins/bbprb/BitbucketBuildTrigger.java19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/main/java/org/jenkinsci/plugins/bbprb/BitbucketBuildTrigger.java b/src/main/java/org/jenkinsci/plugins/bbprb/BitbucketBuildTrigger.java
index 5481aee..2946d7a 100644
--- a/src/main/java/org/jenkinsci/plugins/bbprb/BitbucketBuildTrigger.java
+++ b/src/main/java/org/jenkinsci/plugins/bbprb/BitbucketBuildTrigger.java
@@ -215,8 +215,13 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
Run build = (Run)o;
if (build.isBuilding() &&
hasCauseFromTheSamePullRequest(build.getCauses(), bitbucketCause)) {
- logger.fine("Aborting build: " + build + " since PR is outdated");
- setBuildDescription(build);
+ logger.fine("Aborting '" + build + "' since the PR is outdated");
+ try {
+ build.setDescription("Aborted build since the PR is outdated");
+ } catch (IOException e) {
+ logger.warning("Could not set build description: " +
+ e.getMessage());
+ }
final Executor executor = build.getExecutor();
if (executor == null) {
throw new IllegalStateException("Executor can't be NULL");
@@ -227,16 +232,6 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
}
}
- private void setBuildDescription(final Run build) {
- try {
- build.setDescription(
- "Aborting build by `Bitbucket Pullrequest Builder Plugin`: " + build +
- " since PR is outdated");
- } catch (IOException e) {
- logger.warning("Could not set build description: " + e.getMessage());
- }
- }
-
private boolean
hasCauseFromTheSamePullRequest(@Nullable List<Cause> causes,
@Nullable BitbucketCause pullRequestCause) {