我正在尝试复制一个现有的Jenkins作业,并使用Groovy将其重命名到同一文件夹中。此外,我想做一个搜索,并替换git "polling ignores In certain“消息框中的一个单词。
这是可能的吗?如果可能,如何实现?
发布于 2018-08-22 05:57:25
我需要解决一个类似的问题,我找到了这个groovy sample for copying all the jobs in a view。
import hudson.model.*
def viewName = "product-build-dev"
def search = "-dev"
def replace = "-prod"
def view = Hudson.instance.getView(viewName)
/* now you copy all jobs of the view copy all projects of a view */
for(item in view.getItems()) {
/* create the new project name */
newName = item.getName().replace(search , replace)
/* now copy the job */
def job = Hudson.instance.copy(item, newName)
job.save()
}
我刚刚意识到我并没有回答整个问题。看..。
https://stackoverflow.com/questions/50647867
复制相似问题