I'm trying DSL job plugin to create new jobs in Jenkins. Is there a way to specify the view when creating the job?
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 like this:
job {
name 'dsl-created-job1'
//view 'NewJobsView'
//or view {...} to specify the view
}
What if you do:
Or even use a regex at the view.
UPDATE
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.
I got this working. It creates a job, then creates a view and adds the job to the view. This solution recreates the view every time. You can add multiple jobs using name('jobname1') or names('jobname1','jobname2'). You can also add existing jobs referencing them by name in the same manner.
If you just want to place the generated job in an existing view instead of having to look for it within tens of jobs and without having to recreate views each time, here is a very simple workaround:
Workaround:
You might also want to check this answer.