You might consider the "pipeline plugin". It includes a multi-branch facility which will automatically configure a new job for any branch which has a "Jenkinsrule" file defined at the root of that repository. I've found it very helpful to allow me to add and remove jobs from my setup just by adding or removing a Jenkinsrule file which contains the job definition.
I only recently started using this based on the tutorial at https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md . It isn't as full featured as a typical job definition, but it is very elegant for its simplicity in defining jobs easily from multiple branches of a repository. Mark Waite On Wed, Mar 9, 2016 at 1:25 PM Francois Marot <francois.ma...@gmail.com> wrote: > Hello all jenkins users, > > I'd like to have some advice on the best way to have a git hook triggering > a job but only for some branches (hence the notion of "whitelisted > branched"). > > The use case is that some old branches are not buildable by the job. Only > some recent branches are. BUT some commit may be made to the old branches > because we have to support old version of the software. > > I would not like those commit to trigger my job. > > I have a few possibilities but none suits me well: > - creating one job per branch to be built. That's a huge overhead and not > maintainable > - configure the git hook not to trigger jenkins for the old branches. > Simple BUT jenkins will still try to build the old branches once commit are > made into them and a recent branch triggers the job (as by default the > Jenkins git plugin builts all branches where commits have been made since > the last job execution) > - configure the regexp for the branch to be built. I, hum... regexp... > well.. no thanks ;) > - start a convention on branch naming (with a specifix prefix or suffix) > so I can easily configure the regexp. It may be the best idea yet but some > existing branches that have to be built do not match any convention. > > So unless someone points me to a whitelist kind of filter for branches to > be built, I think I 'll go with the last solution. Any idea ? > > Regards > François > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/ab18f096-ca0b-4bb6-a02f-82f9da6cb4f5%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/ab18f096-ca0b-4bb6-a02f-82f9da6cb4f5%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFLDvXgur4UyFeW%2Birr--wyGL4uwAaw%3DDtE%3D84fm9wKdg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.