3
votes

Currently I'm working on setting up Jenkins so that when a pull request is made in GitHub, a build will be triggered and the results sent back to GitHub. All of this is working correctly between Jenkins and GitGub. (I'm using the GitHub pull request builder plugin in Jenkins to do this).

The problem that I am seeing is that I want the Jenkins build to be triggered only when pull request is made for a specific branch. Currently if any branch in the repository has a new pull request, Jenkins is triggered.

How would I change it so that only pull requests from a specific branch triggers Jenkins and not all of the branches in a Git repo? Is it even possible to do this?

The Git repository is set correctly. The refspec is set to +refs/pull/*:refs/remotes/origin/pr/* and the branch specifier is set to ${sha1}. I've also tried to add another branch specifier to the repo which is the actual branch name that I want to use but that didn't do anything.

Please let me know if any more info is required. I'm new to Git and Jenkins and have spent a lot of time trying to figure this out.

1

1 Answers

2
votes

After researching a bit more online, there looks to be an open task already for this issue which needs to be fixed by the Jenkins team. More information in regards to the task can be found at https://issues.jenkins-ci.org/browse/JENKINS-18737.

So currently it doesn't look like there is a way to customize Jenkins so that we can trigger builds for pull requests from specific branches.