如何使用Job DSL配置Jenkins Delivery Pipeline视图中的最终作业?

时间:2016-05-17 13:50:44

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

设置

如何通过UI

完成

查看配置页面上,视图中最后显示的作业的设置

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

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

问题

如何使用Job DSL配置此最终作业名称?

1 个答案:

答案 0 :(得分:2)

内置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')
  }
}
相关问题