Renaming job in jenkins/hudson

前端 未结 8 2125
灰色年华
灰色年华 2020-12-30 20:20

I have tried to rename a hudson/jenkins job. However it failed to rename.

Is there any way so I can rename the job?

相关标签:
8条回答
  • 2020-12-30 21:06
    1. Create a new job with new name, there will be an option of copy from an existing job.
    2. copy from the job you want to rename.
    3. Delete the original job.

    Now you have an identical job with a different name.

    0 讨论(0)
  • 2020-12-30 21:06

    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())
        }
      }
    }
    
    0 讨论(0)
提交回复
热议问题