Jenkins builds using webhook when code is pushed to a different branch

Hello,

We are using bitbucket cloud and webhooks for automating builds with jenkins.

our branches in bb are using a fork structure for reasons implemented for quite some time now.

example

Project → {branch} master
→ {branch} develop
→ {branch} test

within jenkins the git Resfspec is set to “+refs/heads/develop:refs/remotes/origin/develop”
and under the Branches to build, the branch specifier is set to “*/develop”

the webhook is triggered when code is pushed to the “test” branch and jenkins builds the project. even though the branch specifier is set to only build when code is pushed to the “develop” branch.

did i configure something incorrectly?

Any help is greatly appreciated.

Hello @Deuce312 and welcome to this community :wave:

Could you please share with us your Jenkins configuration for this webhook, especially for the optional filter?

Thanks.

In the jenkins job project configuration, under the Build Triggers, I have the “Build when a change is pushed to BitBucket” checked on.

under the source code management, i have the repo url and specified the branch i want to build which is “*/develop”

The webhook in bitbucket is

https://jenkinslocation.com:8080/bitbucket-hook/

1 Like