简体   繁体   中英

Append new pipeline to 'view listing sections' using Job DSL - Jenkins

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM