-1
我需要編寫一個groovy腳本,與git進行對話,進入存儲庫,獲取文件名列表,將其存儲在數組中並返回。然後我會在Jenkins的選擇參數中顯示。這可能嗎?如何從git回購製作groovy腳本列表文件?
我需要編寫一個groovy腳本,與git進行對話,進入存儲庫,獲取文件名列表,將其存儲在數組中並返回。然後我會在Jenkins的選擇參數中顯示。這可能嗎?如何從git回購製作groovy腳本列表文件?
如果你要使用管道,它會更容易。 您可以使用下面從遞歸目錄獲取文件:
import groovy.io.FileType
def fileList = []
def dir = new File("your_repo_dir")
dir.eachFileRecurse (FileType.FILES) { file ->
fileList << file
}
然後在作業屬性需要添加選擇PARAM:
choiceParam(name: 'Repo Files', choices: fileList.join("\n"), description: '')
肯定。這是可能的。但請提出具體問題。 – StephenKing