Currently JobDSL plugin does not support creating delivery pipeline views which are based on Jenkins pipeline jobs.

      The pipeline delivery plugin has added support for such views two years ago (https://issues.jenkins-ci.org/browse/JENKINS-34040) but the job dsl plugin still misses that support.

          [JENKINS-59117] Add support for WorkflowPipelineView to JobDSL

          https://github.com/Diabol/delivery-pipeline-plugin/pull/304
          https://github.com/jenkinsci/job-dsl-plugin/pull/1200

          These two pull requests will enable Dynamic DSL support:

          folder('example-folder') {
            views {
              workflowPipelineView {
                name('example-view')
                allowAbort(true)
                allowPipelineStart(true)
                description('test')
                linkToConsoleLog(true)
                maxNumberOfVisiblePipelines(8)
                noOfColumns(12)
                noOfPipelines(7)
                showAbsoluteDateTime(true)
                showChanges(true)
                sorting('se.diabol.jenkins.pipeline.sort.NameComparator')
                updateInterval(100)
                componentSpecs {
                  componentSpec {
                    name('example')
                    job('example-pipeline')
                  }
                }
              }
            }
          }
          

          Daniel Spilker added a comment - https://github.com/Diabol/delivery-pipeline-plugin/pull/304 https://github.com/jenkinsci/job-dsl-plugin/pull/1200 These two pull requests will enable Dynamic DSL support: folder( 'example-folder' ) { views { workflowPipelineView { name( 'example-view' ) allowAbort( true ) allowPipelineStart( true ) description( 'test' ) linkToConsoleLog( true ) maxNumberOfVisiblePipelines(8) noOfColumns(12) noOfPipelines(7) showAbsoluteDateTime( true ) showChanges( true ) sorting( 'se.diabol.jenkins.pipeline.sort.NameComparator' ) updateInterval(100) componentSpecs { componentSpec { name( 'example' ) job( 'example-pipeline' ) } } } } }

          I've just spend a day trying to figure out my jobdsl config for WorkflowPipelineView is not working, without realising `deliveryPipelineView` is not the way.

          daspilker since other two PRs you have linked are merged is there anything else blocking this issue?

          Jakub Siberski added a comment - I've just spend a day trying to figure out my jobdsl config for WorkflowPipelineView is not working, without realising `deliveryPipelineView` is not the way. daspilker since other two PRs you have linked are merged is there anything else blocking this issue?

          The change in Delivery Pipeline plugin has not been released yet. Pinging patbos.

          Daniel Spilker added a comment - The change in Delivery Pipeline plugin has not been released yet. Pinging patbos .

          daspilker which change are you referring to?

          With the two changes merged, the auto-generated DSL (<JENKINS>/plugin/job-dsl/api-viewer/index.html#method/javaposse.jobdsl.dsl.views.NestedViewsContext.workflowPipelineView) is limited to:

           

          workflowPipelineView {
            name(String value) 
            description(String value)
          }
          

           

          I've been trying all sorts of configure{} combinations but no success yet.   

          From what I can tell, "WorkflowPipelineView" is the only option for showing Pipeline Jobs that are outside the current folder/subfolder hierarchy...

          Alexander Komarov added a comment - daspilker  which change are you referring to? With the two changes merged, the auto-generated DSL ( <JENKINS>/plugin/job-dsl/api-viewer/index.html#method/javaposse.jobdsl.dsl.views.NestedViewsContext.workflowPipelineView ) is limited to:   workflowPipelineView { name( String  value) description( String  value) }   I've been trying all sorts of configure{} combinations but no success yet.    From what I can tell, "WorkflowPipelineView" is the only option for showing Pipeline Jobs that are outside the current folder/subfolder hierarchy...

          In the meantime, I have this, and everything works except for <job> node (it's simply ignored, and I don't know why).  Maybe it'll serve as a starting point for someone:
           

          // code placeholder
          folder('infra/test-folder') {
              configure { f ->
                  f / folderViews / views / 'se.diabol.jenkins.workflow.WorkflowPipelineView'(plugin: "delivery-pipeline-plugin@1.4.2") {
                      name 'generated view 2'
                      // note: relative path for the folder nesting depth:
                      owner(reference: "../../../..", class: "com.cloudbees.hudson.plugins.folder.Folder")
          
                      allowAbort(true)
                      allowPipelineStart(true)
                      description('test')
                      linkToConsoleLog(true)
                      maxNumberOfVisiblePipelines(8)
                      noOfColumns(12)
                      noOfPipelines(7)
                      showAbsoluteDateTime(true)
                      showChanges(true)
                      sorting('se.diabol.jenkins.pipeline.sort.NameComparator')
                      updateInterval(100)
          
          
                      componentSpecs {
                          'se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec' {
                              name 'AAA'
                              // this is ignored:
                              job '../../some/folder/some-job'
                          }
                      }
                  }
              }
          }
          

          Alexander Komarov added a comment - In the meantime, I have this, and everything works except for  <job> node (it's simply ignored, and I don't know why).  Maybe it'll serve as a starting point for someone:   // code placeholder folder( 'infra/test-folder' ) { configure { f -> f / folderViews / views / 'se.diabol.jenkins.workflow.WorkflowPipelineView' (plugin: "delivery-pipeline-plugin@1.4.2" ) { name 'generated view 2' // note: relative path for the folder nesting depth: owner(reference: "../../../.." , class: "com.cloudbees.hudson.plugins.folder.Folder" ) allowAbort( true ) allowPipelineStart( true ) description( 'test' ) linkToConsoleLog( true ) maxNumberOfVisiblePipelines(8) noOfColumns(12) noOfPipelines(7) showAbsoluteDateTime( true ) showChanges( true ) sorting( 'se.diabol.jenkins.pipeline.sort.NameComparator' ) updateInterval(100) componentSpecs { 'se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec' { name 'AAA' // this is ignored: job '../../some/folder/some-job' } } } } }

          Nick added a comment - - edited

          Plugin Used: "delivery-pipeline-plugin@1.4.2"

          Confirmed in Jenkins Job DSL Playground (http://job-dsl.herokuapp.com/) that the job tag is ignored when converting groovy to XML as akom mentions. This makes it impossible to add Pipelines to the "Delivery Pipeline View for Jenkins Pipelines" without using the UI.

          This componentSpecs in groovy

                      componentSpecs \{
                          'se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec' {
                              name 'test'
                              job "test"
                          }
          

          Translates to this componentSpecs in XML

                          <componentSpecs>
                              <se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec>
                                  <name>test</name>
                              </se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec>
                          </componentSpecs>
          

          Whereas if I change the job tag to “jobs” it is not ignored.

          This componentSpecs in groovy

                      componentSpecs \{
                          'se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec' {
                              name 'test'
                              jobs 'test'
                          }
          

          Translates to this componentSpecs in XML

                          <componentSpecs>
                              <se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec>
                                  <name>test</name>
                                  <jobs>test</jobs>
                              </se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec>
                          </componentSpecs>
          

          When creating the view with JOB DSL the only fields available to populate are name and description as akom mentions above.

          workflowPipelineView {
            name(String value) 
            description(String value)
          }
          

          When you try to add another field such as noOfColumns()

          folder('TEST') {
            views {
              workflowPipelineView {
                name('test')
                description('test')
                noOfColumns(1)
              }
            }
          }
          

          It returns this error.

          ERROR: (script, line 11) No signature of method: noOfColumns() is applicable for argument types: (java.lang.Integer) values: [1]
          Possible solutions: name(), description()
          

          patbos would it be possible to allow all fields to be configured when creating the view through JOB DSL like daspilker mentions here?
          https://issues.jenkins.io/browse/JENKINS-59117?focusedCommentId=409185&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-409185
          Failing that could a fix be put in for the bug that ignores the job tag when converting groovy to XML as detailed above?

          Thank you.

          Nick added a comment - - edited Plugin Used: "delivery-pipeline-plugin@1.4.2" Confirmed in Jenkins Job DSL Playground ( http://job-dsl.herokuapp.com/)  that the job tag is ignored when converting groovy to XML as akom mentions. This makes it impossible to add Pipelines to the "Delivery Pipeline View for Jenkins Pipelines" without using the UI. This componentSpecs in groovy componentSpecs \{ 'se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec' { name 'test' job "test" } Translates to this componentSpecs in XML <componentSpecs> <se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec> <name>test</name> </se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec> </componentSpecs> Whereas if I change the job tag to “jobs” it is not ignored. This componentSpecs in groovy componentSpecs \{ 'se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec' { name 'test' jobs 'test' } Translates to this componentSpecs in XML <componentSpecs> <se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec> <name>test</name> <jobs>test</jobs> </se.diabol.jenkins.workflow.WorkflowPipelineView_-ComponentSpec> </componentSpecs> When creating the view with JOB DSL the only fields available to populate are name and description as akom mentions above. workflowPipelineView { name( String value) description( String value) } When you try to add another field such as noOfColumns() folder( 'TEST' ) { views { workflowPipelineView { name( 'test' ) description( 'test' ) noOfColumns(1) } } } It returns this error. ERROR: (script, line 11) No signature of method: noOfColumns() is applicable for argument types: (java.lang. Integer ) values: [1] Possible solutions: name(), description() patbos would it be possible to allow all fields to be configured when creating the view through JOB DSL like daspilker mentions here? https://issues.jenkins.io/browse/JENKINS-59117?focusedCommentId=409185&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-409185 Failing that could a fix be put in for the bug that ignores the job tag when converting groovy to XML as detailed above? Thank you.

            patbos Patrik Boström
            dmarkhas Dan Markhasin
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: