2016-09-09 11 views

Odpowiedz

11

Najpierw trzeba zainstalować cloudbees folder plugin wtedy zobaczysz Przenieś opcję w pracy

enter image description here

kliknij na niego, a następnie opcja (rozwijana) pojawi się tam, gdzie chcesz się przenieść enter image description here

wybierz i przenieś

+0

Dziękuję, Twoja odpowiedź za pomocą zrzutów ekranu jest lepsza niż moja – dams

3

Jako że @Pratik Anand wspomniał, że najpierw musisz zainstalować CloudBees Folders Plugin.

Jeśli jednak chcesz przenieść wiele projektów w tym samym czasie, znacznie szybciej jest zrobić to za pomocą script console. Ten Groovy skrypt załatwia sprawę:

def FOLDER_NAME = '<An existing destination folder>' 
def JOB_REGEX = '<A regex to find your jobs>' 

import jenkins.* 
import jenkins.model.* 
import hudson.* 
import hudson.model.* 

jenkins = Jenkins.instance 

def folder = jenkins.getItemByFullName(FOLDER_NAME) 
if (folder == null) { 
    println "ERROR: Folder '$FOLDER_NAME' not found" 
    return 
} 

// Find jobs in main folder 
def found = jenkins.items.grep { it.name =~ "${JOB_REGEX}" } 
println "Searching main folder : $found" 

// Find jobs in other subfolders 
jenkins.items.grep { it instanceof com.cloudbees.hudson.plugins.folder.Folder }.each { subfolder -> 
    if(!subfolder.getName().equals(FOLDER_NAME)) 
    { 
    println "Searching folder '$subfolder.name'" 
    subfolder.getItems().grep { it.name =~ "${JOB_REGEX}" }.each { job -> 
     println "Found $job.name" 
     found.add(job); 
    } 
    } 
} 

// Move them 
found.each { job -> 
    println "Moving '$job.name' to '$folder.name'" 
    Items.move(job, folder) 
} 

Kiedyś odpowiedź Daniela Serodio w this thread i modyfikować go szukać również podfoldery. Zauważ, że nie jest to w pełni rekurencyjne.

Powiązane problemy