Issue: I have a web hook for firing off a build when a pull request is merged. my issue is that the web hook is firing the build when the Pull request is created. this is causing the build to fail since the branch that is being build is from the previous build. I'm not sure why it is firing the hook when the PR is created. I only have "Pull request merged" checked.
Hello Pankaj,
Welcome to the Atlassian Community!
How are you confirming that the webhook is firing on the PR being created? If you are only checking to see if the build starts, is it possible that your CI is checking for PRs on top of the Webhook? More importantly, when you do merge the PR, does the webhook fire as expected? A quick test would be to just disable the webhook and open a PR to see if a build starts (and fails). Off-hand, I'm not sure exactly what else it could be. I assume you are using the webhooks built-in to Bitbucket?
Regards,
Aaron Levinson
Dev Tools Support Engineer
The web hook we created is pretty strait forward. My CI is not checking for anything. my web hook call a URL on jenkins which fires off a build. the issue is that if the build is triggered when the PR is created, the same build will fail when it is merged since the version is the same
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could we get some confirmation on some of the questions I asked previously?
Also if you are able to upload any screenshots of how things are configured on both the Bitbucket and Jenkins side, that would be appreciated. I wasn't able to reproduce this behavior. I am using the latest version of Bitbucket Server of 5.11.1 and the latest version of Jenkins with 2.121.1. What version of Bitbucket are you using (or are you using cloud) and what version of Jenkins are you working with?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aaron,
Below is answer for your query
Is this Webhook being created from the Bitbucket Webhook tab in the repository settings? Yes - I am using Post Webhook under repository settings
If you disable the webhook, can you confirm the behavior of Bitbucket with Jenkins (or what we should expect to be no behavior at all)? - Yes it is working fine
You said "the build will fail when it is merged" does that mean you attempted to do so or is this speculation (as in you confirmed that the hook is sent on merge as well as created)? Yes it is sending for both the event but we want built should be trigger only when merge happen to latest releas branch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are doing the Post Webhooks then that isn't the default Webhooks that is bundled with Bitbucket. That is a third part Post Webhooks plugin. But I wasn't able to reproduce the issue with that plugin either. If you go the Webhooks section instead of Post Webhooks and try to create one there do you see the same issue? Could you also confirm what version of Bitbucket you are using?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We are on bitbucket 5.9. I also looked on webhook but the issue is we are not getting configuration on branch level. As I mentioned before I need build should be trigger when pr will merge in latest release branch.
Thanks,
Pankaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.