Last active
August 24, 2016 11:14
-
-
Save epishan/010c43227200eeb29c25f833c553dd2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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