aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2018-09-19 16:15:43 +0300
committerIgor Pashev <pashev.igor@gmail.com>2018-09-19 16:15:43 +0300
commit5dd15063b56f36a6b6df6718e0a01eae0050659d (patch)
treeb5b93aa994451d1a8ff17493d47e0ff1a28c8458
parent902be6687a5c8302397a0c7697b62e83531b0858 (diff)
downloadbbprb-5dd15063b56f36a6b6df6718e0a01eae0050659d.tar.gz
Use simple description of aborted build
-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) {