Github multibranch filtering

465 views
Skip to first unread message

Steven Foster

unread,
Aug 23, 2017, 5:58:05 AM8/23/17
to Jenkins Users
Does the Github multibranch source allow filtering for PRs that target a particular base branch?

So I want to build only branch 'foo/bar' and all PRs that are targeting 'foo/bar'

Mark Waite

unread,
Aug 23, 2017, 7:42:06 AM8/23/17
to Jenkins Users
It supports filtering by branch name so you can limit it to only build certain branches.  Add "Filter by name (with regular expression" or "Filter by name (with wildcards)" to the job configuration to only build specific branches.

It can limit branch discovery to exclude branches that are also filed as pull requests (for pull requests are being submitted in the same repository as the destination branch).  Refer to "Discover branches". 

It can ignore pull requests from the origin repository by deleting the "Discover pull requests from origin" behavior.

If can ignore pull requests from forks by deleting the "Discover pull requests from forks" behavior.

Mark Waite

On Wed, Aug 23, 2017 at 3:58 AM Steven Foster <steven...@gmail.com> wrote:
Does the Github multibranch source allow filtering for PRs that target a particular base branch?

So I want to build only branch 'foo/bar' and all PRs that are targeting 'foo/bar'

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0c8038f4-fa05-496a-8cf5-8b2a4adad8df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Foster

unread,
Aug 23, 2017, 7:47:48 AM8/23/17
to Jenkins Users
Ok, so the functionality to filter based on a PRs base branch isn't there?
For the branch portion, I'm able to make it build only the branch I want. But with PRs, it seems to be all or nothing. In my case there are hundreds of PRs and I'm only interested in building a select few based on a specific branch.

Baptiste Mathus

unread,
Aug 28, 2017, 2:41:52 PM8/28/17
to jenkins...@googlegroups.com
Didn't find it after a 30 seconds look, but possibly there's an env var for the target branch. Then, you could simply add a condition in your pipeline to stop the build immediately if this is not the branch you want.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/406afa5b-ef7f-4ee8-97b9-e9eedb76def5%40googlegroups.com.

Steven Foster

unread,
Aug 28, 2017, 5:10:32 PM8/28/17
to Jenkins Users, m...@batmat.net
This workaround is a good idea, unfortunately it wouldn't work for us because of the amount of PRs. I ended up extending the github branch source plugin to let me filter based on this property. Not sure how to go about contributing this back, or if it's even a feature that would be welcomed.

Stephen Connolly

unread,
Aug 28, 2017, 5:39:06 PM8/28/17
to jenkins...@googlegroups.com

My intention is that people write extension plugins to deliver non-core functionality so that people can install only those filters that they want and the UI remains simpler for the default installation 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1add6daa-b21c-4fe4-b24b-90b9cef426a5%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
Sent from my phone
Reply all
Reply to author
Forward
0 new messages