jenkinsci / jenkinsci/github-branch-source-plugin

[JENKINS-70546] Organization folder multiple sources not honored

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

Description

I'm working with an organization folder using the Github Branch Source Plugin. My aim is to have builds automatically start under two conditions:



  • A change is being merged to the base branch (main or master)

  • A branch has been created AND is marked as a pull request.

To achieve this, I configure the folder to discover branches with two sets of config. I.e. I have multiple sources. The first one looks for PRs using the "Discover pull requests..." behaviour. The second looks for base merges using the "Discover branches" behaviour along with a wildcard filter. I configured it this way because I found with a single source, it was impossible to put together a single set of behaviours that met my requirements without triggering builds for all branches - PR or otherwise. 

Expected behaviour

Repositories that contain branches meeting either/both source criteria are created in the folder. I.e. if a repo contains PRs AND main branches, both of those things would be discovered.

Actual behaviour

Repositories are scanned and depending on which source criteria is met first, the other is then ignored in the future. For example, if I have a Jenkinsfile in my main branch and then do a PR, the PR is ignored because the project is now only expecting to see main branch changes. The same happens on the reverse (more realistic example)... I have a repo without a Jenkinsfile so I create a PR for it. I then merge my PR but the merge is ignored. 

---
Originally reported by tb0283970, imported from: Organization folder multiple sources not honored


  • status: Open
  • priority: Blocker
  • component(s): github-branch-source-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-02

Raw content of original issue

I'm working with an organization folder using the Github Branch Source Plugin. My aim is to have builds automatically start under two conditions:



  • A change is being merged to the base branch (main or master)

  • A branch has been created AND is marked as a pull request.

To achieve this, I configure the folder to discover branches with two sets of config. I.e. I have multiple sources. The first one looks for PRs using the "Discover pull requests..." behaviour. The second looks for base merges using the "Discover branches" behaviour along with a wildcard filter. I configured it this way because I found with a single source, it was impossible to put together a single set of behaviours that met my requirements without triggering builds for all branches - PR or otherwise. 

Expected behaviour

Repositories that contain branches meeting either/both source criteria are created in the folder. I.e. if a repo contains PRs AND main branches, both of those things would be discovered.

Actual behaviour

Repositories are scanned and depending on which source criteria is met first, the other is then ignored in the future. For example, if I have a Jenkinsfile in my main branch and then do a PR, the PR is ignored because the project is now only expecting to see main branch changes. The same happens on the reverse (more realistic example)... I have a repo without a Jenkinsfile so I create a PR for it. I then merge my PR but the merge is ignored. 

1 attachment

- [SCR-20230202-jde.png](https://issues.jenkins.io/secure/attachment/59919/SCR-20230202-jde.png)
> ![SCR-20230202-jde.png](https://issues.jenkins.io/secure/attachment/59919/SCR-20230202-jde.png)

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.