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

Unable to looking up Bitbucket Cloud repository for branches HTTP request error. Status: 502: Bad Gateway

XMLWordPrintable

      Jenkins ver. 2.67
      Pipeline: Multibranch 2.16
      Bitbucket Plugin 1.1.5
      Bitbucket Branch Source Plugin 2.2.3

      It works fine for my personal public repository zhench86/shpolyanskiy-test:

      [Tue Sep 26 12:17:00 MSK 2017] Starting branch indexing...
      Connecting to https://bitbucket.org using MY_USERNAME/******
      Repository type: Git
      Looking up zhench86/shpolyanskiy-test for branches
      
      Checking branch branch5 from zhench86/shpolyanskiy-test
            'Jenkinsfile' found
      
      ....
      
        18 branches were processed
      [Tue Sep 26 12:17:10 MSK 2017] Finished branch indexing. Indexing took 9.8 sec
      Finished: SUCCESS
      

      but fails on our customer repository with 502 error (btw everything works fine if I use common Git Checkout instead of 'Bitbucket Branch Source Plugin')

      [Tue Sep 26 12:17:18 MSK 2017] Starting branch indexing...
      Connecting to https://bitbucket.org using MY_USERNAME/******
      Repository type: Git
      Looking up CUSTOMER_REPO/CUSTOMER_PROJECT for branches
      
      ERROR: [Tue Sep 26 12:17:49 MSK 2017] Could not fetch branches from source 30951833-feb3-41f0-b74a-4c3a6990b546
      com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 502: Bad Gateway.
      	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRequest(BitbucketCloudApiClient.java:599)
      	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getBranches(BitbucketCloudApiClient.java:318)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource$2.create(BitbucketSCMSource.java:559)
      	at com.cloudbees.jenkins.plugins.bitbucket.LazyIterable.iterator(LazyIterable.java:57)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieveBranches(BitbucketSCMSource.java:745)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:573)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:355)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:265)
      	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:634)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:276)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
      	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:978)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:415)
      Finished: FAILURE
      

      Bitbucket Cloud support replied:

      The plugin might be using an API call to get the branches, using version 1 of our API. The repo CUSTOMER_REPO/CUSTOMER_PROJECT has a very large number of branches, checking from the UI I can see about 17 pages of branches. Version 1 of our API is not paginated and usually fails with repos that have such a large number of branches. (Your repo zhench86/shpolyanskiy-test on the other hand, has only 18 branches, a much smaller number than the other repo).

      In order to confirm whether this theory is correct, we would need to know though if the command executed by the plugin is indeed an API call (with v.1 of our API) when it fails.

      My suggestion here would be to contact Jenkins support, and ask them if they can let you know what is the exact command executed when you get this failure. This way we can better determine if my theory here is correct.

            Unassigned Unassigned
            zhench86 Yevgeniy Shpolyanskiy
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: