创建在同一视图中创建新作业的作业DSL [英] Create a Job DSL that creates a new job in the same View
本文介绍了创建在同一视图中创建新作业的作业DSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用DSL作业插件在Jenkins中创建新作业.创建作业时是否可以指定视图?
I'm trying DSL job plugin to create new jobs in Jenkins. Is there a way to specify the view when creating the job?
例如,我有一个视图NewJobsView
.我想创建一个名为dsl-job
的DSL作业,它正在创建一个新的作业"dsl-created-job1"
For example, I have a view NewJobsView
. I want to create a DSL job called dsl-job
and it is creating a new job "dsl-created-job1"
DSL这样:
job {
name 'dsl-created-job1'
//view 'NewJobsView'
//or view {...} to specify the view
}
推荐答案
该怎么办?
def myJob=job{name('test1')}
def myJob2=job{name('test2')}
view {
name('view1')
jobs{
name(myJob.name)
name(myJob2.name)
}
}
甚至在视图上使用正则表达式.
Or even use a regex at the view.
更新
关于讨论. 嵌套视图只是另一种视图.作业config.xml没有引用视图,因为jenkins具有不同的抽象:视图引用了作业.
About the discussion. The nested view is just a different kind of view. The job config.xml doesn't have reference to the view because jenkins has a different abstraction: a view references to jobs.
这篇关于创建在同一视图中创建新作业的作业DSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文