0

Below is the config.xml for sectioned view plugin for section "View Listing Sections"

<hudson.plugins.sectioned__view.SectionedView plugin="sectioned-view@1.20">
  <owner class="hudson" reference="../../.."/>
  <name>pipeline view</name>
  <filterExecutors>false</filterExecutors>
  <filterQueue>false</filterQueue>
  <properties class="hudson.model.View$PropertyList"/>
  <sections>
    <hudson.plugins.sectioned__view.ViewListingSection>
      <jobNames>
        <comparator class="hudson.util.CaseInsensitiveComparator"/>
      </jobNames>
      <jobFilters/>
      <name></name>
      <width>FULL</width>
      <alignment>CENTER</alignment>
      <views>
        <string>pipeline1</string>
        <string>pipeline2</string>
      </views>
      <columns>1</columns>
    </hudson.plugins.sectioned__view.ViewListingSection>
  </sections>
</hudson.plugins.sectioned__view.SectionedView>

I want to dynamically add a new pipeline view with name "pipeline3" to this config.xml and I am using Job DSL for the same. Below is the code which I have tried.

sectionedView('pipeline view') {
  configure { node ->
node / sections / 'hudson.plugins.sectioned__view.ViewListingSection'/ 'views' / string('pipeline3')
  }
}

The above code overrides the entire xml configuration instead of just appending a new value.

Can you please suggest me a solution for this. Thank you

shwetha
  • 376
  • 4
  • 7
  • 22

1 Answers1

0

Job DSL can only generate a complete view configuration. It can not update some parts of a view. You need to define the complete view configuration in Job DSL.

daspilker
  • 8,154
  • 1
  • 35
  • 49
  • Thank you for you reply! Is there a way to use existing view to update the configuration, for example in case of jobs, `job('job1'){ using('job1') configure{ .....} } can be used to update the job` – shwetha Dec 23 '16 at 11:37