Jenkins 'Branches to Build' field purpose with Github web hook 'Pull Requests'?

27 Views Asked by At

I have a Jenkins freestyle job that works with a GitHub web hook to run tests when particular branches are pushed to the github server. It works as expected.

Jenkins version: 2.426.3
Github version: 3.10.6

Here is the jenkins job setup:

SCM
    Git
        Repositories
            Repo URL
            credentials
        Branches to Build
            :^((ref[\/])?origin[\/])?(branchA)$
Build Triggers
    GitHub hook trigger for GITScm polling
Build Environment
    Delete workspace before build starts
Build Steps
    <some sh commands>

Here is my GitHub web hook:

Payload URL 
    https://my-jenkins-server/github-webhook/
Content type
    application/x-www-form-urlencoded
Secret
    <secret>
SSL verification
    Enable SSL verification
Which events would you like to trigger this webhook?
    Just the push event

Now I want to convert the web hook to execute on Github pull request activity only, so I update the webhook like this:

Which events would you like to trigger this webhook?
    Let me select individual events
        Pull requests

And I leave the Jenkins job as is. I expect that when I perform some PR activity on the branch specified in the jenkins job, it will kick off that job. But that did not happen. What actually happened is that the github web hook ran PR activity on all branches (not too surprising since I don't see a way to specify branches in the web hook), and the only jenkins job kicked off was for the push to github server.

What is the purpose of the 'Branches to Build' value when the Github web hook 'Pull Requests' option is used as the trigger?

Note: Using the github pull request builder plugin is not an option in this case.

0

There are 0 best solutions below