Bitbucket events not registered automatically
See original GitHub issueYour checklist for this issue
-
Jenkins version 2.240.5
-
Plugin version 2.7.0
-
Bitbucket cloud
-
Bitbucket server and version 6.7.3
Description
Hi, We are trying to upgrade to the latest version of jenkins lts and after upgrade the bitbucket-branch-source-plugin does not register proper webhook events. The webhook gets registered;however, no Pull requests/Repository events are selected on the Bitbucket side. Only when we manually select on merge, on pull request, etc does the webhook trigger and kicks off the build accordingly. This is problematic because we are dealing with quite a large number of repositories. We are using the post-webhooks for Bitbucket (2.3.15) plugin.
The project jobs have been configured based on plugins documentation. Are we missing something or is this a bug?
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:22 (1 by maintainers)
Top GitHub Comments
There is nothing suspicious in the Bitbucket logs. Webhook registers just fine. We have tested the Post Webhook plugin’s API on Bitbucket side and we were able to register a webhook with properly configured events through their API. For anyone that is interested here is the link to docs:
https://moveworkforward.atlassian.net/wiki/spaces/DOCS/pages/867205121/Atlassian+Bitbucket+Post+Webhook+API
All of this leads me to believe the payload this plugin is posting over to Bitbucket is incorrectly set under certain circumstances so I would start my investigation there.
For anyone that is experiencing the same problem, we explicitly disabled this plugin’s hook management and added a temporary stage to our pipelines that filters through webhooks based on registered URL and either updates an existing webhook with proper events or creates a new webhook with the same events. Needless to say, events configured correspond to the types of pipelines (PR build/Branch build/Release build, etc).
The REST API can be used to enable events for existing hooks. cURL example is below, some info elided; the first does a
GET
of the existing hook, the second does aPOST
to the specific endpoint (the id from the JSON) of the hook config using an access token. You need:Cloudbees has some Jenkins docs with examples here: https://support.cloudbees.com/hc/en-us/articles/115000083932-Generate-webHooks-in-Bitbucket-Server-via-REST-API-for-Pipeline-Multibranch#updateawebhookbyid