Skip to content

New branch discovery strategy: only explicitly listed#762

Open
hcorg wants to merge 2 commits intojenkinsci:masterfrom
hcorg:feature-only-explicit-branches-strategy
Open

New branch discovery strategy: only explicitly listed#762
hcorg wants to merge 2 commits intojenkinsci:masterfrom
hcorg:feature-only-explicit-branches-strategy

Conversation

@hcorg
Copy link
Copy Markdown

@hcorg hcorg commented Mar 5, 2026

Use case: I want to build only "main" branch and MRs. Existing "Only Branches that are filed as MRs" strategy has built-in bug - it does build branch when there's only one MR. It might be required by it being "legacy" (I've filled issue #761). This MR adds new strategy that filters out all branches except for the ones matching the regex pattern.

As part of the MR I've also extracted duplicated pattern checking code to the base class.

I think that this strategy could replace "Only Branches that are filed as MRs", because it looks like the strategy that one was supposed to be (they behave the same when there are more than one MR, or to be precise - MRs with various source branches). But maybe the "legacy behaviour" is important. Let me know - I can change the PR to replace old strategy.

Testing done

My local instance of the Jenkins runs with the option enabled and it works as expected:

image image

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@hcorg hcorg requested a review from jetersen as a code owner March 5, 2026 13:22
@hcorg hcorg force-pushed the feature-only-explicit-branches-strategy branch from d303fbf to 0ca0e05 Compare March 5, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant