This is an extension or variant of How to configure Git post commit hook
The problem I have is that I do not want one build per commit. What I want instead is trigger a single instance of a build at a time. While that single instance is running, new requests can accumulate, but they should be consolidated into a single new build once the current build completes.
Obviously, the triggering should be on git revisions which are meaningfully related, usually from the same branch, and the build should always execute on the triggering revision closest to HEAD (does that make sense?).
So, for the sake of this question, assume everyone is pushing to master, and I place a git hook to trigger the build. How do I make it so that pending requests are merged into a single requests instead of queuing up as separate builds?
This behavior is trivially configurable by using polling, but I don't want to use polling for a variety of unrelated reasons (large number of jobs + need to poll multiple repos consumed by a single job).
Jenkins parameterized job that only queues one build offers one possibility: Use a "launcher" job which terminates quickly and launches the actual working job with "Combine Queued git hashes". The problem with this approach is that the launcher job needs to check out the repo prior to launching the working job. Given a large git repo, this introduces an unacceptable delay.