Search code examples
jenkins-job-dsl

Add Build Description in Sectioned View using DSL/Groovy Jenkins plugin


I wish to use jenkins-job-dsl plugin to add 'Build Description' column in my sectioned view. Unfortunately I couldn't find any information in Jenkins Job DSL API (http://sheehan.github.io/job-dsl-plugin/#) about it.

I assume it is not available via dsl jenkins api, but I would like to make sure. Thanks!


Solution

  • If something is supported out of the box, you can use a Configure Block to add any config elements:

    sectionedView('project-summary') {
      filterBuildQueue()
      filterExecutors()
      sections {
        listView {
          name('Project A')
          jobs {
            regex(/project-A-.*/)
          }
          columns {
            status()
            weather()
            name()
            lastSuccess()
            lastFailure()
          }       
        }
      }
      configure { view ->
        view / sections / 'hudson.plugins.sectioned__view.ListViewSection' / columns << 'jenkins.plugins.extracolumns.BuildDescriptionColumn' {
          columnWidth(80)
          forceWidth(false)
        }
      }
    }