2

We are using Bitbucket cloud to host our repos and Jenkins for CI/CD.

I have setup a multibranch pipeline which has develop and release branches. I want to trigger develop branch whenever a PR is merged from the feature branches to develop a branch (In fact on any manual webhook edit).

Below are the cases I tried:

  1. Setup Manage hook in Jenkin:
  • This creates a webhook in bitbucket and when PR is merged, build is triggered.
  • But when I disable the Repository Push option in the webhook, the build is not triggering on PR merge.
  1. Setup the webhook manually:
  • In this case, the Jenkins logs show the branch name as PR-XY since not triggering the develop branch.
  • I have set up a regex to filter branches (only develop and release are allowed) and when I add regex like PR(.*) then build gets triggers from the PR section (not desired case).

I want the build to be triggered from the develop branch, not as the PR branch. I have followed most of the options available in the forums but it's not working. Any help regarding this will be appreciated.

Adityat
  • 21
  • 2

1 Answers1

1

I faced the same issue, it's look like most of jenkins plugins like bitbucket plugin does not trigger the pipeline on merge only. even though i set the bitbucket trigger options like this:
enter image description here unless you add a check mark next to push option.

to solve this i used another Jenkins plugin called Bitbucket Push and Pull Request

just make sure to uninstall Bitbucket plugin if you have it.
so you can use this one as they mentioned in there docs.
and follow the setup instructions.

note: i only test it with normal pipeline job

DanTe
  • 115
  • 6
  • 1
    Your solution worked for me Perfectly All I had to do was install the plugin and on refreshing jenkins the pull requests triggered the pipeline on merge – Abraham Nzau Jun 05 '23 at 15:51