• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • OpenJDK 1.8.0_212-8u212-b01-1~deb9u1-b01, Jenkins 2,164.2, github-branch-source 2.4.5
      os.arch amd64
      os.name Linux
      os.version 4.15.0-1037-azure

      We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

      {{when { changeRequest() } }}

      However, if we create the pull requests as draft pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

      <traits>
      <org.jenkinsci.plugins.github_branch_source.BranchDiscoveryTrait>
      <strategyId>1</strategyId>
      </org.jenkinsci.plugins.github_branch_source.BranchDiscoveryTrait>
      <org.jenkinsci.plugins.github_branch_source.OriginPullRequestDiscoveryTrait>
      <strategyId>1</strategyId>
      </org.jenkinsci.plugins.github_branch_source.OriginPullRequestDiscoveryTrait>
      <org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait>
      <strategyId>1</strategyId>
      <trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>
      </org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait>
      <org.jenkinsci.plugins.github_branch_source.TagDiscoveryTrait/>
      </traits>

          [JENKINS-57206] Support draft pull requests from GitHub

          asgeirn created issue -

          asgeirn added a comment -

          It would appear the issue is related to the GitHub webhook - after the scheduled repository scan, the PR was detected.

          asgeirn added a comment - It would appear the issue is related to the GitHub webhook - after the scheduled repository scan, the PR was detected.
          Liam Newman made changes -
          Description Original: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          {{ when \{ changeRequest() }}}

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{ <traits>}}
          {{ <org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
          {{ <strategyId>1</strategyId>}}
          {{ </org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
          {{ <org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
          {{ <strategyId>1</strategyId>}}
          {{ </org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
          {{ <org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
          {{ <strategyId>1</strategyId>}}
          {{ <trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
          {{ </org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
          {{ <org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
          {{ </traits>}}
          New: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          {{when \{ changeRequest() }}}

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{<traits>}}
          {{<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
          {{<strategyId>1</strategyId>}}
          {{</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
          {{<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
          {{<strategyId>1</strategyId>}}
          {{</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
          {{<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
          {{<strategyId>1</strategyId>}}
          {{<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
          {{</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
          {{<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
          {{</traits>}}
          Liam Newman made changes -
          Description Original: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          {{when \{ changeRequest() }}}

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{<traits>}}
          {{<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
          {{<strategyId>1</strategyId>}}
          {{</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
          {{<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
          {{<strategyId>1</strategyId>}}
          {{</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
          {{<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
          {{<strategyId>1</strategyId>}}
          {{<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
          {{</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
          {{<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
          {{</traits>}}
          New: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          {{when \{ changeRequest() }}}

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{<traits>}}
           {{<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
           {{</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
           {{</traits>}}
          Liam Newman made changes -
          Description Original: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          {{when \{ changeRequest() }}}

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{<traits>}}
           {{<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
           {{</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
           {{</traits>}}
          New: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          when \{ changeRequest() }

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{<traits>}}
           {{<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
           {{</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
           {{</traits>}}
          Liam Newman made changes -
          Description Original: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          when \{ changeRequest() }

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{<traits>}}
           {{<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
           {{</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
           {{</traits>}}
          New: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          {{when \{ changeRequest() }}}

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{<traits>}}
           {{<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
           {{</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
           {{</traits>}}
          Liam Newman made changes -
          Description Original: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          {{when \{ changeRequest() }}}

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{<traits>}}
           {{<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
           {{</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
           {{</traits>}}
          New: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          {\{when { changeRequest() } }}

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{<traits>}}
           {{<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
           {{</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
           {{</traits>}}
          Liam Newman made changes -
          Description Original: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          {\{when { changeRequest() } }}

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{<traits>}}
           {{<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
           {{</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
           {{</traits>}}
          New: We use GitHub PRs as conditions to build prerelease version of our applications using the following pipeline clause:

          {{when \{ changeRequest() } }}

          However, if we create the pull requests as _draft_ pull requests (a nice feature for in-progress work), Jenkins does not detect the PR or create any build for it.  We have enabled the traits below, but I cannot find any hints regarding draft PRs:

          {{<traits>}}
           {{<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{</org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<strategyId>1</strategyId>}}
           {{<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustContributors"/>}}
           {{</org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>}}
           {{<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>}}
           {{</traits>}}

          Ben Langfeld added a comment - - edited

          I'm seeing the following event log entries when a draft PR is created:

          Examining powerhome/nitro-web
          
            Checking branches...
          
            Getting remote branch benlangfeld-patch-1...
          
              Checking branch benlangfeld-patch-1
          
            1 branches were processed
          
            Checking pull-requests...
          
            Getting remote pull request #12231...
          
              Checking pull request #12231
                ‘Jenkinsfile’ not found
              Does not meet criteria
          
              Checking pull request #12231
                ‘Jenkinsfile’ not found
              Does not meet criteria
          
            2 pull requests were processed
          
          Finished examining powerhome/nitro-web
          

          The branch does of course contain a Jenkinsfile. When the same diff is used to open a non-draft PR, the Jenkinsfile is found.

          The only difference in the webhook received is the following:

           

          "draft": true,
          "mergeable_state": "draft",
          

          vs

           

           

          "draft": false,
          "mergeable_state": "unknown",
          

          This difference should not cause the divergence in detection of the Jenkinsfile, but I can't figure out what does; the code is a massive jumble of dependencies. Can someone help me unravel it so I can figure out what's going on here?

           

          Ben Langfeld added a comment - - edited I'm seeing the following event log entries when a draft PR is created: Examining powerhome/nitro-web Checking branches... Getting remote branch benlangfeld-patch-1... Checking branch benlangfeld-patch-1 1 branches were processed Checking pull-requests... Getting remote pull request #12231... Checking pull request #12231 ‘Jenkinsfile’ not found Does not meet criteria Checking pull request #12231 ‘Jenkinsfile’ not found Does not meet criteria 2 pull requests were processed Finished examining powerhome/nitro-web The branch does of course contain a Jenkinsfile. When the same diff is used to open a non-draft PR, the Jenkinsfile is found. The only difference in the webhook received is the following:   "draft" : true , "mergeable_state" : "draft" , vs     "draft" : false , "mergeable_state" : "unknown" , This difference should not cause the divergence in detection of the Jenkinsfile, but I can't figure out what does; the code is a massive jumble of dependencies. Can someone help me unravel it so I can figure out what's going on here?  
          Jordan Jennings made changes -
          Link New: This issue is related to JENKINS-54126 [ JENKINS-54126 ]

            Unassigned Unassigned
            asgeirn asgeirn
            Votes:
            5 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: