Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66581

Implement ChangeRequestSCMHead2 for pull requests

    • 4.0.0

      As of PR #253 and version 3.0.0, the Bitbucket Server Integration plugin can generate Jenkins jobs for source branches of pull requests, but not for the pull requests themselves.

      It would be useful to have a Jenkins job for the pull request itself and let other plugins query information about it. In particular, Branch API would call ChangeRequestSCMHead#getTarget() and set the CHANGE_TARGET global variable, which could then be passed to the discoverGitReferenceBuild pipeline step in order to let Warnings Next Generation compare the build warnings of the pull request to those of its target branch.

      This would require the Bitbucket Server Integration plugin to define and use a class that implements the ChangeRequestSCMHead2 interface, like the GitHub Branch Source, Bitbucket Branch Source, Gitea, and P4 plugins already do. Currently, BitbucketWebhookConsumer.BitbucketSCMHeadPullRequestEvent just uses GitBranchSCMHead.

          [JENKINS-66581] Implement ChangeRequestSCMHead2 for pull requests

          I would like to understand, how can we use this plugin to trigger a pipeline job only when a pull request is merged (Webhook event - PR merged)? 

          Also, is it possible to share the feature roadmap for this plugin?

          Mohan Krishan Joshi added a comment - I would like to understand, how can we use this plugin to trigger a pipeline job only when a pull request is merged (Webhook event - PR merged)?  Also, is it possible to share the feature roadmap for this plugin?

          mkjkec2005, as with JENKINS-60340, I am not working on this ticket. My employer currently works around the lack of this feature by using the Bitbucket Branch Source plugin instead, for those projects in which we need Jenkins jobs for pull requests.

          Kalle Niemitalo added a comment - mkjkec2005 , as with JENKINS-60340 , I am not working on this ticket. My employer currently works around the lack of this feature by using the Bitbucket Branch Source plugin instead, for those projects in which we need Jenkins jobs for pull requests.

          I would like to understand, how can we use this plugin to trigger a pipeline job only when a pull request is merged (Webhook event - PR merged)?

          That is quite different from this issue. When a pull request is merged or declined, Jenkins normally disables and eventually deletes the jobs that correspond to the pull request, so no further builds are expected. However, because the Bitbucket Server Integration plugin does not implement ChangeRequestSCMHead2 yet, I suppose Jenkins might not disable the jobs in the normal way.

          For your scenario, I'd consider setting branch restrictions in Bitbucket Server so that all commits must come via pull requests, and then configuring Jenkins to build on each commit.

          Kalle Niemitalo added a comment - I would like to understand, how can we use this plugin to trigger a pipeline job only when a pull request is merged (Webhook event - PR merged)? That is quite different from this issue. When a pull request is merged or declined, Jenkins normally disables and eventually deletes the jobs that correspond to the pull request, so no further builds are expected. However, because the Bitbucket Server Integration plugin does not implement ChangeRequestSCMHead2 yet, I suppose Jenkins might not disable the jobs in the normal way. For your scenario, I'd consider setting branch restrictions in Bitbucket Server so that all commits must come via pull requests, and then configuring Jenkins to build on each commit.

          Thomas Beck added a comment -

          What can we do to get thsi feature asap? In our Enterprise environment we needs to use Mirror Farms, but the PR tab is important for us.
          What can we do to help you here?

          Thomas Beck added a comment - What can we do to get thsi feature asap? In our Enterprise environment we needs to use Mirror Farms, but the PR tab is important for us. What can we do to help you here?

          Vic added a comment -

          Have any update?

          In our customer's Enterprise environment needs to use Mirror Farms, this PR tab is important for our customers.

          Vic added a comment - Have any update? In our customer's Enterprise environment needs to use Mirror Farms, this PR tab is important for our customers.

          Atlassian seems to be implementing this, in the linked pull requests.

          • PR 382 adds BitbucketPullRequestSCMRevision and related classes, and makes BitbucketWebhookConsumer create instances of that. It does not yet add an ObjectMetadataAction that would carry the title and description of the pull request.
          • PR 389 adds the "Pull Requests" category to BitbucketSCMSource so that multibranch projects can show the corresponding tab, and adds a BitbucketSCMHeadDiscoveryHandler interface. It does not yet add a class that would implement BitbucketSCMHeadDiscoveryHandler and discover pull requests.

          Kalle Niemitalo added a comment - Atlassian seems to be implementing this, in the linked pull requests. PR 382 adds BitbucketPullRequestSCMRevision and related classes, and makes BitbucketWebhookConsumer create instances of that. It does not yet add an ObjectMetadataAction that would carry the title and description of the pull request. PR 389 adds the "Pull Requests" category to BitbucketSCMSource so that multibranch projects can show the corresponding tab, and adds a BitbucketSCMHeadDiscoveryHandler interface. It does not yet add a class that would implement BitbucketSCMHeadDiscoveryHandler and discover pull requests.

          Sam Gleske added a comment -

          Sam Gleske added a comment - https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/tree/feature/JENKINS-66581-PR-support appears to be active but not yet merged to master.

          Assaf Katz added a comment -

          Hi,

          Do you have any estimate for when it will be merged?

          Thanks

          Assaf Katz added a comment - Hi, Do you have any estimate for when it will be merged? Thanks

          Josh Aguilar added a comment -

          Hi assafkatz3b,

          Thanks for checking. We do not have an estimate for the final merge into master yet but will post any updates on the progress here.

          Regards

          Josh Aguilar added a comment - Hi assafkatz3b , Thanks for checking. We do not have an estimate for the final merge into master yet but will post any updates on the progress here. Regards

          Josh Aguilar added a comment -

          We would like to announce the availability of 4.0.0-alpha.1 for the Bitbucket Server Integration plugin. This is an alpha release, meaning the feature is still under development, and we encourage you to try it out and provide us with valuable feedback.

          Here's a quick summary of what's included in this release:

          • Implemented ChangeRequestSCMHead2 and ChangeRequestSCMRevision for pull requests
          • Added a "Pull requests" category to the BitbucketSCMSource which is displayed as a tab in Multibranch Pipeline projects
          • Introduced a BitbucketPullRequestDiscoveryTrait enabling Multibranch Pipelines to detect open pull requests and initiate builds. NOTE: Forked (cross-repository) pull requests are not supported as part of this alpha release.

          You can get the 4.0.0-alpha.1 version from the Jenkins Experimental Plugin site or by directly visiting this link:
          https://updates.jenkins.io/download/plugins/atlassian-bitbucket-server-integration/4.0.0-alpha.1/atlassian-bitbucket-server-integration.hpi

          Please note that this is an alpha release and may contain incomplete functionality or potential issues. Your feedback is essential for us to improve and finalize the feature. We look forward to hearing your thoughts and experiences with this release. Thank you for your support and contribution to the development of this feature.

          Josh Aguilar added a comment - We would like to announce the availability of 4.0.0-alpha.1 for the Bitbucket Server Integration plugin. This is an alpha release, meaning the feature is still under development, and we encourage you to try it out and provide us with valuable feedback. Here's a quick summary of what's included in this release: Implemented ChangeRequestSCMHead2 and ChangeRequestSCMRevision for pull requests Added a "Pull requests" category to the BitbucketSCMSource which is displayed as a tab in Multibranch Pipeline projects Introduced a BitbucketPullRequestDiscoveryTrait enabling Multibranch Pipelines to detect open pull requests and initiate builds. NOTE: Forked (cross-repository) pull requests are not supported as part of this alpha release. You can get the 4.0.0-alpha.1 version from the Jenkins Experimental Plugin site or by directly visiting this link: https://updates.jenkins.io/download/plugins/atlassian-bitbucket-server-integration/4.0.0-alpha.1/atlassian-bitbucket-server-integration.hpi Please note that this is an alpha release and may contain incomplete functionality or potential issues. Your feedback is essential for us to improve and finalize the feature. We look forward to hearing your thoughts and experiences with this release. Thank you for your support and contribution to the development of this feature.

            Unassigned Unassigned
            kon Kalle Niemitalo
            Votes:
            17 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated:
              Resolved: