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

Webhook does a scan for all refs instead only one from the payload

      I am getting rate limit issues due to this. Looking into Multibranch Pipeline Events - I can see every time Jenkins gets a payload, it does a scan on all the refs instead of the one it gets in the payload i.e.

                "type": "branch",
                "name": "name-of-branch", 

      The number of requests Jenkins makes to Bitbucket Server grows exponentially with a number of branches and pushes to them.

          [JENKINS-65909] Webhook does a scan for all refs instead only one from the payload

          llibicpep, scddev was kind enough to provide a fix for this - can you please verify if it is looking better now?

          Günter Grodotzki added a comment - llibicpep , scddev was kind enough to provide a fix for this - can you please verify if it is looking better now?

          Since this issue seems to be the only change in v737 I'm dropping this here.
          Since I updated to v737 on our server receiving a webhook from BitBucket (Cloud) results in the branch that is changed being disabled, as if the branch was deleted and no build job being started started.

          Here's the observations so far:

          • No errors in Jenkins.log.
          • The webhook does arrive, but Multibranch Pipeline Events shows 0 branches were processed. Nothing about disabling branches though...
          • Running a Multibranch Pipeline scan re-enables the branch, finds the changes and starts a build as expected.
          • Rolling the plugin back to v434 makes everything work as expected again.

          Could it be that the patch here works for BitBucket server, but not for Cloud?

          Arjan Veenstra added a comment - Since this issue seems to be the only change in v737 I'm dropping this here. Since I updated to v737 on our server receiving a webhook from BitBucket (Cloud) results in the branch that is changed being disabled, as if the branch was deleted and no build job being started started. Here's the observations so far: No errors in Jenkins.log. The webhook does arrive, but Multibranch Pipeline Events shows 0 branches were processed . Nothing about disabling branches though... Running a Multibranch Pipeline scan re-enables the branch, finds the changes and starts a build as expected. Rolling the plugin back to v434 makes everything work as expected again. Could it be that the patch here works for BitBucket server, but not for Cloud?

          Martin Theiss added a comment -

          avee : Same issue happens randomly also with BitBucket (Server)

          Martin Theiss added a comment - avee  : Same issue happens randomly also with BitBucket (Server)

          Ryan Tanay added a comment - - edited

          +1 for use with Bitbucket cloud.

          Additional information - Hook as follows:

          Triggerspullrequest:created, pullrequest:fulfilled, repo:push, pullrequest:updated

          • All hooks fire and receive a 200 response from Jenkins
          • pullrequest:created and pullrequest:updated triggered hooks initiate builds
          • pullrequest:fulfilled results in the target branch appearing as disabled in Jenkins and no build performed
          • repo:push results in no branch build and push of new branches does not result in the new branch appearing in Jenkins
          • Multibranch Pipeline Scan, as above, finds new branches and initiates branch builds as expected

          Ryan Tanay added a comment - - edited +1 for use with Bitbucket cloud. Additional information - Hook as follows: Triggers :  pullrequest:created, pullrequest:fulfilled, repo:push, pullrequest:updated All hooks fire and receive a 200 response from Jenkins pullrequest:created and pullrequest:updated triggered hooks initiate builds pullrequest:fulfilled results in the target branch appearing as disabled in Jenkins and no build performed repo:push results in no branch build and push of new branches does not result in the new branch appearing in Jenkins Multibranch Pipeline Scan, as above, finds new branches and initiates branch builds as expected

          Thanks for the info, I will try to get a setup using bitbucket cloud.

          mtheiss are you using bitbucket data center edition with HA setup, in this case it might be related to the same issue mentioned by sams_gleb where caches are not updated. Basically the REST requests to bitbucket server get a response which is outdated.

          Dietmar Scheidl added a comment - Thanks for the info, I will try to get a setup using bitbucket cloud. mtheiss are you using bitbucket data center edition with HA setup, in this case it might be related to the same issue mentioned by sams_gleb where caches are not updated. Basically the REST requests to bitbucket server get a response which is outdated.

          Martin Theiss added a comment -

          scddev: We are using a datacenter version, but not within an HA setup.

          Martin Theiss added a comment - scddev : We are using a datacenter version, but not within an HA setup.

          Nikolas Falco added a comment -

          This issue should be resolved at least in master code. You should not reach the api limit so easly. Let me know is yet happens in 2025

          Nikolas Falco added a comment - This issue should be resolved at least in master code. You should not reach the api limit so easly. Let me know is yet happens in 2025

            nfalco Nikolas Falco
            llibicpep Dee Kryvenko
            Votes:
            5 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: