Too many jobs running on GitHub push with master/slaves setup
First, let me give some context: - We use Jenkins for the CI of the Hibernate projects. - We have a master/slaves setup on AWS with slaves being terminated when they don't have anything to do so slaves come and go and we can't count on them. - It's a rather new setup as we used a couple of persistent slaves before.
Lately, we have seen that when we push something to a given GitHub branch, all the jobs targeting this repository are launched even if they target a completely different branch and there are no changes at all in this branch. This results in a lot of useless jobs running.
From https://issues.jenkins-ci.org/browse/JENKINS-42161 and https://github.com/jenkinsci/github-plugin/blob/master/src/main/java/org/jenkinsci/plugins/github/webhook/subscriber/DefaultPushGHEventSubscriber.java#L79 , we concluded that polling is run for all the jobs targeting a given repository URL so polling would be run for all branches and the jobs are created only if the polling returns that there are some changes.
Based on this, we think that in our setup, polling probably doesn't work as expected but we don't really know how it works in a master/slaves setup.
We have a couple of questions: - does the master use the workspace dirs of the slaves for polling? - is the polling run on the slaves instead of the master (i.e. do we need to start a slave to run the polling and if so how does it choose the right one)? - is there a way we could get our setup working? Maybe by copying the workspace dirs to the master and have the polling run on these copied directories?
I suspect we are not alone with this kind of setup so any idea/workaround welcome!