Hi Mark, thanks for your answer. In fact I've just found a very straightforward method to do it so I won't use what you suggested. Thanks nevertheless ! Here is how to do it:
in the Jenkins Git plugins config part of my job, I added the "Additionnal Behavior" "*Strategy for choosing what to build*". Then the "Choosing strategy" I selected is "Ancestry". This way, the build is triggered only for the branches which have a common commit ancestry whose SHA-1 is specified. For those interested here is a capture of the config gui: http://imgur.com/nheNJlX On Wednesday, 9 March 2016 21:36:30 UTC+1, Mark Waite wrote: > > 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 <[email protected] > <javascript:>> 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 [email protected] <javascript:>. >> 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a715ac14-6180-4c65-b16b-9d29f802044a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
