简体   繁体   中英

Jenkins pull request plugin triggers builds from all branches in a repo and not a specific branch

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM