-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
jenkins 1.625.1
job-dsl-plugin 1.39
cloudbees-folder 5.0
I have a 2 level scheme for using Job DSL. The top level seed job creates folders and seed jobs within them. The per-folder seed job creates jobs and views within that folder.
If I run the top level seed after the per-folder seed then jobs remain but the views are removed.
This can be seen by running the following in a "Process Job DSLs" step (with action for removed jobs and views set to "Ignore"). Run this top level seed, then the afolder/seed and the job and view are created. Run the top level seed again and afolder/aview has disappeared.
folder('afolder') job('afolder/seed') { description('Create a view and a job') steps { dsl { text("""listView('aview') {} job('ajob') {}""") lookupStrategy('SEED_JOB') } } }
- is duplicated by
-
JENKINS-51035 Regression: Job DSL `folder('existing-folder')` creation destroys any views in that folder
-
- Closed
-
- is related to
-
JENKINS-48288 Can't change primaryView after Folder is generated
-
- Closed
-
I encountered this issue as well. I resolved it by detecting if the folder exists. If the folder exists then don't create it. This happens because views are stored in the folder/config.xml which is the file that is the folder configuration. When Job DSL folder("folder") creates a folder it overwrites folder/config.xml with the new folder settings and because views are not included when the folder is created the second time it overwrites.
This gives the impression that the views are being deleted. However, the folder creation is behaving the same way as the job creation. Generate a new config.xml and overwrite the old one.