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

          Kalle Niemitalo created issue -
          Kalle Niemitalo made changes -
          Description Original: As of [PR #253|https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/pull/253], 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|https://github.com/jenkinsci/branch-api-plugin/blob/0f9cf838b6298d21652400dde9d611b3374f5b60/src/main/java/jenkins/branch/BranchNameContributor.java#L70-L71] would call [ChangeRequestSCMHead#getTarget()|https://github.com/jenkinsci/scm-api-plugin/blob/400faa8fd5651731257ff59f53b715dfeede7ede/src/main/java/jenkins/scm/api/mixin/ChangeRequestSCMHead.java#L50-L57] and set the {{CHANGE_TARGET}} global variable, which could then be passed to the [discoverGitReferenceBuild|https://www.jenkins.io/doc/pipeline/steps/git-forensics/#discovergitreferencebuild-discover-git-reference-build] pipeline step in order to let [Warnings Next Generation|https://plugins.jenkins.io/warnings-ng/] 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|https://github.com/jenkinsci/scm-api-plugin/blob/400faa8fd5651731257ff59f53b715dfeede7ede/src/main/java/jenkins/scm/api/mixin/ChangeRequestSCMHead2.java] interface, like the [GitHub Branch Source|https://github.com/jenkinsci/github-branch-source-plugin/blob/d07e7d20a8458a2a1288ddbb85134abe30805119/src/main/java/org/jenkinsci/plugins/github_branch_source/PullRequestSCMHead.java#L48], [Bitbucket Branch Source|https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/c79f7c340cac7455b90d963bdaba9f4fb7dd2c25/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/PullRequestSCMHead.java#L48], [Gitea|https://github.com/jenkinsci/gitea-plugin/blob/62855b3c3d8c119302b1156f5d3b0b3460810f76/src/main/java/org/jenkinsci/plugin/gitea/PullRequestSCMHead.java#L32], and [P4|https://github.com/jenkinsci/p4-plugin/blob/4a564282febb6a94a5833c02c0fce1f3d7e657cc/src/main/java/org/jenkinsci/plugins/p4/scm/P4ChangeRequestSCMHead.java#L12] plugins already do. Currently, `BitbucketWebhookConsumer.BitbucketSCMHeadPullRequestEvent` just [uses GitBranchSCMHead|https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/blob/470a7380c0f4141635371ff178c66103ff6bf49c/src/main/java/com/atlassian/bitbucket/jenkins/internal/trigger/BitbucketWebhookConsumer.java#L255-L256].
          New: As of [PR #253|https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/pull/253], 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|https://github.com/jenkinsci/branch-api-plugin/blob/0f9cf838b6298d21652400dde9d611b3374f5b60/src/main/java/jenkins/branch/BranchNameContributor.java#L70-L71] would call [ChangeRequestSCMHead#getTarget()|https://github.com/jenkinsci/scm-api-plugin/blob/400faa8fd5651731257ff59f53b715dfeede7ede/src/main/java/jenkins/scm/api/mixin/ChangeRequestSCMHead.java#L50-L57] and set the {{CHANGE_TARGET}} global variable, which could then be passed to the [discoverGitReferenceBuild|https://www.jenkins.io/doc/pipeline/steps/git-forensics/#discovergitreferencebuild-discover-git-reference-build] pipeline step in order to let [Warnings Next Generation|https://plugins.jenkins.io/warnings-ng/] 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|https://github.com/jenkinsci/scm-api-plugin/blob/400faa8fd5651731257ff59f53b715dfeede7ede/src/main/java/jenkins/scm/api/mixin/ChangeRequestSCMHead2.java] interface, like the [GitHub Branch Source|https://github.com/jenkinsci/github-branch-source-plugin/blob/d07e7d20a8458a2a1288ddbb85134abe30805119/src/main/java/org/jenkinsci/plugins/github_branch_source/PullRequestSCMHead.java#L48], [Bitbucket Branch Source|https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/c79f7c340cac7455b90d963bdaba9f4fb7dd2c25/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/PullRequestSCMHead.java#L48], [Gitea|https://github.com/jenkinsci/gitea-plugin/blob/62855b3c3d8c119302b1156f5d3b0b3460810f76/src/main/java/org/jenkinsci/plugin/gitea/PullRequestSCMHead.java#L32], and [P4|https://github.com/jenkinsci/p4-plugin/blob/4a564282febb6a94a5833c02c0fce1f3d7e657cc/src/main/java/org/jenkinsci/plugins/p4/scm/P4ChangeRequestSCMHead.java#L12] plugins already do. Currently, BitbucketWebhookConsumer.BitbucketSCMHeadPullRequestEvent just [uses GitBranchSCMHead|https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/blob/470a7380c0f4141635371ff178c66103ff6bf49c/src/main/java/com/atlassian/bitbucket/jenkins/internal/trigger/BitbucketWebhookConsumer.java#L255-L256].
          Kalle Niemitalo made changes -
          Link New: This issue depends on JENKINS-60342 [ JENKINS-60342 ]
          Kalle Niemitalo made changes -
          Link New: This issue is related to JENKINS-66672 [ JENKINS-66672 ]
          Michal made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Michal made changes -
          Status Original: In Progress [ 3 ] New: Open [ 1 ]
          Kalle Niemitalo made changes -
          Link New: This issue is duplicated by JENKINS-66786 [ JENKINS-66786 ]
          Kalle Niemitalo made changes -
          Description Original: As of [PR #253|https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/pull/253], 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|https://github.com/jenkinsci/branch-api-plugin/blob/0f9cf838b6298d21652400dde9d611b3374f5b60/src/main/java/jenkins/branch/BranchNameContributor.java#L70-L71] would call [ChangeRequestSCMHead#getTarget()|https://github.com/jenkinsci/scm-api-plugin/blob/400faa8fd5651731257ff59f53b715dfeede7ede/src/main/java/jenkins/scm/api/mixin/ChangeRequestSCMHead.java#L50-L57] and set the {{CHANGE_TARGET}} global variable, which could then be passed to the [discoverGitReferenceBuild|https://www.jenkins.io/doc/pipeline/steps/git-forensics/#discovergitreferencebuild-discover-git-reference-build] pipeline step in order to let [Warnings Next Generation|https://plugins.jenkins.io/warnings-ng/] 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|https://github.com/jenkinsci/scm-api-plugin/blob/400faa8fd5651731257ff59f53b715dfeede7ede/src/main/java/jenkins/scm/api/mixin/ChangeRequestSCMHead2.java] interface, like the [GitHub Branch Source|https://github.com/jenkinsci/github-branch-source-plugin/blob/d07e7d20a8458a2a1288ddbb85134abe30805119/src/main/java/org/jenkinsci/plugins/github_branch_source/PullRequestSCMHead.java#L48], [Bitbucket Branch Source|https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/c79f7c340cac7455b90d963bdaba9f4fb7dd2c25/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/PullRequestSCMHead.java#L48], [Gitea|https://github.com/jenkinsci/gitea-plugin/blob/62855b3c3d8c119302b1156f5d3b0b3460810f76/src/main/java/org/jenkinsci/plugin/gitea/PullRequestSCMHead.java#L32], and [P4|https://github.com/jenkinsci/p4-plugin/blob/4a564282febb6a94a5833c02c0fce1f3d7e657cc/src/main/java/org/jenkinsci/plugins/p4/scm/P4ChangeRequestSCMHead.java#L12] plugins already do. Currently, BitbucketWebhookConsumer.BitbucketSCMHeadPullRequestEvent just [uses GitBranchSCMHead|https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/blob/470a7380c0f4141635371ff178c66103ff6bf49c/src/main/java/com/atlassian/bitbucket/jenkins/internal/trigger/BitbucketWebhookConsumer.java#L255-L256].
          New: As of [PR #253|https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/pull/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|https://github.com/jenkinsci/branch-api-plugin/blob/0f9cf838b6298d21652400dde9d611b3374f5b60/src/main/java/jenkins/branch/BranchNameContributor.java#L70-L71] would call [ChangeRequestSCMHead#getTarget()|https://github.com/jenkinsci/scm-api-plugin/blob/400faa8fd5651731257ff59f53b715dfeede7ede/src/main/java/jenkins/scm/api/mixin/ChangeRequestSCMHead.java#L50-L57] and set the {{CHANGE_TARGET}} global variable, which could then be passed to the [discoverGitReferenceBuild|https://www.jenkins.io/doc/pipeline/steps/git-forensics/#discovergitreferencebuild-discover-git-reference-build] pipeline step in order to let [Warnings Next Generation|https://plugins.jenkins.io/warnings-ng/] 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|https://github.com/jenkinsci/scm-api-plugin/blob/400faa8fd5651731257ff59f53b715dfeede7ede/src/main/java/jenkins/scm/api/mixin/ChangeRequestSCMHead2.java] interface, like the [GitHub Branch Source|https://github.com/jenkinsci/github-branch-source-plugin/blob/d07e7d20a8458a2a1288ddbb85134abe30805119/src/main/java/org/jenkinsci/plugins/github_branch_source/PullRequestSCMHead.java#L48], [Bitbucket Branch Source|https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/c79f7c340cac7455b90d963bdaba9f4fb7dd2c25/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/PullRequestSCMHead.java#L48], [Gitea|https://github.com/jenkinsci/gitea-plugin/blob/62855b3c3d8c119302b1156f5d3b0b3460810f76/src/main/java/org/jenkinsci/plugin/gitea/PullRequestSCMHead.java#L32], and [P4|https://github.com/jenkinsci/p4-plugin/blob/4a564282febb6a94a5833c02c0fce1f3d7e657cc/src/main/java/org/jenkinsci/plugins/p4/scm/P4ChangeRequestSCMHead.java#L12] plugins already do. Currently, BitbucketWebhookConsumer.BitbucketSCMHeadPullRequestEvent just [uses GitBranchSCMHead|https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/blob/470a7380c0f4141635371ff178c66103ff6bf49c/src/main/java/com/atlassian/bitbucket/jenkins/internal/trigger/BitbucketWebhookConsumer.java#L255-L256].
          Martin Henschke made changes -
          Link New: This issue causes JENKINS-66786 [ JENKINS-66786 ]
          Thomas Beck made changes -
          Priority Original: Minor [ 4 ] New: Critical [ 2 ]
          Kalle Niemitalo made changes -
          Remote Link New: This issue links to "Implement ChangeRequestSCMHead2 for SCMHead & SCMRevision · Pull Request #382 · jenkinsci/atlassian-bitbucket-server-integration-plugin (Web Link)" [ 28709 ]

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

              Created:
              Updated:
              Resolved: