Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-21723

Improve Bamboo's integration with Bitbucket cloud

XMLWordPrintable

    • 0
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Issue Summary

      Currently, Bitbucket Cloud rate limits REST API calls for /2.0/repositories/* to 1000 per user per hour (API request limits).
      Reaching this limit is quite easy if multiple repositories configured with the same user.

      Bamboo relays on REST API from /2.0/repositories/* for:

      • branch detection
      • pull request detection
      • tag detection
      • build status updates

      Which can be quite frequent operations.

      This is reproducible on Data Center: (yes)

      Steps to Reproduce

      1. Setup multiple plans that consume Bitbucket cloud repositories linked to Bamboo with the same user.
      2. Enable on those plans one or more of:
        1. plan branch creation when a pull request is open.
        2. plan branch creation when a new branch is created.
        3. build is triggered by a new tag on the repository.

      Expected Results

      Bamboo should be able to update the build status as well as create branches/builds in the builds using Bitbucket cloud repositories.

      Actual Results

      The below exception is thrown in the atlassian-bamboo.log file:

      2022-04-25 10:22:21,580 WARN [13-PullRequestDetectionBackgroundThread:pool-20-thread-1] [PullRequestDetector] com.sun.jersey.api.client.UniformInterfaceException: GET https://api.bitbucket.org/2.0/repositories/******/********/pullrequests?state=OPEN returned a response status of 429 null
      com.atlassian.bamboo.repository.RepositoryException: com.sun.jersey.api.client.UniformInterfaceException: GET https://api.bitbucket.org/2.0/repositories/*******/*******/pullrequests?state=OPEN returned a response status of 429 null
          at com.atlassian.bamboo.plugins.bitbucket.v2.BitbucketCloudPullRequestDetector.getOpenPullRequests(BitbucketCloudPullRequestDetector.java:71)
          at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.getOpenPullRequests(RepositoryCachingFacadeImpl.java:100)
          at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.call(RepositoryCachingFacadeImpl.java:96)
          at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.call(RepositoryCachingFacadeImpl.java:93)
          at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:39)
          at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:35)
          at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3528)
          at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2277)
          at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2154)
          at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2044)
          at com.google.common.cache.LocalCache.get(LocalCache.java:3952)
          at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
          at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4958)
          at com.atlassian.bamboo.utils.collections.AlwaysInvalidatingCacheDecorator.get(AlwaysInvalidatingCacheDecorator.java:65)
          at com.atlassian.bamboo.utils.collections.AlwaysInvalidatingCacheDecorator.getUnchecked(AlwaysInvalidatingCacheDecorator.java:126)
          at com.atlassian.bamboo.util.CallableResultCache.call(CallableResultCache.java:142)
      
      

      Workarounds

      1. Increase the Branch and tag detection interval

      It's possible to set a longer interval for the branch, pull requests and tag detection. You can increase this interval in: Cog Icon > Overview > General Configuration > Branch and tag detection interval

      Increasing the interval fro the branch detection might increase the time Bamboo takes to trigger a new build/create a new branch.

      2. Increase the pull request cache validity

      In case you have several plans consuming the same repository you can increase the pull request cache validity and avoid performing a new pull request verification for every plan.
      The pull request cache validity time can be set with the following argument:

      -Dbamboo.pull.request.cache.ttl.seconds=300
      

      3. Use multiple/different users for different repositories

      The current Bitbucket cloud limit is on the REST API calls of the same user ID. Setting up repositories in Bamboo with different user IDs can circumvent the limit.

              Unassigned Unassigned
              sorlovski Zaro (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: