【问题标题】:How can a final-job-to-be-displayed in a Jenkins Delivery Pipeline view be configured using the Job DSL?如何使用 Job DSL 配置要在 Jenkins Delivery Pipeline 视图中显示的最终作业?
【发布时间】:2016-05-17 13:50:43
【问题描述】:

设置

如何通过 UI 实现

在View配置页面,有一个view最后显示的job的设置:

Pipelines
  Components
    Name                    [text field here]
    Initial Job             [text field here]
    Final Job (optional)    [text field here]

当给出final Job时,视图不会显示任何可能由该作业触发的作业,即如标签所示,该作业是此视图中显示的最后一个作业。

问题

如何使用 Job DSL 配置这个最终的作业名称?

【问题讨论】:

    标签: jenkins jenkins-job-dsl delivery-pipeline


    【解决方案1】:

    内置 DSL 目前不支持设置最后一个作业。但是您可以使用Configure Block 来生成任何配置:

    deliveryPipelineView('example') {
      pipelines {
        component('one', 'foo1')
        component('two', 'foo2')
      }
      configure { view ->
        def components = view / componentSpecs
        components.'se.diabol.jenkins.pipeline.DeliveryPipelineView_-ComponentSpec'[0] << lastJob('bar1')
        components.'se.diabol.jenkins.pipeline.DeliveryPipelineView_-ComponentSpec'[1] << lastJob('bar2')
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-20
      相关资源
      最近更新 更多