I'm trying to resolve the nearly-a-decade-old bug to allow Jenkins to do one build per commit, without dirty workarounds in dispatcher jobs. Currently, it'll bundle together multiple commits received at once - for example, a user does "git push" to send more than one commit.
I've written a custom BuildChooser for the git plugin, which correctly determines a list of commits to build, between the last known build and HEAD (DefaultBuildChooser basically determines the commitid of HEAD and passes that down in a single-entry array).
Is there really nowherere in the API to do project.scheduleBuild(arbitraryBuildObject) or equivalent, to make actual use of the candidates array i've already generated? The current behaviour seems terribly racy (behaviour seems to vary depending on how quickly I step through breakpoints, and the size of the array). At best, right now I have it sometimes (but not always) building last-known-revision..HEAD~1 as the current job then scheduling HEAD as the next job