diff options
author | Robert Jeppesen <robert.jeppesen@durius.se> | 2014-05-15 07:29:35 +0200 |
---|---|---|
committer | Robert Jeppesen <robert.jeppesen@durius.se> | 2014-05-15 07:29:35 +0200 |
commit | 8357cc482beba438df0bccce4fd4e500d67978bb (patch) | |
tree | 403cc9b989a863b4e9eccaec794837cb9c915b2e /src/main/java/bitbucketpullrequestbuilder | |
parent | 0466f63f48d708bf39a7f22dcbe6e6881b99e62d (diff) | |
download | bbprb-8357cc482beba438df0bccce4fd4e500d67978bb.tar.gz |
Avoid repeating builds indefinitely after deleting the 'Build started' comment
Diffstat (limited to 'src/main/java/bitbucketpullrequestbuilder')
-rw-r--r-- | src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java index 904892e..61d3702 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java @@ -17,7 +17,8 @@ import java.util.logging.Logger; public class BitbucketRepository { private static final Logger logger = Logger.getLogger(BitbucketRepository.class.getName()); public static final String BUILD_START_MARKER = "[*BuildStarted*] %s"; - public static final String BUILD_FINISH_MARKER = "[*BuildFinished*] %s \n\n **%s** - %s"; + public static final String BUILD_FINISH_MARKER = "[*BuildFinished*] %s"; + public static final String BUILD_FINISH_SENTENCE = BUILD_FINISH_MARKER + " \n\n **%s** - %s"; public static final String BUILD_REQUEST_MARKER = "test this please"; public static final String BUILD_SUCCESS_COMMENT = ":star:SUCCESS"; @@ -87,7 +88,7 @@ public class BitbucketRepository { if (success){ message = BUILD_SUCCESS_COMMENT; } - String comment = String.format(BUILD_FINISH_MARKER, commit, message, buildUrl); + String comment = String.format(BUILD_FINISH_SENTENCE, commit, message, buildUrl); this.client.postPullRequestComment(pullRequestId, comment); } @@ -105,7 +106,8 @@ public class BitbucketRepository { String repositoryName = destination.getRepository().getRepositoryName(); String id = pullRequest.getId(); List<BitbucketPullRequestComment> comments = client.getPullRequestComments(owner, repositoryName, id); - String searchString = String.format(BUILD_START_MARKER, commit).toLowerCase(); + String searchStartMarker = String.format(BUILD_START_MARKER, commit).toLowerCase(); + String searchFinishMarker = String.format(BUILD_FINISH_MARKER, commit).toLowerCase(); if (comments != null) { Collections.sort(comments); @@ -116,7 +118,8 @@ public class BitbucketRepository { continue; } content = content.toLowerCase(); - if (content.contains(searchString)) { + if (content.contains(searchStartMarker) || + content.contains(searchFinishMarker)) { shouldBuild = false; break; } |