From e35b6c97fbd47651a0910a3e679bcd98602e482a Mon Sep 17 00:00:00 2001 From: Mattias Date: Fri, 17 Jul 2020 01:37:13 +0200 Subject: [PATCH] fix: add support for server event pr:from_ref_updated. fixes #308 (#309) --- .../jenkins/plugins/bitbucket/hooks/HookEventType.java | 6 ++++++ .../hooks/NativeServerPullRequestHookProcessor.java | 1 + .../plugins/bitbucket/hooks/WebhookConfiguration.java | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/HookEventType.java b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/HookEventType.java index e6d9ab30a..59781548c 100644 --- a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/HookEventType.java +++ b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/HookEventType.java @@ -111,6 +111,12 @@ public enum HookEventType { */ SERVER_PULL_REQUEST_REVIEWER_UPDATED("pr:reviewer:updated", NativeServerPullRequestHookProcessor.class), + /** + * @see Eventpayload-Sourcebranchupdated + * @since Bitbucket Server 7.0 + */ + SERVER_PULL_REQUEST_FROM_REF_UPDATED("pr:from_ref_updated", NativeServerPullRequestHookProcessor.class), + /** * Sent when hitting the {@literal "Test connection"} button in Bitbucket Server. Apparently undocumented. */ diff --git a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/NativeServerPullRequestHookProcessor.java b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/NativeServerPullRequestHookProcessor.java index 45a46c678..2f4a8682f 100644 --- a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/NativeServerPullRequestHookProcessor.java +++ b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/NativeServerPullRequestHookProcessor.java @@ -82,6 +82,7 @@ public void process(HookEventType hookEvent, String payload, BitbucketType insta break; case SERVER_PULL_REQUEST_MODIFIED: case SERVER_PULL_REQUEST_REVIEWER_UPDATED: + case SERVER_PULL_REQUEST_FROM_REF_UPDATED: eventType = SCMEvent.Type.UPDATED; break; default: diff --git a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/WebhookConfiguration.java b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/WebhookConfiguration.java index 7ad1a2536..a1fcef4ca 100644 --- a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/WebhookConfiguration.java +++ b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/WebhookConfiguration.java @@ -65,7 +65,8 @@ public class WebhookConfiguration { HookEventType.SERVER_PULL_REQUEST_DECLINED.getKey(), HookEventType.SERVER_PULL_REQUEST_DELETED.getKey(), HookEventType.SERVER_PULL_REQUEST_MODIFIED.getKey(), - HookEventType.SERVER_PULL_REQUEST_REVIEWER_UPDATED.getKey() + HookEventType.SERVER_PULL_REQUEST_REVIEWER_UPDATED.getKey(), + HookEventType.SERVER_PULL_REQUEST_FROM_REF_UPDATED.getKey() )); /**