Jenkins : Set GitBlitRepositoryBrowser with custum settings on all repos

This scripts allows to update the repo browser. Can be adapted to any other browser, not only gitblit.

import hudson.model.*
import hudson.triggers.*
import hudson.plugins.git.browser.GitBlitRepositoryBrowser

// you might want to change here
def url = 'https://mygitblitserver/gitblit/'
def i = 0
for(item in Hudson.instance.items) {
  def scm = item.scm
  if((scm instanceof hudson.plugins.git.GitSCM) && !(scm.browser instanceof GitBlitRepositoryBrowser)) {
    println('##########')
    println(scm.dump())
    // you might want to change here
    def match = scm.userRemoteConfigs =~ /\/spu\/test\/git\/(.*?.git)/
    if(match) {
      i++
      def projectName = match[0][1]
      println projectName
      scm.browser = new GitBlitRepositoryBrowser(url, projectName)
    }
  }
}
println("$i projects updated")