Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jenkins is not starting in installation phase - bitbucket rate limiting error #2511

Open
rnkhouse opened this issue Jun 14, 2024 · 0 comments
Labels

Comments

@rnkhouse
Copy link

rnkhouse commented Jun 14, 2024

Description

Sometimes, jenkins is not starting and shutting down in organization folder scan step. I found out that getting rate limiting error from bitbucket server because of many requests from jenkins.

How can I make sure not to scan all branches when I start the instance. I am using below config:

organizationFolder('my-bitbucket') {
  description("Bitbucket org folder configured with JCasC")
  displayName('project')
  organizations {
    bitbucket {
      serverUrl("https://bitbucket.org")
      repoOwner("project")
      credentialsId("bitbucket")
    }
  }
  configure { node ->
      def traits = node / navigators / 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator' / traits
      traits << 'com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait' {
          strategyId('1')
      }
      traits << 'jenkins.scm.impl.trait.WildcardSCMSourceFilterTrait' {
          includes('project1 project2 project3')
      }
      traits << 'jenkins.scm.impl.trait.WildcardSCMHeadFilterTrait' {
          includes('alpha develop staging master')
      }
      traits << 'com.cloudbees.jenkins.plugins.bitbucket.OriginPullRequestDiscoveryTrait' {
          strategyId('1')
      }
      traits << 'com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait' {
          strategyId('1')
          trustID('1')
      }
  }
  projectFactories {
      workflowMultiBranchProjectFactory {
          scriptPath 'Jenkinsfile'
      }
  }
  orphanedItemStrategy {
    discardOldItems {
      daysToKeep(-1)
      numToKeep(-1)
    }
  }
  buildStrategies {
    buildAllBranches {
      strategies {
        skipInitialBuildOnFirstBranchIndexing()
      }
    }
  }
}

Jenkins shutting down after logs like this:

2024-06-14 20:23:27.972+0000 [id=30] INFO c.c.h.p.folder.AbstractFolder#lambda$onLoad$4: Loading job bitbucket-cluster/project1 (593.3%)

These are the logs we got from bitbucket for rate limiting:

/2.0/repositories/My-project/project1/src/5e7647700b366aab5e254312fba0127757a7e0be/Jenkinsfile - 1034
/2.0/repositories/My-project/project1/pullrequests?page=1&pagelen=50 - 947
/2.0/repositories/My-project/project2/src/6dbba8a547047884f3aff794910abc522cc7e691/Jenkinsfile - 912
/2.0/repositories/My-project/project2/pullrequests?page=2&pagelen=50 - 346
/2.0/repositories/My-project/project2/pullrequests?page=1&pagelen=50 - 153
/2.0/repositories/My-project/project1/refs/branches/develop - 10

As you can see, it's hitting PRs and different branches those we don't even have in above config.

@rnkhouse rnkhouse changed the title Jenkins is not starting in installation phase Jenkins is not starting in installation phase - bitbucket rate limiting error Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant