如何通过Jenkins中的Groovy复制/克隆作业?
我正在尝试复制一个现有的Jenkins作业,并使用Groovy在同一文件夹中重命名它。 此外,我想搜索并替换git“polling ignores commits In specific path”消息框中的一个单词如何通过Jenkins中的Groovy复制/克隆作业?,jenkins,groovy,Jenkins,Groovy,我正在尝试复制一个现有的Jenkins作业,并使用Groovy在同一文件夹中重命名它。 此外,我想搜索并替换git“polling ignores commits In specific path”消息框中的一个单词 有可能吗?如果有,怎么做?我需要解决一个类似的问题,我发现了这个问题 我才意识到我没有回答整个问题。看 import hudson.model.* def viewName = "product-build-dev" def search = "-dev" def replace
有可能吗?如果有,怎么做?我需要解决一个类似的问题,我发现了这个问题 我才意识到我没有回答整个问题。看
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()
}