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

Non-mergable Pull-request Contents Get into GH Cache with False-Positive 404

      How to reproduce:

      Use multibranch-pipeline workflow with merge PR strategy

      1. Create a branch, develop it and make it nonmergable into the target branch
      2. Push the branch and open the Pull Request in GH
      3. Find out that the branch is not-mergeable
      4. Fix the code, push the newer revision

      Expected Result:

      The pipeline is triggered.

      Actual Result:

      1. On step #2 Jenkins gets the 404 in the request to ...refs/pull/<id>/merge/contents
      2. The 404 is cached
      3. On the step 4 it does not query GH but rather returns a cryptic error of 'Jenkins File not found' although it does not check for it at all

      Proposed solution: do not check for the contents of the "refs./..../merge" URL if the PR is not mergable.

      Versions:

      Jenkins 2.190.1
      GitHub Branch Source Plugin 2.5.8+ (some irrelevant local patches)

      Here is how we figured out what was happening:

      1. Get the repro of the bug
      2. Jump to the jenkins master node and create a copy of github cache dir, namely "${JENKINS_HOME}/org.jenkinsci.plugins.github_branch_source.GitHubSCMProbe.cache"
      3. grep for the pull request id in the *.0 files to figure out the  request id (prefix before the '.0') of the exchange with Github 
      4. zcat the file of the exchange (<reqid>.1) and see that Jenkins checks the refs/pull/<prid>/merge/contents and gets 404
      5. Jenkins never consults anything after getting this response until the cache entry with 404 is purged, but writes a cryptic message like 'Jenkinsfile not found' and (possibly) the lines saying that the PR branch is dead, thus being removed from the list of branches to run the build against,

      While surfing looking for the similar bugs, I noticed several that might be related to those ones, especially the first one.

      https://issues.jenkins-ci.org/browse/JENKINS-48571

      https://issues.jenkins-ci.org/browse/JENKINS-46290

      https://issues.jenkins-ci.org/browse/JENKINS-54126

      https://issues.jenkins-ci.org/browse/JENKINS-57206

      https://issues.jenkins-ci.org/browse/JENKINS-57411

       

       

        1. screenshot-4.png
          344 kB
          Karl Shultz
        2. screenshot-3.png
          572 kB
          Karl Shultz
        3. screenshot-2.png
          755 kB
          Karl Shultz
        4. screenshot-1.png
          484 kB
          Karl Shultz

          [JENKINS-60353] Non-mergable Pull-request Contents Get into GH Cache with False-Positive 404

          Vladimir Kuklin created issue -
          Vladimir Kuklin made changes -
          Description Original: How to reproduce:

          Use multibranch-pipeline workflow
           # Create a branch, develop it and make it nonmergable into the target branch
           # Push the branch and open the Pull Request in GH
           # Find out that the branch is not-mergeable
           # Fix the code, push the newer revision
           #
          New: How to reproduce:

          Use multibranch-pipeline workflow with merge PR strategy
           # Create a branch, develop it and make it nonmergable into the target branch
           # Push the branch and open the Pull Request in GH
           # Find out that the branch is not-mergeable
           # Fix the code, push the newer revision

          Expected Result:

          The pipeline is triggered.

          Actual Result:
           # On step #2 Jenkins gets the 404 in the request to ...refs/pull/<id>/merge/contents
           # The 404 is cached
           # On the step 4 it does not query GH but rather returns a cryptic error of 'Jenkins File not found' although it does not check for it at all

          Proposed solution: do not check for the contents of the "refs./..../merge" URL if the PR is not mergable.


          Versions:

          Jenkins 2.190.1
          GitHub Branch Source Plugin 2.5.8+ (some irrelevant local patches)
          Vladimir Kuklin made changes -
          Description Original: How to reproduce:

          Use multibranch-pipeline workflow with merge PR strategy
           # Create a branch, develop it and make it nonmergable into the target branch
           # Push the branch and open the Pull Request in GH
           # Find out that the branch is not-mergeable
           # Fix the code, push the newer revision

          Expected Result:

          The pipeline is triggered.

          Actual Result:
           # On step #2 Jenkins gets the 404 in the request to ...refs/pull/<id>/merge/contents
           # The 404 is cached
           # On the step 4 it does not query GH but rather returns a cryptic error of 'Jenkins File not found' although it does not check for it at all

          Proposed solution: do not check for the contents of the "refs./..../merge" URL if the PR is not mergable.


          Versions:

          Jenkins 2.190.1
          GitHub Branch Source Plugin 2.5.8+ (some irrelevant local patches)
          New: How to reproduce:

          Use multibranch-pipeline workflow with merge PR strategy
           # Create a branch, develop it and make it nonmergable into the target branch
           # Push the branch and open the Pull Request in GH
           # Find out that the branch is not-mergeable
           # Fix the code, push the newer revision

          Expected Result:

          The pipeline is triggered.

          Actual Result:
           # On step #2 Jenkins gets the 404 in the request to ...refs/pull/<id>/merge/contents
           # The 404 is cached
           # On the step 4 it does not query GH but rather returns a cryptic error of 'Jenkins File not found' although it does not check for it at all

          Proposed solution: do not check for the contents of the "refs./..../merge" URL if the PR is not mergable.

          Versions:

          Jenkins 2.190.1
           GitHub Branch Source Plugin 2.5.8+ (some irrelevant local patches)

          Here is how we figured out what was happening:
           # Get the repro of the bug
           # Jump to the jenkins master node and create a copy of github cache dir, namely "${JENKINS_HOME}/org.jenkinsci.plugins.github_branch_source.GitHubSCMProbe.cache"
           # grep for the pull request id in the *.0 files to figure out the  request id (prefix before the '.0') of the exchange with Github 
           # zcat the file of the exchange (<reqid>.1) and see that Jenkins checks the refs/pull/<prid>/merge/contents and gets 404
           # Jenkins never consults anything after getting this response until the cache entry with 404 is purged, but writes a cryptic message like 'Jenkinsfile not found' and (possibly) the lines saying that the PR branch is dead, thus being removed from the list of branches to run the build against,

          While surfing looking for the similar bugs, I noticed several that might be related to those ones, especially the first one.

          https://issues.jenkins-ci.org/browse/JENKINS-48571

          https://issues.jenkins-ci.org/browse/JENKINS-46290

          https://issues.jenkins-ci.org/browse/JENKINS-54126

          https://issues.jenkins-ci.org/browse/JENKINS-57206

          https://issues.jenkins-ci.org/browse/JENKINS-57411

           

           
          Karl Shultz made changes -
          Assignee New: Karl Shultz [ kshultz ]
          Karl Shultz made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Karl Shultz made changes -
          Link New: This issue is related to JENKINS-54126 [ JENKINS-54126 ]
          Karl Shultz made changes -
          Attachment New: screenshot-1.png [ 49954 ]
          Karl Shultz made changes -
          Attachment New: screenshot-2.png [ 49955 ]
          Karl Shultz made changes -
          Attachment New: screenshot-3.png [ 49956 ]
          Karl Shultz made changes -
          Attachment New: screenshot-4.png [ 49957 ]
          Liam Newman made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Fixed but Unreleased [ 10203 ]

            kshultz Karl Shultz
            vkuklinatjoom Vladimir Kuklin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: