Interface BitbucketWebhookProcessor
- All Superinterfaces:
- ExtensionPoint
- All Known Implementing Classes:
- AbstractWebhookProcessor,- CloudPullRequestWebhookProcessor,- CloudPushWebhookProcessor,- PluginPullRequestWebhookProcessor,- PluginPushWebhookProcessor,- ServerPingWebhookProcessor,- ServerPullRequestWebhookProcessor,- ServerPushWebhookProcessor
Implementations of this extension point must provide new behaviours to
 accommodate custom event payloads from webhooks sent from Bitbucket Cloud,
 Bitbucket Data Center, or installed plugins.
 
There cannot be multiple processors processing the same incoming webhook for a specific event installed on the system, meaning the processor must fit to the incoming request as much as possible or the hook will be rejected in case of multiple matches.
- Since:
- 937.0.0
- 
Nested Class SummaryNested classes/interfaces inherited from interface hudson.ExtensionPointExtensionPoint.LegacyInstancesAreScopedToHudson
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionbuildHookContext(jakarta.servlet.http.HttpServletRequest request) Returns a context for a given request used when process the payload.booleancanHandle(Map<String, String> headers, org.apache.commons.collections4.MultiValuedMap<String, String> parameters) Called by first for this processor that must respond if is able to handle this specific requestgetEventType(Map<String, String> headers, org.apache.commons.collections4.MultiValuedMap<String, String> parameters) Extracts the event type that represent the payload in the request.getServerURL(Map<String, String> headers, org.apache.commons.collections4.MultiValuedMap<String, String> parameters) Extracts the server URL from where this request coming from, the URL must match one of the configuredBitbucketEndpoints.default voidnotifyEvent(jenkins.scm.api.SCMHeadEvent<?> event, int delaySeconds) Implementations have to call this method when want propagate anSCMHeadEventto the scm-api.voidSee Event Payloads for more information about the payload parameter format.default booleanSettings that will trigger a re-index of the multibranch project/organization folder when the request does not ship any source changes.voidverifyPayload(Map<String, String> headers, String payload, BitbucketEndpoint endpoint) The implementation must verify if the incoming request is secured or not eventually gather some settings from the givenBitbucketEndpointconfiguration.
- 
Field Details- 
SCAN_ON_EMPTY_CHANGES_PROPERTY_NAME- See Also:
 
 
- 
- 
Method Details- 
canHandleboolean canHandle(@NonNull Map<String, String> headers, @NonNull org.apache.commons.collections4.MultiValuedMap<String, String> parameters) Called by first for this processor that must respond if is able to handle this specific request- Parameters:
- headers- request
- parameters- request
- Returns:
- trueif this processor is able to handle this hook request,- falseotherwise.
 
- 
getServerURL@NonNull String getServerURL(@NonNull Map<String, String> headers, @NonNull org.apache.commons.collections4.MultiValuedMap<String, String> parameters) Extracts the server URL from where this request coming from, the URL must match one of the configuredBitbucketEndpoints.- Parameters:
- headers- request
- parameters- request
- Returns:
- the URL of the server from where this request has been sent.
 
- 
getEventType@NonNull String getEventType(Map<String, String> headers, org.apache.commons.collections4.MultiValuedMap<String, String> parameters) Extracts the event type that represent the payload in the request.- Parameters:
- headers- request
- parameters- request
- Returns:
- the event type key.
 
- 
buildHookContext@NonNull default Map<String,Object> buildHookContext(@NonNull jakarta.servlet.http.HttpServletRequest request) Returns a context for a given request used when process the payload.- Parameters:
- request- hook
- Returns:
- a map of information extracted by the given request to be used in
         the process(String, String, Map, BitbucketEndpoint)method.
 
- 
verifyPayloadvoid verifyPayload(@NonNull Map<String, String> headers, @NonNull String payload, @NonNull BitbucketEndpoint endpoint) throws BitbucketWebhookProcessorExceptionThe implementation must verify if the incoming request is secured or not eventually gather some settings from the givenBitbucketEndpointconfiguration.- Parameters:
- headers- request
- payload- request
- endpoint- configured for the given- getServerURL(Map, MultiValuedMap)
- Throws:
- BitbucketWebhookProcessorException- when signature verification fails
 
- 
reindexOnEmptyChangesdefault boolean reindexOnEmptyChanges()Settings that will trigger a re-index of the multibranch project/organization folder when the request does not ship any source changes.- Returns:
- if should perform a reindex of the project or not.
 
- 
processvoid process(@NonNull String eventType, @NonNull String payload, @NonNull Map<String, Object> context, @NonNull BitbucketEndpoint endpoint) See Event Payloads for more information about the payload parameter format.- Parameters:
- eventType- the type of hook event.
- payload- the hook payload
- context- build from incoming request
- endpoint- configured in the Jenkins global page
 
- 
notifyEventdefault void notifyEvent(jenkins.scm.api.SCMHeadEvent<?> event, int delaySeconds) Implementations have to call this method when want propagate anSCMHeadEventto the scm-api.- Parameters:
- event- the to fire
- delaySeconds- a delay in seconds to wait before propagate the event. If the given value is less than 0 than default will be used.
 
 
-