aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrode Aannevik <frode.aa@gmail.com>2016-05-21 15:29:05 +0200
committerFrode Aannevik <frode.aa@gmail.com>2016-05-21 15:37:12 +0200
commit1b5c53304a368bb4b164b9a6fabc74f969beabf0 (patch)
treed579e9e416e8b47623cc00af24ce721c90d3f5b3 /src
parent34849c3c1f9e229bdae47a6f2c7a19317aa18ed9 (diff)
downloadbbprb-1b5c53304a368bb4b164b9a6fabc74f969beabf0.tar.gz
Fix TTP only working for one of multiple jobs
The bug was that it did not handle TTBuild comments from another job Will now check all comments if they is a TTBuild for this job, and only trigger the job if we did not find a match Fixes: #82
Diffstat (limited to 'src')
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
index 4417d74..660ec21 100644
--- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
+++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
@@ -182,12 +182,6 @@ public class BitbucketRepository {
logger.log(Level.INFO, "Post comment: {0} with original content {1}", new Object[]{ content, this.client.postPullRequestComment(pullRequestId, content).getId() });
}
- private boolean processTTPCommentBuildTags(String content, String buildKey) {
- if (!this.isTTPCommentBuildTags(content)) return true;
- logger.log(Level.INFO, "Processing ttp with build comment: {0}", content);
- return !this.hasMyBuildTagInTTPComment(content, buildKey);
- }
-
private boolean isTTPComment(String content) {
return content.toLowerCase().contains(BUILD_REQUEST_MARKER.toLowerCase());
}
@@ -241,6 +235,7 @@ public class BitbucketRepository {
boolean rebuildCommentAvailable = false;
if (comments != null) {
Collection<Pullrequest.Comment> filteredComments = this.filterPullRequestComments(comments);
+ boolean hasMyBuildTag = false;
for (Pullrequest.Comment comment : filteredComments) {
String content = comment.getContent();
if (this.isTTPComment(content)) {
@@ -249,10 +244,11 @@ public class BitbucketRepository {
"Rebuild comment available for commit {0} and comment #{1}",
new Object[]{ sourceCommit, comment.getId() }
);
- }
- rebuildCommentAvailable &= this.processTTPCommentBuildTags(content, buildKeyPart);
- if (!rebuildCommentAvailable) break;
+ }
+ if (isTTPCommentBuildTags(content))
+ hasMyBuildTag |= this.hasMyBuildTagInTTPComment(content, buildKeyPart);
}
+ rebuildCommentAvailable &= !hasMyBuildTag;
}
if (rebuildCommentAvailable) this.postBuildTagInTTPComment(id, "TTP build flag", buildKeyPart);