Skip to content

Commit 433c6e3

Browse files
authored
JENKINS-60751 Add listener to new bitbucket events (#291)
1 parent 90a8d4c commit 433c6e3

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/HookEventType.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ public enum HookEventType {
9999
*/
100100
SERVER_PULL_REQUEST_APPROVED("pr:reviewer:approved", NativeServerPullRequestHookProcessor.class),
101101

102+
/**
103+
* @see <a href="https://confluence.atlassian.com/bitbucketserver068/event-payload-981145451.html#Eventpayload-Modified">Eventpayload-Modified</a>
104+
* @since Bitbucket Server 5.4
105+
*/
106+
SERVER_PULL_REQUEST_MODIFIED("pr:modified", NativeServerPullRequestHookProcessor.class),
107+
108+
/**
109+
* @see <a href="https://confluence.atlassian.com/bitbucketserver054/event-payload-939508609.html#Eventpayload-ReviewersUpdated">Eventpayload-Modified</a>
110+
* @since Bitbucket Server 6.8
111+
*/
112+
SERVER_PULL_REQUEST_REVIEWER_UPDATED("pr:reviewer:updated", NativeServerPullRequestHookProcessor.class),
113+
102114
/**
103115
* Sent when hitting the {@literal "Test connection"} button in Bitbucket Server. Apparently undocumented.
104116
*/

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/NativeServerPullRequestHookProcessor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ public void process(HookEventType hookEvent, String payload, BitbucketType insta
8080
case SERVER_PULL_REQUEST_DELETED:
8181
eventType = SCMEvent.Type.REMOVED;
8282
break;
83+
case SERVER_PULL_REQUEST_MODIFIED:
84+
case SERVER_PULL_REQUEST_REVIEWER_UPDATED:
85+
eventType = SCMEvent.Type.UPDATED;
86+
break;
8387
default:
8488
LOGGER.log(Level.INFO, "Unknown hook event {0} received from Bitbucket Server", hookEvent);
8589
return;
@@ -126,6 +130,7 @@ protected Map<SCMHead, SCMRevision> heads(@NonNull BitbucketSCMSource source) {
126130

127131
switch (getType()) {
128132
case CREATED:
133+
case UPDATED:
129134
final String targetHash = pullRequest.getDestination().getCommit().getHash();
130135
final String pullHash = pullRequest.getSource().getCommit().getHash();
131136
result.put(head,

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/WebhookConfiguration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ public class WebhookConfiguration {
6363
HookEventType.SERVER_PULL_REQUEST_OPENED.getKey(),
6464
HookEventType.SERVER_PULL_REQUEST_MERGED.getKey(),
6565
HookEventType.SERVER_PULL_REQUEST_DECLINED.getKey(),
66-
HookEventType.SERVER_PULL_REQUEST_DELETED.getKey()
66+
HookEventType.SERVER_PULL_REQUEST_DELETED.getKey(),
67+
HookEventType.SERVER_PULL_REQUEST_MODIFIED.getKey(),
68+
HookEventType.SERVER_PULL_REQUEST_REVIEWER_UPDATED.getKey()
6769
));
6870

6971
/**

0 commit comments

Comments
 (0)