Skip to content

Instantly share code, notes, and snippets.

@epishan
Last active August 24, 2016 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epishan/010c43227200eeb29c25f833c553dd2c to your computer and use it in GitHub Desktop.
Save epishan/010c43227200eeb29c25f833c553dd2c to your computer and use it in GitHub Desktop.
// Groovy script to rename job in Hudson
import hudson.model.*;
def JOB_PATTERN = ~/^GO.*.deploy_container.staging*$/; //find all jobs starting with "MY_JOB".
def NEW_PART = "_NEW"
(Hudson.instance.items.findAll { job -> job.name =~ JOB_PATTERN }).each { job_to_update ->
if (job_to_update.name =~ "GO.bob_api.*") {
return;
}
else {
println ("Updating job " + job_to_update.name);
def new_job_name = job_to_update.name.replaceFirst("build", "build_binary");
println ("New name: " + new_job_name);
job_to_update.renameTo(new_job_name);
println ("Updated name: " + job_to_update.name);
println("="*80);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment