I'd like to configure a single Jenkins build ("job") which will both:
- watch for new branches and build them when they appear
- build a named branch or commit on request
I can achieve (1) by setting "Branches to build" to "**"
I can achieve (2) by making the build parameterised and setting "Branches to build" to "$branch" (like this tutorial)
Is there any way to do both at once?
My use case for (1) is that I want "feature branches" to be tested prior to merging into master, so we can see at code review / pull request time whether the changes pass all tests.
My use case for (2) is that sometimes a build fails for a spurious reason (like a flaky test) and I want to re-run it, or perhaps an old branch has fallen off the bottom of the history and I want to re-run its tests.