jenkinsci / jenkinsci/github-branch-source-plugin

[JENKINS-58111] Github webhooks triggers a multibranch scan of all refs

Open
#1,264 3 comments 0 reactions 0 assignees View on GitHub
component:github-api-plugin component:github-branch-source-plugin component:scm-api-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
217
Forks
398
Avg merge
30m
Merged PRs (30d)
1

Description

Jenkins handles a monorepo well enough when using git scm with ssh clone. If we have the following repo structure:

// code placeholder

api-one/
Jenkinsfile
api-two/
Jenkinsfile
...
api-n/
Jenkinsfile

We create one multibranch pipeline per Jenkinsfile in order to have many independent pipelines (CI + CD) for our projects. These projects all share common code through jenkins shared libraries and everything works ok. 

However, if we want to use the github branch source and want to enable webhooks from github we immediately run into rate limit issues. We have a large repository - thousands of pushes a day. Every time a webhook is fired from github and hits jenkins all N multibranch pipelines begin scanning ALL remote refs for the repository. In our repository there are 10s of thousands of tags.

A single scan on a single multibranch pipeline eliminates our entire github rate limit budget. 

I am not entirely sure why jenkins must rescan the entire repo. It seems at the very least the webhook from github contains all information about the ref to be built and the individual jobs could simply take the webhook at face value and build/delete/etc without requiring a full repository scan. 

 

Is this possible? Why does Jenkins currently scan the entire repo?

 

---
Originally reported by cpoole, imported from: Github webhooks triggers a multibranch scan of all refs


  • status: Open
  • priority: Minor
  • component(s): github-api-plugin, github-branch-source-plugin, scm-api-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 5
  • imported: 2025-12-02

Raw content of original issue

Jenkins handles a monorepo well enough when using git scm with ssh clone. If we have the following repo structure:


// code placeholder

api-one/
Jenkinsfile
api-two/
Jenkinsfile
...
api-n/
Jenkinsfile


We create one multibranch pipeline per Jenkinsfile in order to have many independent pipelines (CI + CD) for our projects. These projects all share common code through jenkins shared libraries and everything works ok. 

However, if we want to use the github branch source and want to enable webhooks from github we immediately run into rate limit issues. We have a large repository - thousands of pushes a day. Every time a webhook is fired from github and hits jenkins all N multibranch pipelines begin scanning ALL remote refs for the repository. In our repository there are 10s of thousands of tags.

A single scan on a single multibranch pipeline eliminates our entire github rate limit budget. 

I am not entirely sure why jenkins must rescan the entire repo. It seems at the very least the webhook from github contains all information about the ref to be built and the individual jobs could simply take the webhook at face value and build/delete/etc without requiring a full repository scan. 

 

Is this possible? Why does Jenkins currently scan the entire repo?

 

environment

```
jenkins 2.176.1

latest versions of all plugins in LTS
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.