Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a list view in a subfolder using the job DSL plugin in Jenkins

In Jenkins you can easily create a list view with the Job DSL

listView("myView") {
    jobs {
        regex(".*")
    }
}

but if you try to create a list view within a folder, the folder will be created but not the view

folder("someFolder")

listView("someFolder/myView") {
    jobs {
        regex(".*")
    }
}

Is there a way to accomplish this?

like image 657
nebffa Avatar asked Oct 31 '22 16:10

nebffa


1 Answers

This occurs when a Job DSL performs operations in this order:

  1. Create a folder
  2. Create a view for that folder
  3. Re-create the folder

The reason this happens is that views live in the config file for a folder. When you re-generate a folder, it deletes any configured views for that folder.

To fix this issue in my case, I removed any duplicate folder creation so that each folder was only created once.

like image 51
nebffa Avatar answered Nov 15 '22 05:11

nebffa