简体   繁体   English

使用Job DSL将新管道附加到“查看列表部分”-Jenkins

[英]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" 以下是“视图列表部分”部分的部分视图插件的config.xml

<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. 我想向此config.xml动态添加一个名称为“ pipeline3”的新管道视图,并且我正在使用Job DSL。 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. 上面的代码将覆盖整个xml配置,而不是仅附加一个新值。

Can you please suggest me a solution for this. 您能给我建议一个解决方案吗? Thank you 谢谢

Job DSL can only generate a complete view configuration. 作业DSL只能生成完整的视图配置。 It can not update some parts of a view. 它无法更新视图的某些部分。 You need to define the complete view configuration in Job DSL. 您需要在Job DSL中定义完整的视图配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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