How to put jobs inside a folder in jenkins?

Ibtissam picture Ibtissam · Apr 13, 2017 · Viewed 8.8k times · Source

I'm trying to put jobs inside a folder using jenkins DSL script Now i create a listView and i put inside my jobs here the code i'm using

listView('MyJobsList') {
  jobs {
     map.each{
       name((it.key).trim())
     }
  }
   columns{
        status()
        weather()
        name()
        lastSuccess()
        lastFailure()
        lastDuration()
        buildButton()
    }
}

i want to do the same thing but this time i want to put the jobs in a folder !!

Answer

Suresh picture Suresh · Apr 17, 2017

Please refer the below Job-DSL documentation to create a folder in Jenkins through Job-DSL.

Folder

folder('folder-a') {
    description('Folder containing all jobs for folder-a')
}
job('folder-a/job-a') {
    // Job config goes here
}