I have more than 100 jobs in Jenkins and I have to change a Git URL in each and every job since we changed the git server. I must traverse each job and change the Git URL. Can anyone help me with a groovy script?
I was able to traverse each job, but not able to get the Git URL or change it:
import hudson.plugins.emailext.*
import hudson.model.*
import hudson.maven.*
import hudson.maven.reporters.*
import hudson.tasks.*
// For each project
for(item in Hudson.instance.items) {
println("JOB : " + item.name);
}
I badly need help in this, please someone help me.
I would have shut the server down and edited all the config.xml files with a script(sed/awk perl or something) and then restarted jenkins to load the new configurations.
If shutting down jenkins is not an option it is posible to get edit and post every config.xml with something like this