I have tried to rename a hudson/jenkins job. However it failed to rename.
Is there any way so I can rename the job?
copy from
an existing job.copy from
the job you want to rename.Now you have an identical job with a different name.
I can't make Marc's script work, so write one based on Disable all jobs script as shown below. This is to rename any project with "Findur.OpenComponent" to "Findur.OpenComponents".
import hudson.model.*
renameChildren(Hudson.instance.items)
def renameChildren(items) {
for (item in items) {
if (item.class.canonicalName != 'com.cloudbees.hudson.plugins.folder.Folder') {
if (( m = item.name =~ /^(Findur.OpenComponent)(\..*)$/)){
println(item.name)
println m.group(1) + " " + m.group(2)
newname = m[0][1] + 's' + m.group(2)
item.renameTo(newname)
}
} else {
renameChildren(((com.cloudbees.hudson.plugins.folder.Folder) item).getItems())
}
}
}