• 3.0.0

      Include support to BitBucket Pull Request events in plugin

          [JENKINS-60342] Include support to BitBucket Pull Request

          Hi khughes,

          Can you please tell me when can we expect pull request event features in Bitbucket server integration plugin?

          We have started using this plugin but unfortunately pull request events is not working.

          Kindly check and revert back ASAP.

          Thanks in advance

          SHIVAKUMAR B M added a comment - Hi khughes , Can you please tell me when can we expect pull request event features in Bitbucket server integration plugin? We have started using this plugin but unfortunately pull request events is not working. Kindly check and revert back ASAP. Thanks in advance

          Fabian Bosch added a comment -

          +1 for this featureRequest.
          please consider to increase priority on this one. seems to me like this would be the biggest benefit compared to other 3rd party plugins and reason to use it.

          Fabian Bosch added a comment - +1 for this featureRequest. please consider to increase priority on this one. seems to me like this would be the biggest benefit compared to other 3rd party plugins and reason to use it.

          The older Bitbucket Branch Source plugin already supports the pr:opened, pr:merged, pr:declined, pr:deleted, and pr:reviewer:approved events from Bitbucket Server webhooks (HookEventType.java, NativeServerPullRequestHookProcessor.java), so this is necessary for feature parity.

          Kalle Niemitalo added a comment - The older Bitbucket Branch Source plugin already supports the pr:opened , pr:merged , pr:declined , pr:deleted , and pr:reviewer:approved events from Bitbucket Server webhooks ( HookEventType.java , NativeServerPullRequestHookProcessor.java ), so this is necessary for feature parity.

          Omer Kattan added a comment -

          +1 for this feature from me aswell.

          For my team, this plugin is not usable without it (and i really want us to use it).
          Our pipeline takes a lot of time to run, and we can't afford to run it for every push.

          The ability to run it only for pull requests (opened and updated at least) is critical.

          Omer Kattan added a comment - +1 for this feature from me aswell. For my team, this plugin is not usable without it (and i really want us to use it). Our pipeline takes a lot of time to run, and we can't afford to run it for every push. The ability to run it only for pull requests (opened and updated at least) is critical.

          Omer Kattan added a comment -

          Another thought, while i know this is better implemented on bitbucket's side, there is no webhook for when commits are added to an existing PR. A cool thing to check if there is an open PR when handling a push webhook request.

          Omer Kattan added a comment - Another thought, while i know this is better implemented on bitbucket's side, there is no webhook for when commits are added to an existing PR. A cool thing to check if there is an open PR when handling a push webhook request.

          Thanks for offering an alternative plugin dedicated to Bitbucket Server; we gave it a try and like the webhooks-based approach and guidance; however PR builds are a critical part of our workflow.

          So far we have been using the bitbucket-branch-source plugin, which suddenly stopped working with Bitbucket 7.
          —internal PR refs are no longer reliably updated (well, they were never really guaranteed, more details at BSERV-12198); meanwhile, fixing PRs originating from forks in branch-source plugin is wildly uncertain, since that plugin is mostly ref-based. So far we're a bit helpless.

          Mikaël Geljić added a comment - Thanks for offering an alternative plugin dedicated to Bitbucket Server; we gave it a try and like the webhooks-based approach and guidance; however PR builds are a critical part of our workflow. So far we have been using the bitbucket-branch-source plugin, which suddenly stopped working with Bitbucket 7. —internal PR refs are no longer reliably updated (well, they were never really guaranteed, more details at BSERV-12198 ); meanwhile, fixing PRs originating from forks in branch-source plugin is wildly uncertain, since that plugin is mostly ref-based. So far we're a bit helpless.

          Hi,

          Thanks for taking the time to create such a useful plugin, it's really nice to finally be able to get rid of a multiplication of plugins to do the job.

          Unfortunately, as everybody already mentioned, a key-feature still missing is the support of Pull Request events.

          I've seen that a branch in the repo was dedicated to this feature, and updated recently.

          Any idea when we could expect it to be completed?

          Thanks you.

          Erwan Palanque added a comment - Hi, Thanks for taking the time to create such a useful plugin, it's really nice to finally be able to get rid of a multiplication of plugins to do the job. Unfortunately, as everybody already mentioned, a key-feature still missing is the support of Pull Request events. I've seen that a branch in the repo was dedicated to this feature, and updated recently. Any idea when we could expect it to be completed? Thanks you.

          Agree, this is an important feature, would like to mention our use case for this enhancement.

          Our pipeline jobs communicate with the Bitbucket mirror and not the server, as such we are not able to discover pull requests or execute REST commands which usually work when we work directly with the server using other plugins. 

          It seems like this plugin will solve the issue if the pull request feature is introduced. 

          Valerie Fernandes added a comment - Agree, this is an important feature, would like to mention our use case for this enhancement. Our pipeline jobs communicate with the Bitbucket mirror and not the server, as such we are not able to discover pull requests or execute REST commands which usually work when we work directly with the server using other plugins.  It seems like this plugin will solve the issue if the pull request feature is introduced. 

          Niket Joshi added a comment - - edited

          Hi,

          Please try to develop the pull request builder on priority because i tried with other plugins such as bitbucket push and pull request builder but that plugin supports with Git SCM Option and there is no working plugin to notify the build status to newer version of Bitbucket server after the build completes, Just for work around i have used separate builds one with Git SCM option to trigger the build on pull request and one dummy build with Bitbucket Server Integration SCM option to just notify the Bitbucket Server is successful. This is very embarrassing but yeah there's no option at all.

          Thank you,

          Niket

          Niket Joshi added a comment - - edited Hi, Please try to develop the pull request builder on priority because i tried with other plugins such as bitbucket push and pull request builder but that plugin supports with Git SCM Option and there is no working plugin to notify the build status to newer version of Bitbucket server after the build completes, Just for work around i have used separate builds one with Git SCM option to trigger the build on pull request and one dummy build with Bitbucket Server Integration SCM option to just notify the Bitbucket Server is successful. This is very embarrassing but yeah there's no option at all . Thank you, Niket

          Niket Joshi added a comment - - edited

          There is already event request sending to jenkins by Bitbucket server.

           

          Event type:

          pr:opened

          URL endpoint:

          http://Jenkins-Url/bitbucket-server-webhook/trigger
           
          Can't you handle this request in the plugin?
           
          Thanks,
          Niket

          Niket Joshi added a comment - - edited There is already event request sending to jenkins by Bitbucket server.   Event type: pr:opened URL endpoint: http://Jenkins-Url/bitbucket-server-webhook/trigger   Can't you handle this request in the plugin?   Thanks, Niket

          Hi,

          I came across this plugin and it really looks promising, but not having support for PRs is really a blocking point for us. Please prioritize this feature.

          Best regards

          Linus

          Linus Isberg Martinsson added a comment - Hi, I came across this plugin and it really looks promising, but not having support for PRs is really a blocking point for us. Please prioritize this feature. Best regards Linus

          Tim Black added a comment - - edited

          Please prioritize this blocking issue. Many of us are wading through the sea of bitbucket plugins, and never completely successful in achieving the right cocktail to provide the basic features needed for modern software development processes.

          In addition to supporting the webhooks for all PR events, it's critical that the plugin expose the event detail to pipelines being triggered. That way, we can implement special features like performing pre-build merges so that the PR merge check of "minimum successful builds" can truly gate quality on the merge, i.e. noone can merge a PR until the hypothetically-merged source builds green. Just checking that the source branch is green is not sufficient, because unintended errors commonly creep in during a merge.

          This last piece could be provided by your plugin, but I'd highly suggest you keep it simple for now and just implement the basic PR event web hook support, which should be quickly achievable and will unblock so many people.

          @Niket, you can use this plugin for notifying build status to Bitbucket server. It works great for recent 7.x versions of BBS. https://github.com/jenkinsci/stashnotifier-plugin

          Also, see more on this here.

          Tim Black added a comment - - edited Please prioritize this blocking issue. Many of us are wading through the sea of bitbucket plugins, and never completely successful in achieving the right cocktail to provide the basic features needed for modern software development processes. In addition to supporting the webhooks for all PR events, it's critical that the plugin expose the event detail to pipelines being triggered. That way, we can implement special features like performing pre-build merges so that the PR merge check of "minimum successful builds" can truly gate quality on the merge, i.e. noone can merge a PR until the hypothetically-merged source builds green. Just checking that the source branch is green is not sufficient, because unintended errors commonly creep in during a merge. This last piece could be provided by your plugin, but I'd highly suggest you keep it simple for now and just implement the basic PR event web hook support, which should be quickly achievable and will unblock so many people. @Niket, you can use this plugin for notifying build status to Bitbucket server. It works great for recent 7.x versions of BBS. https://github.com/jenkinsci/stashnotifier-plugin Also, see more on this here .

          Probably efforts can be combined?
          Bitbucket branch source plugin has support for PRs but is lacking some features for supporting the latest Bitbucket releases - while the Bitbucket server plugin does not support PRs...
          Plus, the Bitbucket Branch Source plugin currently is searching for a new maintainer.

          Joerg Schwaerzler added a comment - Probably efforts can be combined? Bitbucket branch source plugin has support for PRs but is lacking some features for supporting the latest Bitbucket releases - while the Bitbucket server plugin does not support PRs... Plus, the Bitbucket Branch Source plugin currently is searching for a new maintainer.

          Michal added a comment -

          Is any ETA for implementing it?

          Michal added a comment - Is any ETA for implementing it?

          Vladimir added a comment -

          Hi,

          This is hot feature for us as well. It would be great to see it early next year. Please bump up its priority.


          Regards,
          Vladimir

          Vladimir added a comment - Hi, This is hot feature for us as well. It would be great to see it early next year. Please bump up its priority. – Regards, Vladimir

          The Bitbucket Branch Source plugin works very well and is perfectly integrated with Jenkins.
          It supports:

          • job triggering by webhook
          • automatic creation of webhook
          • build of branches
          • build of PRs (with/without automatic local merging on target branch)
          • notification of build status back to the Bitbucket server
          • entire project organization
          • ...

          I don't see the point in developing a new plugin which will take time to reach functional parity (missing build of PR is a deal-breaker for many of us) whereas Atlassian could have contributed to the existing one and even become the official maintainers since the Bitbucket Branch Source plugin is up for adoption.

          mkgl: The Bitbucket Branch Source plugin is perfectly functional (even for PR build) with recent Bitbucket server releases but you need to tick the "Call Changes api" option for your Bitbucket endpoint in Jenkins global configuration.

          niketjsh: The Bitbucket Branch Source plugin sends the notification of build status to the Bitbucket server and it doesn't need to be combined with multiple other plugins (except the Git plugin) to get a working pipeline.

          Jonathan Delizy added a comment - The Bitbucket Branch Source plugin works very well and is perfectly integrated with Jenkins. It supports: job triggering by webhook automatic creation of webhook build of branches build of PRs (with/without automatic local merging on target branch) notification of build status back to the Bitbucket server entire project organization ... I don't see the point in developing a new plugin which will take time to reach functional parity (missing build of PR is a deal-breaker for many of us) whereas Atlassian could have contributed to the existing one and even become the official maintainers since the Bitbucket Branch Source plugin is up for adoption. mkgl : The Bitbucket Branch Source plugin is perfectly functional (even for PR build) with recent Bitbucket server releases but you need to tick the "Call Changes api" option for your Bitbucket endpoint in Jenkins global configuration. niketjsh : The Bitbucket Branch Source plugin sends the notification of build status to the Bitbucket server and it doesn't need to be combined with multiple other plugins (except the Git plugin) to get a working pipeline.

          jonathand131 I totally agree that one plugin will be sufficient.
          However, please note that

          • Cloudbees is currently searching for a new maintainer of the Bitbucket Branch Source Plugin (see https://github.com/jenkinsci/bitbucket-branch-source-plugin/issues/288)
          • The plugin is NOT perfectly functional - at least not when using Bitbucket 7.x:
            • Lightweight checkouts + testing the merge commit (PR target branch -> PR source branch) are no longer possible - this is a feature we are already missing since we have some repositories that will take a long time for cloning and eat up the Jenkins master disk space in those cases (see https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/409)
            • The 'Call changes API' feature does not work properly. In fact it happens quite often that the first PR build will start before the PR reference actually has been created in Bitbucket. I suppose the plugin would need a fix to wait until the reference actually is available

          I propose that Atlassian takes over the ownership of the Bitbucket Branch Source plugin and ensures that the issues described will be fixed - or they continue maintaining their own plugin (and add the missing PR support).

          Joerg Schwaerzler added a comment - jonathand131 I totally agree that one plugin will be sufficient. However, please note that Cloudbees is currently searching for a new maintainer of the Bitbucket Branch Source Plugin (see https://github.com/jenkinsci/bitbucket-branch-source-plugin/issues/288 ) The plugin is NOT perfectly functional - at least not when using Bitbucket 7.x: Lightweight checkouts + testing the merge commit (PR target branch -> PR source branch) are no longer possible - this is a feature we are already missing since we have some repositories that will take a long time for cloning and eat up the Jenkins master disk space in those cases (see https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/409 ) The 'Call changes API' feature does not work properly. In fact it happens quite often that the first PR build will start before the PR reference actually has been created in Bitbucket. I suppose the plugin would need a fix to wait until the reference actually is available I propose that Atlassian takes over the ownership of the Bitbucket Branch Source plugin and ensures that the issues described will be fixed - or they continue maintaining their own plugin (and add the missing PR support).

          Sven added a comment -

          I'm a little confused here.

          Integrating Bitbucket Server with Jenkins to see Build Information worked fine until I found this thread when searching for a way to use PR values (namely the ID and destination branch) in a Jenkins Job.

          When looking at the Atlassian Confluence, I find this paragraph:

          On the Pull request page you can see builds information in two locations. You can see the latest build status in the Overview tab and builds information for each commit in the pull request Builds tab.

          So, what is actually possible with this plugin? The documentation is kinda sparse.

          Sven added a comment - I'm a little confused here. Integrating Bitbucket Server with Jenkins to see Build Information worked fine until I found this thread when searching for a way to use PR values (namely the ID and destination branch) in a Jenkins Job. When looking at the Atlassian Confluence, I find this paragraph: On the Pull request page you can see builds information in two locations. You can see the latest build status in the Overview tab and builds information for each commit in the pull request Builds tab. So, what is actually possible with this plugin? The documentation is kinda sparse.

          Kalle Niemitalo added a comment - - edited

          stifm, in the Bitbucket Server REST APIs, a build status attaches to a commit ID; there is no way to specify which pull request was built. If you view a pull request in the Bitbucket Server user interface, and the latest commit in the source branch has a build status attached to it, then Bitbucket Server displays that build status in the Overview tab too. It does so even if the build was not caused by the pull request at all; the build status may have been reported before the source branch and the pull request were created.

          (The Bitbucket Server REST APIs have two endpoints for reporting a build status. In addition to the commit ID, the newer endpoint also takes the project and the repository as parameters; the older one doesn't. Neither of them takes a pull request ID as a parameter.)

          Therefore, I don't think this JENKINS-60342 is about changing how Bitbucket Server Integration reports build statuses to Bitbucket Server. Instead, it may cover the following features, which the Bitbucket Server Integration plugin does not support yet:

          • Generating a Jenkins job for each pull request, in a Multibranch Pipeline project.
          • Building the source branch of a pull request and providing some properties of the pull request to a pipeline script.
          • Building the result of merging a pull request, before the pull request is actually merged in Bitbucket Server.

          Kalle Niemitalo added a comment - - edited stifm , in the Bitbucket Server REST APIs, a build status attaches to a commit ID; there is no way to specify which pull request was built. If you view a pull request in the Bitbucket Server user interface, and the latest commit in the source branch has a build status attached to it, then Bitbucket Server displays that build status in the Overview tab too. It does so even if the build was not caused by the pull request at all; the build status may have been reported before the source branch and the pull request were created. (The Bitbucket Server REST APIs have two endpoints for reporting a build status. In addition to the commit ID, the newer endpoint also takes the project and the repository as parameters; the older one doesn't. Neither of them takes a pull request ID as a parameter.) Therefore, I don't think this JENKINS-60342 is about changing how Bitbucket Server Integration reports build statuses to Bitbucket Server. Instead, it may cover the following features, which the Bitbucket Server Integration plugin does not support yet: Generating a Jenkins job for each pull request, in a Multibranch Pipeline project. Building the source branch of a pull request and providing some properties of the pull request to a pipeline script. Building the result of merging a pull request, before the pull request is actually merged in Bitbucket Server.

          Michal added a comment -

          mhenschke_atlassian , we keep fingers crossed for you!

          Michal added a comment - mhenschke_atlassian , we keep fingers crossed for you!

          Hi all,
          We have finally released support for pull request triggers! Thank you all for your patience and feedback over this process.
          We know that the feature will not satisfy all use cases but we wanted to release a solution, as this blocks adoption of the plugin for many If you encounter any limitations or want additional support from this feature, please feel free to raise a new ticket with your request.

          Thanks,
          Martin

          Martin Henschke added a comment - Hi all, We have finally released support for pull request triggers! Thank you all for your patience and feedback over this process. We know that the feature will not satisfy all use cases but we wanted to release a solution, as this blocks adoption of the plugin for many If you encounter any limitations or want additional support from this feature, please feel free to raise a new ticket with your request. Thanks, Martin

          Am I missing something? How does the PR trigger help if the multibranch job itself does not support building PRs.
          What would you say, what would be the reason to use the bitbucket-server plugin over the bitbucket branch source plugin? Why don't you just drop this, take over the branch source plugin and save yourself a lot of time and effort. CloudBees anyways still is searching for a maintainer.

          Sorry but I do not understand the strategy behind.

          Joerg Schwaerzler added a comment - Am I missing something? How does the PR trigger help if the multibranch job itself does not support building PRs. What would you say, what would be the reason to use the bitbucket-server plugin over the bitbucket branch source plugin? Why don't you just drop this, take over the branch source plugin and save yourself a lot of time and effort. CloudBees anyways still is searching for a maintainer. Sorry but I do not understand the strategy behind.

          Bharat Jain added a comment -

          Thank you mhenschke_atlassian. The pull request trigger works as expected! 

          Bharat Jain added a comment - Thank you mhenschke_atlassian . The pull request trigger works as expected! 

          How does the PR trigger works? Can it capture PR merge events also? How can I get PR details - PR ID, PR URL, PR source and the target branch, PR latest commit, etc in the pipeline via this plugin? Could you please clarify? 

          Mohan Krishan Joshi added a comment - How does the PR trigger works? Can it capture PR merge events also? How can I get PR details - PR ID, PR URL, PR source and the target branch, PR latest commit, etc in the pipeline via this plugin? Could you please clarify? 

          mkjkec2005, I expect the followup JENKINS-66581 (and its duplicate JENKINS-66786) will provide those PR details to pipelines.

          Kalle Niemitalo added a comment - mkjkec2005 , I expect the followup JENKINS-66581 (and its duplicate JENKINS-66786 ) will provide those PR details to pipelines.

          There is also JENKINS-60340 for publishing event information like the actor who pushed to the source branch of the pull request.

          Kalle Niemitalo added a comment - There is also JENKINS-60340 for publishing event information like the actor who pushed to the source branch of the pull request.

          Zoupers added a comment - - edited

          Hello, everyone. I intend to introduce a feature called 'refspec' to this plugin, which is already a git plugin feature. This addition will enable us to fetch the pull request code and execute normally, potentially solving this issue.

          Zoupers added a comment - - edited Hello, everyone. I intend to introduce a feature called 'refspec' to this plugin, which is already a git plugin feature. This addition will enable us to fetch the pull request code and execute normally, potentially solving this issue.

            mhenschke_atlassian Martin Henschke
            javier_rodriguez Javier Rodríguez
            Votes:
            69 Vote for this issue
            Watchers:
            83 Start watching this issue

              Created:
              Updated:
              Resolved: