Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-31308

Creating folder removes existing views within that

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: job-dsl-plugin
    • Labels:
      None
    • Environment:
      jenkins 1.625.1
      job-dsl-plugin 1.39
      cloudbees-folder 5.0
    • Similar Issues:

      Description

      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')
          }
        }
      }
      

        Attachments

          Issue Links

            Activity

            Hide
            daspilker Daniel Spilker added a comment -

            But that would only be a workaround that can only be used when no folder options must be changed. If you want to change folder option you would have to disable the tick and then loose all views.

            Another workaround would be to run all pre-folder seed jobs after running the top-level seed job. Then all views will be regenerated. But there will be a (hopefully short) time where the folders will have no views. There is a DSL method to queue builds: https://jenkinsci.github.io/job-dsl-plugin/#path/queue

            Show
            daspilker Daniel Spilker added a comment - But that would only be a workaround that can only be used when no folder options must be changed. If you want to change folder option you would have to disable the tick and then loose all views. Another workaround would be to run all pre-folder seed jobs after running the top-level seed job. Then all views will be regenerated. But there will be a (hopefully short) time where the folders will have no views. There is a DSL method to queue builds: https://jenkinsci.github.io/job-dsl-plugin/#path/queue
            Hide
            bruce Dirk Kuypers added a comment -

            My motivation for something like this is the missing dashboard view in job-dsl which I configure by hand (sometimes). :-D

            Once I really messed up our server at restart with monkey patching the config.xml so I am reluctant since then to use that. And unfortunately I am in a .NET/Windows environment here (with no Java/Groovy at all) which sets the bar quite high for me to start contributing the dashboard view stuff.

            Show
            bruce Dirk Kuypers added a comment - My motivation for something like this is the missing dashboard view in job-dsl which I configure by hand (sometimes). :-D Once I really messed up our server at restart with monkey patching the config.xml so I am reluctant since then to use that. And unfortunately I am in a .NET/Windows environment here (with no Java/Groovy at all) which sets the bar quite high for me to start contributing the dashboard view stuff.
            Hide
            daspilker Daniel Spilker added a comment -

            Dirk Kuypers: There is a ticket for adding the dashboard view: JENKINS-29146. Please add a comment over there which mentions the options that you need for a start. The dashboard view has a ton of options and it would be easier to start with a very limited subset.

            Show
            daspilker Daniel Spilker added a comment - Dirk Kuypers : There is a ticket for adding the dashboard view: JENKINS-29146 . Please add a comment over there which mentions the options that you need for a start. The dashboard view has a ton of options and it would be easier to start with a very limited subset.
            Hide
            bruce Dirk Kuypers added a comment - - edited

            Thanks for the hint, Daniel!

            Show
            bruce Dirk Kuypers added a comment - - edited Thanks for the hint, Daniel!
            Hide
            rg Russell Gallop added a comment -

            Thanks for all of the suggestions.

            My idea is that the top level seed shouldn't have to know about all of the jobs and the per-folder seeds create the jobs and add them to views explicitly. So one option would be to have all of the seeds at the top level (seed, seed_folder1, seed_folder2). seed would create seed_folder1/2 etc. then they would be responsible for creating the folders, jobs and views. The downside of this is that you can't take advantage of per folder lookup strategy, all jobs would have to have full names.

            Show
            rg Russell Gallop added a comment - Thanks for all of the suggestions. My idea is that the top level seed shouldn't have to know about all of the jobs and the per-folder seeds create the jobs and add them to views explicitly. So one option would be to have all of the seeds at the top level (seed, seed_folder1, seed_folder2). seed would create seed_folder1/2 etc. then they would be responsible for creating the folders, jobs and views. The downside of this is that you can't take advantage of per folder lookup strategy, all jobs would have to have full names.

              People

              • Assignee:
                daspilker Daniel Spilker
                Reporter:
                rg Russell Gallop
              • Votes:
                3 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated: